Example #1
0
        private static void TestGoalDifferencePrediction()
        {
            var game = new GoalDifference.ModelInput()
            {
                Team1GoalKeeper = "Philipp",
                Team1Striker    = "Michael",
                Team2GoalKeeper = "Roman",
                Team2Striker    = "Markus",
                Weekday         = "Monday",
                Hour            = 12
            };

            GoalDifference.ModelOutput predictionResult = GoalDifference.ConsumeModel.Predict(game);

            Console.WriteLine("========== Goal Difference Prediction ==========");
            Console.WriteLine($"{game.Team1GoalKeeper} + {game.Team1Striker} vs. {game.Team2GoalKeeper} + {game.Team2Striker}");
            Console.WriteLine($"Model Result: {predictionResult.Score}");

            int roundedDifference = (int)Math.Round(predictionResult.Score);
            int goalsTeam1;
            int goalsTeam2;

            if (predictionResult.Score > 0)
            {
                // Team 1 wins
                goalsTeam1 = 5;
                goalsTeam2 = 5 - roundedDifference;
            }
            else
            {
                // Team 2 wins
                goalsTeam1 = 5 + roundedDifference;
                goalsTeam2 = 5;
            }

            Console.WriteLine($"Expected Goals: {goalsTeam1} : {goalsTeam2}");
        }