Answered by:
Distribution of Bernoulli estimate

Question
-
In the Infer.net model I'm using I have a boolean variable that I wish to work out the distribution of Infer.net's estimation of the Bernoulli distribution for that variable (which I think is called the conjugate prior, in this case the beta distribution?). Currently I infer from the model the Bernoulli variable like so:
Bernoulli P1WinEstimate = predictmodel.engine.Infer<Bernoulli>(predictmodel.P1Win);
However I'm unsure what I should do to get the Beta distribution for this Bernoulli variable from here. What is the appropriate way to do this in Infer.net?
Wednesday, September 24, 2014 3:48 PM
Answers
-
Given skills for the two players, the probability that player 0 will win is MMath.NormalCdf((Skill[0]-Skill[1])/Math.Sqrt(2*Beta)). Call this p. Infer.NET can't compute the distribution of p, but you can easily compute moments of p. The expected value of p is the probability that P1Win is true, as you have already computed. The expected value of p^2 is the probability that player 0 will win 2 games. You can make a second model that computes this. Finally, the variance of p is p(win 2 games) - p(win 1 game)^2.
- Marked as answer by MarkG87 Sunday, September 28, 2014 1:37 PM
Friday, September 26, 2014 12:48 PMOwner
All replies
-
The Beta distribution would be for the parent variable of P1Win. How have you defined P1Win in the model?
- Edited by Tom MinkaMicrosoft employee, Owner Wednesday, September 24, 2014 5:39 PM
Wednesday, September 24, 2014 5:38 PMOwner -
It's the TrueSkill model - full model code below:
public PredictModel() //Build model { BetaPrior = Variable.New<Gamma>(); Beta = Variable.Random<double, Gamma>(BetaPrior); for (int i = 0; i < 2; i++) { SkillPrior[i] = Variable.New<Gaussian>(); Skill[i] = Variable.Random<double, Gaussian>(SkillPrior[i]); Performance[i] = Variable.GaussianFromMeanAndPrecision(Skill[i], Beta); } PerformanceDiff = Performance[0] - Performance[1]; P1Win = (PerformanceDiff) > 0; P2Win = (-PerformanceDiff) > 0; }
Thursday, September 25, 2014 11:39 PM -
There is no Beta distribution in this model. Perhaps you could clarify the question?Friday, September 26, 2014 11:45 AMOwner
-
Essentially I'm trying to infer how confident the model is in its prediction of the Bernoulli value - so something like the distribution of that prediction or confidence intervals would be very useful. I tried variance but that simply gives p(1-p) which doesn't capture what I'm trying to understand.Friday, September 26, 2014 12:03 PM
-
Given skills for the two players, the probability that player 0 will win is MMath.NormalCdf((Skill[0]-Skill[1])/Math.Sqrt(2*Beta)). Call this p. Infer.NET can't compute the distribution of p, but you can easily compute moments of p. The expected value of p is the probability that P1Win is true, as you have already computed. The expected value of p^2 is the probability that player 0 will win 2 games. You can make a second model that computes this. Finally, the variance of p is p(win 2 games) - p(win 1 game)^2.
- Marked as answer by MarkG87 Sunday, September 28, 2014 1:37 PM
Friday, September 26, 2014 12:48 PMOwner