Hi
I am struggling with these four lines of code, I don't understand why I am getting an error.
******************************************************
VariableArray<VectorGaussian> D = Variable.Array<VectorGaussian>(classRange);D[classRange] = Variable.New<VectorGaussian>().ForEach(classRange);
VariableArray<Vector> x = Variable.Array<Vector>(classRange).Named("x");x[classRange] = Variable.Random<Vector, VectorGaussian>(D[classRange]);
gives me an error at the execution of line 2: Unhandled Exception: System.InvalidOperationException: vVectorGaussian[ ]1[classRange] was not defined in this condition block.
I'm guessing the problem comes from the fact that D is not properly initialized... but how can I define it other than what I have done?
Is there another way to store an array of distributions? My intention was to update the "observed value" of the distribution array D with the results of the inference, using D.ObservedValue = Distribution.ToArray<VectorGaussian[ ]>( (IDistribution<Vector[ ]>) inferred[0])
If I store D as an array of VectorGaussian instead of a VariableArray, then I am in trouble for the indexing, as x must be indexed by a range and D by an integer...
Any help welcome! Many thanks,
Julia
You don't want the second line at all. The first line already creates an array with undefined elements.