Exemple #1
0
        private void PredictEvent(IncomingEvent incomingEvent)
        {
            try
            {
                TeamData homeTeam = null;
                TeamData awayTeam = null;

                Prediction prediction = this.CreatePrediction(incomingEvent);

                int maxScore = SettingsReader.GetInstance().ReadMaxScore(incomingEvent.SportType);

                foreach (TeamInfo teamInfo in incomingEvent.TeamsInfo)
                {
                    if (teamInfo.IsHomeGame)
                    {
                        homeTeam = new TeamData(teamInfo.TeamEvents, true);
                    }
                    else
                    {
                        awayTeam = new TeamData(teamInfo.TeamEvents, false);
                    }
                }

                Predictor predictor = new Predictor(homeTeam, awayTeam, maxScore);
                predictor.CalcProbabilities();

                prediction.HomeWinProbability = predictor.HomeWinProbability;
                prediction.DrawProbability    = predictor.DrawProbability;
                prediction.AwayWinProbability = predictor.AwayWinProbability;

                this.AddNewPrediction(prediction);
            }
            catch (Exception ex)
            {
                Log.Error("Exception while trying to PredictEvent", ex);
            }
        }