locked
Inference on a game graph : how to visualise? (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • alexjames posted on 06-09-2010 3:53 AM

    Hello there

    I have been experimenting with the following example:

    http://research.microsoft.com/en-us/um/cambridge/projects/infernet/docs/How%20to%20represent%20large%20irregular%20graphs.aspx

    If we have two performances A and B on a single trial, I am unclear about what happens when two performances are compared with the ConstrainTrue ( A > B) function, and what happens to the distributions afterwards.

    My guess is as follows based on your super tutorials and an online lecture on intro. bayes:

    1. On making the comparison, a joint distribution is created, which we can imagine as a 2D isograph;

    2. This distribution creates a point on X-Y, which shifts the point around the square as means of the two gaussians shift. For equally performing pairs, the point is in the centre of the square;

    3. The winning half of the square will usually contain stronger performances and so the winning gaussian will tend to a larger value.

    4. The losing half will usually contain weaker performances and so the losing gaussian will tend to a smaller value.

    Can you expand a bit and poss. help me visualise so I can understand what is going on 'under the hood'? Is it possible to visualise in some way, e.g. in Matlab?

    best

    alex

    Friday, June 3, 2011 5:46 PM

Answers

  • jwinn replied on 06-17-2010 3:06 PM

    Hi Alex,

    Glad you're making progress - post again if you have particular questions on anything.

    Best,
    John W.

    Friday, June 3, 2011 5:47 PM

All replies

  • jwinn replied on 06-09-2010 1:29 PM

    A great explanation of the TrueSkill model (which doesn't use Infer.NET unfortunately!) is on this page:
    http://www.moserware.com/2010/03/computing-your-skill.html
    It has lots of detailed explanation and visualisations and should help understand how the model works.

    Best,
    John W.

    Friday, June 3, 2011 5:47 PM
  • alexjames replied on 06-14-2010 8:19 AM

    Thanks john, that's great, just what I wanted. However, I was interested in experimenting with infer.net, so i wonder if i could ask afurther question. 

    Is there a way of representing a ranking inference algorithm without using a Gaussian model? For example, using observed variables that specify if one agent has won or not, as opposed to a pair of agents in which one has won and one has lost, and linking to Bernoulli distributins in some way?

    best

    alex

    Friday, June 3, 2011 5:47 PM
  • jwinn replied on 06-14-2010 10:17 AM

    I think the main thing you need is to have some continuous latent variable in order to be able to rank players.  This could have a Beta distribution (e.g. over the probability of winning) instead of a Gaussian distribution, but it would be difficult to design a model without such an underlying continuous variable. However, if you come up with one, please share it here!

    Why are you keen for the model not to be Gaussian?

    Best,
    John W.

     

    Friday, June 3, 2011 5:47 PM
  • alexjames replied on 06-14-2010 10:44 AM

    Hello John

    I was keen to see how to implement the model in infer.net by way of a comparison with the gaussian model (and to familiarise myself with infer.net), as per Stern's Go model which has two different implementations of a ranking model, which i also note has a beta latent variable like you suggest, but bernoulli for the observations: 

    http://research.microsoft.com/pubs/67955/p873-stern.pdf

    "The full Bayesian ranking model can
    infer a global ranking from these pairs. In contrast,
    the Independent Bernoulli model cannot infer a global
    ranking for the chain. It would learn the probabilities
    fA;B;C;Dg = f1=1; 1=2; 1=2; 0=1g where each fraction
    is (times played)/(total times seen). In the second
    graph the data do not provide enough information
    to learn a global ranking."

    I wonder if you could point me in the right direction re. an implementation of the latter?

    Best

    alex

    Friday, June 3, 2011 5:47 PM
  • alexjames replied on 06-15-2010 5:13 AM

    Hello John

    I have found the below as a starting point for experimentation with inferring beta ranks from bernoulli, from a separate post 'learning a beta. 

    thanks again

    best

    alex

     

    (http://community.research.microsoft.com/forums/p/2779/4456.aspx#4456)

     #light

    // Reference the Infer.NET DLLs

    #r @"C:\Program Files\Microsoft Research\Infer.NET 2.2\bin\Release\Infer.Compiler.dll"
    #r @"C:\Program Files\Microsoft Research\Infer.NET 2.2\bin\Release\Infer.Runtime.dll"

    open MicrosoftResearch.Infer
    open MicrosoftResearch.Infer.Models
    open MicrosoftResearch.Infer.Distributions
    open MicrosoftResearch.Infer.Factors

    let data =
    [|
        [|
    true;true;false;true;true;false|];
        [|
    true;true;true;false;true|]
    |]

    // Sizes of the inner arrays

    let sizes = data |> Array.map (fun d -> d.Length)

    // Outer range

    let uRange = Range(sizes.Length)

    // The sizes as a variable array

    let sizesVar = Variable.Constant(sizes, uRange)

    // The inner variable range

    let sRange = Range(sizesVar.[uRange])

    // The Bernoulli parameters

    let epsilon = Variable.Array<double>(uRange)
    epsilon.[uRange] <- Variable.Beta(1.0,1.0).ForEach(uRange)

    // The draws from the Bernoullis

    let e = Variable.Array<_>(Variable.Array<bool>(sRange), uRange)
    e.[uRange].[sRange] <- Variable.Bernoulli(epsilon.[uRange]).ForEach(sRange)

    // The observations:

    e.ObservedValue <- data
    let ie = InferenceEngine(VariationalMessagePassing())
    ie.ShowProgress =
    false
    let epsPosteriors = Distribution< >.ToArray<Beta[>(ie.Infer< >(epsilon))
    let epsPosteriorMeans = epsPosteriors |> Array.map (fun post -> post.GetMean())
    printf
    "Epsilon posterior means: %A" epsPosteriorMeans
    ()

    Friday, June 3, 2011 5:47 PM
  • alexjames replied on 06-15-2010 5:16 AM

    Hello John

    I thnk the below gives me a startig point. 

    Best

    alex

     

     #light

    // Reference the Infer.NET DLLs

    #r @"C:\Program Files\Microsoft Research\Infer.NET 2.2\bin\Release\Infer.Compiler.dll"
    #r @"C:\Program Files\Microsoft Research\Infer.NET 2.2\bin\Release\Infer.Runtime.dll"

    open MicrosoftResearch.Infer
    open MicrosoftResearch.Infer.Models
    open MicrosoftResearch.Infer.Distributions
    open MicrosoftResearch.Infer.Factors

    let data =
    [|
        [|
    true;true;false;true;true;false|];
        [|
    true;true;true;false;true|]
    |]

    // Sizes of the inner arrays

    let sizes = data |> Array.map (fun d -> d.Length)

    // Outer range

    let uRange = Range(sizes.Length)

    // The sizes as a variable array

    let sizesVar = Variable.Constant(sizes, uRange)

    // The inner variable range

    let sRange = Range(sizesVar.[uRange])

    // The Bernoulli parameters

    let epsilon = Variable.Array<double>(uRange)
    epsilon.[uRange] <- Variable.Beta(1.0,1.0).ForEach(uRange)

    // The draws from the Bernoullis

    let e = Variable.Array<_>(Variable.Array<bool>(sRange), uRange)
    e.[uRange].[sRange] <- Variable.Bernoulli(epsilon.[uRange]).ForEach(sRange)

    // The observations:

    e.ObservedValue <- data
    let ie = InferenceEngine(VariationalMessagePassing())
    ie.ShowProgress =
    false
    let epsPosteriors = Distribution< >.ToArray<Beta[>(ie.Infer< >(epsilon))
    let epsPosteriorMeans = epsPosteriors |> Array.map (fun post -> post.GetMean())
    printf
    "Epsilon posterior means: %A" epsPosteriorMeans
    ()

    Friday, June 3, 2011 5:47 PM
  • jwinn replied on 06-17-2010 3:06 PM

    Hi Alex,

    Glad you're making progress - post again if you have particular questions on anything.

    Best,
    John W.

    Friday, June 3, 2011 5:47 PM