Ali Yaghoubi posted on 03-05-2011 5:28 AM
Hi ,
I know that I am making a mistake that I think in each iteration means[z[n]] and precs[z[n]] just take means[1] and precs[1] that is only one of the two possible components of the mixture, because weights takes{1,1}.
Would you mind explaining more clear the events?
Variable<Vector>
weights = Variable.Dirichlet(k,
new
double[] { 1, 1 });
...
VariableArray<int>
z = Variable.Array<int>(n);
...
using (Variable.ForEach(n))
{
z[n] = Variable.Discrete(weights);
using (Variable.Switch(z[n]))
{
data[n] = Variable.VectorGaussianFromMeanAndPrecision(means[z[n]], precs[z[n]]);
}
}
Thanks