Ranking calculation of probability programming with draw

吉祥 如意 31 Reputation points
2020-06-29T15:49:41.82+00:00
  On the web page“ https://learn.microsoft.com/zh-cn/dotnet/machine-learning/how-to-guides/matchup-app-infer-net ”According to the winning and losing relationship of each player and the result of the game, the players are ranked by using probabilistic programming. The source code is as follows  

static void Main(string[] args)
{
    // The winner and loser in each of 6 samples games
    var winnerData = new[] { 0, 0, 0, 1, 3, 4 };
    var loserData = new[] { 1, 3, 4, 2, 1, 2 };


Here only win or lose, such as the game is a draw, how to add a draw data, how to calculate the ranking


        // Define the statistical model as a probabilistic program  
        var game = new Range(winnerData.Length);  
        var player = new Range(winnerData.Concat(loserData).Max() + 1);  
        var playerSkills = Variable.Array<double>(player);  
        playerSkills[player] = Variable.GaussianFromMeanAndVariance(6, 9).ForEach(player);  

        var winners = Variable.Array<int>(game);  
        var losers = Variable.Array<int>(game);  

        using (Variable.ForEach(game))  
        {  
            // The player performance is a noisy version of their skill  
            var winnerPerformance = Variable.GaussianFromMeanAndVariance(playerSkills[winners[game]], 1.0);  
            var loserPerformance = Variable.GaussianFromMeanAndVariance(playerSkills[losers[game]], 1.0);  

        // The winner performed better in this game
        Variable.ConstrainTrue(winnerPerformance > loserPerformance);
    }

        // Attach the data to the model  
        winners.ObservedValue = winnerData;  
        losers.ObservedValue = loserData;  

        // Run inference  
        var inferenceEngine = new InferenceEngine();  
        var inferredSkills = inferenceEngine.Infer<Gaussian[]>(playerSkills);  

        // The inferred skills are uncertain, which is captured in their variance  
        var orderedPlayerSkills = inferredSkills  
           .Select((s, i) => new { Player = i, Skill = s })  
           .OrderByDescending(ps => ps.Skill.GetMean());  

        foreach (var playerSkill in orderedPlayerSkills)  
        {  
            Console.WriteLine($"Player {playerSkill.Player} skill: {playerSkill.Skill}");  
        }  
    }  
   The result of these games is only win or lose, there is no draw, official example“ https://github.com/dotnet/infer/blob/master/src/Tutorials/ChessAnalysis.cs ”I can't understand. How to use a draw game Infet.net Ranking players
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,714 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Tom Minka 86 Reputation points
    2020-06-30T10:00:57.257+00:00

    Answered on github

    1 person found this answer helpful.
    0 comments No comments