Question about "Model has zero probability" error RRS feed

  • Question

  •             var trueAnswer = Variable.Array<int>(question);
                trueAnswer[question] = Variable.DiscreteUniform(nChoices).ForEach(question);
                using (Variable.ForEach(obs))
                    var q = questionOfObs[obs];
                    var advantage = ability[subjectOfObs[obs]] - difficulty[q];
                    var correct = Variable.BernoulliFromLogOdds(advantage);
                    using (Variable.If(correct))
                    using (Variable.IfNot(correct))
                InferenceEngine engine = new InferenceEngine(new VariationalMessagePassing());


    I am experimenting with the variations on the Difficulty vs. Ability example from Bachrach et.al.. I am interested in using the BernoulliFromLogOdds factor (and the softmax factor later) to incorporate some model parameters which make these factors particularly suitable (the original model in the example is a probit model). Above though, I've stripped away all the extra model parameters and simplified my model to the most minimal example which still gives me the "model has zero probability" error. I've read the previous post on this error on this forum, and made sure that all the observations are possible in the model (i.e. the observations all fit in the range over the number of choices), and I am not using any factors (as far as I know) that lead to improper distributions. Priors over ability and difficulty are the same as in the example (copied below), and response variables are created the same way as well.

    I should also note that the original example worked well with my data.

    While it's true that the original model would accomplish the same thing (via the probit), I am very interested in understanding what causes this model to fail.

    Thank you for any help you can provide!

    Gaussian difficultyPrior = new Gaussian(0, 1);
    var difficulty = Variable.Array<double>(question);
    difficulty[question] = Variable.Random(difficultyPrior).ForEach(question);

    Gaussian abilityPrior = new Gaussian(0, 1);
    var ability = Variable.Array<double>(subject);
    ability[subject] = Variable.Random(abilityPrior).ForEach(subject);

    Range obs = new Range(nObservations);
    var subjectOfObs = Variable.Array<int>(obs);
    subjectOfObs.ObservedValue = ...; (loaded from array)
    var questionOfObs = Variable.Array<int>(obs);
    questionOfObs.ObservedValue = ...; (loaded from array)
    var response = Variable.Array<int>(obs);
    response.ObservedValue = ...;
    (loaded from array)

    Sunday, January 18, 2015 11:45 PM

All replies

  • This error is due to using VariationalMessagePassing on a model without sufficient observation noise.  It has nothing to do with the BernoulliFromLogOdds factor.  VMP requires each branch of a condition to have observation noise.  In the model you gave, the "correct" branch has no observation noise.
    Tuesday, January 27, 2015 7:16 PM