5e329a5e3e9453ae0800ab438d2fa9f991f35a00,pymc3/examples/LKJ_correlation.py,,,#,8

Before Change


// In order to convert the upper triangular correlation values to a complete
// correlation matrix, we need to construct an index matrix:
n_elem = int(n_var * (n_var - 1) / 2)
tri_index = np.zeros([n_var, n_var], dtype=int)
tri_index[np.triu_indices(n_var, k=1)] = np.arange(n_elem)
tri_index[np.triu_indices(n_var, k=1)[::-1]] = np.arange(n_elem)

with pm.Model() as model:

After Change


    cov = tt.dot(chol, chol.T)

    // Extract the standard deviations etc
    sd = pm.Deterministic("sd", tt.sqrt(tt.diag(cov)))
    corr = tt.diag(sd**-1).dot(cov.dot(tt.diag(sd**-1)))
    r = pm.Deterministic("r", corr[np.triu_indices(n_var, k=1)])

    like = pm.MvNormal("likelihood", mu=mu, chol=chol, observed=dataset)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pymc-devs/pymc3
Commit Name: 5e329a5e3e9453ae0800ab438d2fa9f991f35a00
Time: 2017-06-02
Author: junpeng.lao@unifr.ch
File Name: pymc3/examples/LKJ_correlation.py
Class Name:
Method Name:


Project Name: aleju/imgaug
Commit Name: 3326e5fcae11a6723c0f6a8db0bf56c3a8d04eef
Time: 2019-08-11
Author: kontakt@ajung.name
File Name: test/augmenters/test_edges.py
Class Name: TestCanny
Method Name: test__draw_samples__single_value_hysteresis


Project Name: aleju/imgaug
Commit Name: 3326e5fcae11a6723c0f6a8db0bf56c3a8d04eef
Time: 2019-08-11
Author: kontakt@ajung.name
File Name: test/augmenters/test_edges.py
Class Name: TestCanny
Method Name: test__draw_samples__tuple_as_hysteresis