locked
Trying to infer the values by observing their pair products. Always getting "Not converging for n=0,x=NaN" RRS feed

  • Question

  • I feel that the problem is solvable, but I cannot make the inference work.

                var count = 5;
                var trueValues = new double[] { 1, 2, 3, 4, 5 };
                var distributions = Enumerable.Range(0, count).Select(i => Variable.GaussianFromMeanAndVariance(Variable.GaussianFromMeanAndVariance(0, 100), Variable.GammaFromShapeAndScale(1, 1)).Named("v_" + i)).ToArray();
    
                for (int i = 0; i < count; i++) {
                    for (int j = i + 1; j < count; j++) {
                        (Variable.GaussianFromMeanAndVariance(distributions[i] * distributions[j], Variable.GammaFromShapeAndScale(1, 1))).ObservedValue = trueValues[i] * trueValues[j];
                    }
                }
    
                var engine1 = new InferenceEngine();
                for (int i = 0; i < count; i++) {
                    Console.WriteLine(engine1.Infer(distributions[i]));
                }

    Thursday, February 9, 2017 1:03 PM

All replies

  • Did you mean Variable.GaussianFromMeanAndPrecision in the two outer calls?

    -Y-

    Monday, March 20, 2017 4:17 PM
  • What is this line of code doing:

    var distributions = Enumerable.Range(0, count).Select(i => Variable.GaussianFromMeanAndVariance(Variable.GaussianFromMeanAndVariance(0, 100), Variable.GammaFromShapeAndScale(1, 1)).Named("v_" + i)).ToArray()

    Wednesday, April 12, 2017 11:54 PM