LKJCholeskyCov input dependent


How would you make the variance of a LKJCholeskyCov depend on some other regressor values ?

with model:
packed_L = pm.LKJCholeskyCov('packed_L', n=shape, eta=2, sd_dist=pm.HalfCauchy.dist(2.5))
L = pm.expand_packed_triangular(shape, packed_L)
Σ = pm.Deterministic('Σ',

mu_1= mu_variable(f_data, 'mu_1') # returns a linear combination of regressor beta * regressor value
mu_2 = mu_variable(f_data, 'mu_2')
mu = T.stack([eps_mu, pe_mu]).T

obs = pm.MvNormal('obs', mu=mu, chol=L, observed=target)

trace = pm.sample(3000, cores=1)

In this model, mu depends on inputs, I would like to make sd_dist depend on inputs as well. How could I do that?

Many thanks,


I am not sure it can be easily done, as LKJCholeskyCov is supposed to produce 1 covariate matrix (after unpacking) when you define one RV using it (as a result, we always use a for loop to create multiple cov matrix).
You should have a look at the GP module or pm.MatrixNormal