Partially constraining the Positive Definite Covariance Matrix

Partially constraining the Positive Definite Covariance Matrix

• maandag 12 maart 2012 13:59

Hi,

I'm not sure whether to open a new thread or not for this topic. Anyway, ...

For a multivariate Guassian distribution, I would like to have diagonal or spherical covariance matrix (constrained Positive Definite Matrix). How can I specify this in Infer.NET? For full covariance, I'm aware that I have to specify:

Variable.VectorGaussianFromMeanAndPrecision(normal_distribution_on_the_mean, Wishart_distribution_on_precision)

But what about for diagonal or spherical case? For spherical case, since there is only one parameter for covariance matrix (identity matrix times constant: independent of the dimension) I'd like to do something like:

Variable.VectorGaussianFromMeanAndGamma(normal_distribution_on_the_mean, gamma_distribution_on_precision)

But I think that there is no such built-in conditional distribution.

Any help would be appreciated.

Alle reacties

• dinsdag 13 maart 2012 14:04

The model you are talking about is equivalent to generating each element of a data vector separately, i.e.

data[n][k] = Variable.GaussianFromMeanAndPrecision(mean[z[n]][k], prec[z[n]][k])

To do this, define (data, mean, prec) as jagged arrays instead of arrays of vectors.

• Als antwoord gemarkeerd door donderdag 15 maart 2012 9:36
•
• woensdag 14 maart 2012 23:06

Hi Tom,

Thanks! I've just tried your suggestion and it works well. I was just wondering which is better (in terms of being more efficient, faster, etc for large datasets) when defining data, mean and prec (my dataset has fixed dimension for each data point):

rectangular array, i.e. VariableArray2D ()

or

jagged array, i.e. VariableArray<VariableArray<double>, double[][]>

Thanks again.

• donderdag 15 maart 2012 9:21

Jagged arrays will be the most efficient since we've put the most effort into optimizing them.  2D arrays are less common so we haven't optimized them as much.