Hello,
In my code, I make use of factor methods for Variable<Vector> but I keep getting a missing ValueRange exception when I call the Infer method.
Exception is : Cannot automatically determine distribution type for variable type Vector. You must specify a ValueRange or MarginalPRototype attribute for variable 'advantage' or its parent variables in
advantage = Test.VectorDifference(qualityA_rep[dataRange],qualityB_rep[dataRange])
I saw in the link:
http://research.microsoft.com/en-us/um/cambridge/projects/infernet/docs/Adding%20attributes%20to%20your%20model.aspx
that I am supposed to SetValueRange, but when I try to do it on variable 'advantage', I still get the error. Not sure on how to proceed. Please advise.
Range dataRange = new Range(data.Length).Named("n");
VariableArray<Vector> qualityA = Variable.Array<Vector>(dataRange);
VariableArray<Vector> qualityB = Variable.Array<Vector>(dataRange);
public static Vector VectorDifference(Vector a, Vector b)
{
return a-b;
}
using(Variable.ForEach(dataRange))
{
Variable<Vector> advantage = Variable<Vector>.Factor(new FactorMethod(VectorDifference),qualityA[dataRange],qualityB[dataRange]);
//other code
}
qualityAPosterior = Engine.Infer<Gaussian>(qualityA);//error is thrown here