public NFLResult PredictGame( NFLGame game, IStorePredictions persistor, DateTime predictionDate ) { if ( persistor == null ) StorePrediction = false; var homePower = game.HomeNflTeam.GetPowerRating( game.Week ); var awayPower = game.AwayNflTeam.GetPowerRating( game.Week ); //Utility.Announce( string.Format( "PredictGame: Home Power {0} v Away Power {1}", // homePower, awayPower ) ); // Add 2.5 to the Home teams power rating homePower += 2.5M; // Compare Power Rating to get the line var line = homePower - awayPower; // Estrapolate the score from the line using 21 point average var homeScore = 21.0M; var awayScore = 21.0M ; if ( line > 0 ) homeScore += line; if ( line < 0 ) awayScore -= line; var intHomeScore = Int32.Parse( Math.Round( homeScore, 0 ).ToString() ) ; var intAwayScore = Int32.Parse( Math.Round( awayScore, 0 ).ToString() ); var res = new NFLResult( game.HomeTeam, intHomeScore, game.AwayTeam, intAwayScore ); if ( StorePrediction ) StorePredictedResult( game, res ); //Utility.Announce( string.Format( "PredictGame: Result predicted - {0}", res.LogResult() ) ); return res; }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { const int avgScore = 21; var homeRating = RatingsService.GetNibbleRatingFor( game.HomeNflTeam, predictionDate ); var awayRating = RatingsService.GetNibbleRatingFor( game.AwayNflTeam, predictionDate ); var homeOff = homeRating.Offence; var homeDef = homeRating.Defence; var awayOff = awayRating.Offence; var awayDef = awayRating.Defence; var homeScore = avgScore + ((homeOff + awayDef) / 2) + 3; // 3pts home field advantage var awayScore = avgScore + ((awayOff + homeDef) / 2); homeScore = Utility.PickAScore(homeScore); awayScore = Utility.PickAScore(awayScore); if (homeScore == awayScore) homeScore++; // no ties var res = new NFLResult( game.HomeTeam, homeScore, game.AwayTeam, awayScore ); //TODO: Nibble predictor does not predict Tdp or Tdr if (AuditTrail) { AuditPrediction(game, awayDef, awayOff, homeOff, res, homeDef); if ( StorePrediction ) StorePredictedResult( game, res ); } return res; }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if (game.HomeNflTeam == null) game.HomeNflTeam = Masters.Tm.GetTeam(game.Season + game.HomeTeam); if (game.AwayNflTeam == null) game.AwayNflTeam = Masters.Tm.GetTeam(game.Season + game.AwayTeam); game.HomeNflTeam.LetterRating = Masters.Sm.GetGordan(game.Season, game.Season + game.HomeTeam); game.AwayNflTeam.LetterRating = Masters.Sm.GetGordan(game.Season, game.Season + game.AwayTeam); var weekIndex = Int32.Parse(game.Week) - 1; var homeLetter = game.HomeNflTeam.LetterRating[weekIndex].Trim(); var awayLetter = game.AwayNflTeam.LetterRating[weekIndex].Trim(); // home team var ratingGap = DanGordan.RatingGap(homeLetter, awayLetter); // home teams get 2.5 points home field advantage ratingGap += 2.5M; // // I give 3/4 strength to the letter power rating because it is adjusted every week and // better takes into account a team's current form. The number power ratings though more // objective, are totally dependant on Scores, which at times can be deceptive. var homeNumberAvgRating = ( game.HomeNflTeam.NumberRating[ 0 ] + game.HomeNflTeam.NumberRating[ weekIndex ] ) / 2.0M; var awayNumberAvgRating = ( game.AwayNflTeam.NumberRating[ 0 ] + game.AwayNflTeam.NumberRating[ weekIndex ] ) / 2.0M; // home advantage homeNumberAvgRating += 2.5M; var numberRating = ( homeNumberAvgRating - awayNumberAvgRating ); // if the rating gap is positive its a home win game.GordanLine = RoundToNearestHalfPoint((0.75M * ratingGap) + (0.25M * numberRating)); var homeScore = 21 + Convert.ToInt32((ratingGap / 2)); var awayScore = 21 + Convert.ToInt32((ratingGap * -1) / 2); return new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { var res = game.Played() ? new NFLResult(game.HomeTeam, game.HomeScore, game.AwayTeam, game.AwayScore) : new NFLResult(game.HomeTeam, 21, game.AwayTeam, 17); return(res); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { var res = game.Played() ? new NFLResult( game.HomeTeam, game.HomeScore, game.AwayTeam, game.AwayScore ) : new NFLResult( game.HomeTeam, 21, game.AwayTeam, 17 ); return res; }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if ( game.HomeNflTeam == null ) game.HomeNflTeam = Masters.Tm.GetTeam( game.Season + game.HomeTeam ); if ( game.AwayNflTeam == null ) game.AwayNflTeam = Masters.Tm.GetTeam( game.Season + game.AwayTeam ); var homeLetter = game.HomeNflTeam.LetterRating[ 0 ].Trim(); var awayLetter = game.AwayNflTeam.LetterRating[ 0 ].Trim(); // home team var ratingGap = DanGordan.RatingGap( homeLetter, awayLetter ); // home teams get 2.5 points home field advantage ratingGap += 2.5M; // if the rating gap is positive its a home win game.GordanLine = ratingGap; var decimalEquivalent = DanGordan.CalculateSpreadsAsDecimals( ratingGap ); if ( ratingGap > 0 ) { // home win game.HomeDecEquivalent = decimalEquivalent; // .5 pt win = .507 to home game.AwayDecEquivalent = 1.0M - decimalEquivalent; // .493 to away } else { // away win game.AwayDecEquivalent = decimalEquivalent; // .5 pt win = .507 to away game.HomeDecEquivalent = 1.0M - decimalEquivalent; // .493 to home } var homeScore = 21 + Convert.ToInt32( ( ratingGap/2 ) ); var awayScore = 21 + Convert.ToInt32( ( ratingGap*-1 )/2 ); return new NFLResult( game.HomeTeam, homeScore, game.AwayTeam, awayScore ); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { var result = new NFLResult { AwayTeam = game.AwayTeam, HomeTeam = game.HomeTeam }; var homeTeam = game.HomeNflTeam; var awayTeam = game.AwayNflTeam; var nHomeOff = Utility.OffRating(homeTeam, predictionDate); var nAwayOff = Utility.OffRating(awayTeam, predictionDate); var nHomeDef = Utility.DefRating(homeTeam, predictionDate); var nAwayDef = Utility.DefRating(awayTeam, predictionDate); result.HomeScore = (nHomeOff + nAwayDef) - 20; result.AwayScore = (nAwayOff + nHomeDef) - 20; persistor.StorePrediction("Miller", game, result); if (AuditTrail) { Utility.Announce(string.Format("{0}-{1}:{2}", game.GameCodeOut(), game.GameCode, result.LogResult())); } return(result); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { NFLResult res; //RosterLib.Utility.Announce( string.Format( "WizPredictor.PredictGame: Wk{2} {0}@{1}", // game.AwayTeam, game.HomeTeam, game.Week ) ); if (game.Played()) { res = new NFLResult(game.HomeTeam, game.HomeScore, game.AwayTeam, game.AwayScore); } else { if (game.HomeNflTeam == null) { game.HomeNflTeam = Masters.Tm.GetTeam(game.Season, game.HomeTeam); } if (game.AwayNflTeam == null) { game.AwayNflTeam = Masters.Tm.GetTeam(game.Season, game.AwayTeam); } var homeMatrix = game.HomeNflTeam.GetMatrix(); var awayMatrix = game.AwayNflTeam.GetMatrix(); // Homescore = Tdp*7 + Tdr*7 + 3 var homePointsPassing = Tdp(homeMatrix.PoPoints - awayMatrix.PdPoints); var homePointsRunning = Tdr(homeMatrix.RoPoints - awayMatrix.RdPoints); var homeScore = homePointsPassing + homePointsRunning + 3; // Awayscore = Tdp*7 + Tdr*7 var awayPointsPassing = Tdp(awayMatrix.PoPoints - homeMatrix.PdPoints); var awayPointsRunning = Tdr(awayMatrix.RoPoints - homeMatrix.RdPoints); var awayScore = awayPointsPassing + awayPointsRunning; if (homeScore == awayScore) { homeScore++; // no ties } res = new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore) { AwayTDp = (awayPointsPassing / 7), HomeTDp = (homePointsPassing / 7), AwayTDr = (awayPointsRunning / 7), HomeTDr = (homePointsRunning / 7) }; if (AuditTrail) { Utility.Announce(string.Format("Wiz Prediction Wk{4} {0}@{1} {2}-{3} ", game.AwayTeam, game.HomeTeam, res.AwayScore, res.HomeScore, game.Week)); Utility.Announce(string.Format(" hTDr({0}) hTDp({1}) aTDr({2}) aTDp({3})", res.HomeTDr, res.HomeTDp, res.AwayTDr, res.AwayTDp)); Utility.Announce(string.Format(" hPOpts({0:#.#}) hROpts({1:#.#}) aRDpts({2:#.#}) aPDpts({3:#.#})", homeMatrix.PoPoints, homeMatrix.RoPoints, awayMatrix.RdPoints, awayMatrix.PdPoints)); Utility.Announce(string.Format(" aPOpts({0:#.#}) aROpts({1:#.#}) hRDpts({2:#.#}) hPDpts({3:#.#})", awayMatrix.PoPoints, awayMatrix.RoPoints, homeMatrix.RdPoints, homeMatrix.PdPoints)); } } return(res); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { NFLResult res; //RosterLib.Utility.Announce( string.Format( "WizPredictor.PredictGame: Wk{2} {0}@{1}", // game.AwayTeam, game.HomeTeam, game.Week ) ); if ( game.Played() ) res = new NFLResult( game.HomeTeam, game.HomeScore, game.AwayTeam, game.AwayScore ); else { if ( game.HomeNflTeam == null ) game.HomeNflTeam = Masters.Tm.GetTeam( game.Season, game.HomeTeam ); if ( game.AwayNflTeam == null ) game.AwayNflTeam = Masters.Tm.GetTeam( game.Season, game.AwayTeam ); var homeMatrix = game.HomeNflTeam.GetMatrix(); var awayMatrix = game.AwayNflTeam.GetMatrix(); // Homescore = Tdp*7 + Tdr*7 + 3 var homePointsPassing = Tdp( homeMatrix.PoPoints - awayMatrix.PdPoints ); var homePointsRunning = Tdr( homeMatrix.RoPoints - awayMatrix.RdPoints ); var homeScore = homePointsPassing + homePointsRunning + 3; // Awayscore = Tdp*7 + Tdr*7 var awayPointsPassing = Tdp( awayMatrix.PoPoints - homeMatrix.PdPoints ); var awayPointsRunning = Tdr( awayMatrix.RoPoints - homeMatrix.RdPoints ); var awayScore = awayPointsPassing + awayPointsRunning; if ( homeScore == awayScore ) homeScore++; // no ties res = new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore) { AwayTDp = (awayPointsPassing/7), HomeTDp = (homePointsPassing/7), AwayTDr = (awayPointsRunning/7), HomeTDr = (homePointsRunning/7) }; if ( AuditTrail ) { Utility.Announce( string.Format( "Wiz Prediction Wk{4} {0}@{1} {2}-{3} ", game.AwayTeam, game.HomeTeam, res.AwayScore, res.HomeScore, game.Week ) ); Utility.Announce( string.Format( " hTDr({0}) hTDp({1}) aTDr({2}) aTDp({3})", res.HomeTDr, res.HomeTDp, res.AwayTDr, res.AwayTDp )); Utility.Announce( string.Format( " hPOpts({0:#.#}) hROpts({1:#.#}) aRDpts({2:#.#}) aPDpts({3:#.#})", homeMatrix.PoPoints, homeMatrix.RoPoints, awayMatrix.RdPoints, awayMatrix.PdPoints )); Utility.Announce( string.Format( " aPOpts({0:#.#}) aROpts({1:#.#}) hRDpts({2:#.#}) hPDpts({3:#.#})", awayMatrix.PoPoints, awayMatrix.RoPoints, homeMatrix.RdPoints, homeMatrix.PdPoints )); } } return res; }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if (persistor == null) { StorePrediction = false; } var homePower = game.HomeNflTeam.GetPowerRating(game.Week); var awayPower = game.AwayNflTeam.GetPowerRating(game.Week); //Utility.Announce( string.Format( "PredictGame: Home Power {0} v Away Power {1}", // homePower, awayPower ) ); // Add 2.5 to the Home teams power rating homePower += 2.5M; // Compare Power Rating to get the line var line = homePower - awayPower; // Estrapolate the score from the line using 21 point average var homeScore = 21.0M; var awayScore = 21.0M; if (line > 0) { homeScore += line; } if (line < 0) { awayScore -= line; } var intHomeScore = Int32.Parse(Math.Round(homeScore, 0).ToString()); var intAwayScore = Int32.Parse(Math.Round(awayScore, 0).ToString()); var res = new NFLResult(game.HomeTeam, intHomeScore, game.AwayTeam, intAwayScore); if (StorePrediction) { StorePredictedResult(game, res); } //Utility.Announce( string.Format( "PredictGame: Result predicted - {0}", res.LogResult() ) ); return(res); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if (game.HomeNflTeam == null) { game.HomeNflTeam = Masters.Tm.GetTeam(game.Season + game.HomeTeam); } if (game.AwayNflTeam == null) { game.AwayNflTeam = Masters.Tm.GetTeam(game.Season + game.AwayTeam); } game.HomeNflTeam.LetterRating = Masters.Sm.GetGordan(game.Season, game.Season + game.HomeTeam); game.AwayNflTeam.LetterRating = Masters.Sm.GetGordan(game.Season, game.Season + game.AwayTeam); var weekIndex = Int32.Parse(game.Week) - 1; var homeLetter = game.HomeNflTeam.LetterRating[weekIndex].Trim(); var awayLetter = game.AwayNflTeam.LetterRating[weekIndex].Trim(); // home team var ratingGap = DanGordan.RatingGap(homeLetter, awayLetter); // home teams get 2.5 points home field advantage ratingGap += 2.5M; // // I give 3/4 strength to the letter power rating because it is adjusted every week and // better takes into account a team's current form. The number power ratings though more // objective, are totally dependant on Scores, which at times can be deceptive. var homeNumberAvgRating = (game.HomeNflTeam.NumberRating[0] + game.HomeNflTeam.NumberRating[weekIndex]) / 2.0M; var awayNumberAvgRating = (game.AwayNflTeam.NumberRating[0] + game.AwayNflTeam.NumberRating[weekIndex]) / 2.0M; // home advantage homeNumberAvgRating += 2.5M; var numberRating = (homeNumberAvgRating - awayNumberAvgRating); // if the rating gap is positive its a home win game.GordanLine = RoundToNearestHalfPoint((0.75M * ratingGap) + (0.25M * numberRating)); var homeScore = 21 + Convert.ToInt32((ratingGap / 2)); var awayScore = 21 + Convert.ToInt32((ratingGap * -1) / 2); return(new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore)); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if (game.HomeNflTeam == null) { game.HomeNflTeam = Masters.Tm.GetTeam(game.Season + game.HomeTeam); } if (game.AwayNflTeam == null) { game.AwayNflTeam = Masters.Tm.GetTeam(game.Season + game.AwayTeam); } var homeLetter = game.HomeNflTeam.LetterRating[0].Trim(); var awayLetter = game.AwayNflTeam.LetterRating[0].Trim(); // home team var ratingGap = DanGordan.RatingGap(homeLetter, awayLetter); // home teams get 2.5 points home field advantage ratingGap += 2.5M; // if the rating gap is positive its a home win game.GordanLine = ratingGap; var decimalEquivalent = DanGordan.CalculateSpreadsAsDecimals(ratingGap); if (ratingGap > 0) { // home win game.HomeDecEquivalent = decimalEquivalent; // .5 pt win = .507 to home game.AwayDecEquivalent = 1.0M - decimalEquivalent; // .493 to away } else { // away win game.AwayDecEquivalent = decimalEquivalent; // .5 pt win = .507 to away game.HomeDecEquivalent = 1.0M - decimalEquivalent; // .493 to home } var homeScore = 21 + Convert.ToInt32((ratingGap / 2)); var awayScore = 21 + Convert.ToInt32((ratingGap * -1) / 2); return(new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore)); }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { var result = new NFLResult {AwayTeam = game.AwayTeam, HomeTeam = game.HomeTeam}; var homeTeam = game.HomeNflTeam; var awayTeam = game.AwayNflTeam; var nHomeOff = Utility.OffRating(homeTeam, predictionDate); var nAwayOff = Utility.OffRating(awayTeam, predictionDate); var nHomeDef = Utility.DefRating(homeTeam, predictionDate); var nAwayDef = Utility.DefRating(awayTeam, predictionDate); result.HomeScore = (nHomeOff + nAwayDef) - 20; result.AwayScore = (nAwayOff + nHomeDef) - 20; persistor.StorePrediction("Miller", game, result); if (AuditTrail) Utility.Announce(string.Format("{0}-{1}:{2}", game.GameCodeOut(), game.GameCode, result.LogResult())); return result; }
public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate) { const int avgScore = 21; var homeRating = RatingsService.GetNibbleRatingFor(game.HomeNflTeam, predictionDate); var awayRating = RatingsService.GetNibbleRatingFor(game.AwayNflTeam, predictionDate); var homeOff = homeRating.Offence; var homeDef = homeRating.Defence; var awayOff = awayRating.Offence; var awayDef = awayRating.Defence; var homeScore = avgScore + ((homeOff + awayDef) / 2) + 3; // 3pts home field advantage var awayScore = avgScore + ((awayOff + homeDef) / 2); homeScore = Utility.PickAScore(homeScore); awayScore = Utility.PickAScore(awayScore); if (homeScore == awayScore) { homeScore++; // no ties } var res = new NFLResult(game.HomeTeam, homeScore, game.AwayTeam, awayScore); //TODO: Nibble predictor does not predict Tdp or Tdr if (AuditTrail) { AuditPrediction(game, awayDef, awayOff, homeOff, res, homeDef); if (StorePrediction) { StorePredictedResult(game, res); } } return(res); }
public SpreadPredictionGenerator(string season, IStorePredictions predictionStorer) { Season = new NflSeason(season); _predictionStorer = predictionStorer; }
public NFLResult PredictGame( NFLGame game, IStorePredictions persistor, DateTime predictionDate) { if (TakeActuals && game.Played()) { return(game.Result); } const int homeRating = 0; const int awayRating = 0; if (game.HomeNflTeam == null) { game.HomeNflTeam = Masters.Tm.GetTeam( game.Season + game.HomeTeam); } if (game.AwayNflTeam == null) { game.AwayNflTeam = Masters.Tm.GetTeam( game.Season + game.AwayTeam); } var homeMetrics = CalculateGameMetrics( isHome: true, game: game, focusDate: predictionDate); var awayMetrics = CalculateGameMetrics( isHome: false, game: game, focusDate: predictionDate); var homeScore = homeMetrics.Score; var awayScore = awayMetrics.Score; if (homeScore == awayScore) { homeScore++; // no ties } game.Result = new NFLResult( game.HomeTeam, homeScore, game.AwayTeam, awayScore) { HomeTDp = _homeTDp, HomeTDr = _homeTDr, HomeFg = _homeFg, HomeTDd = _homeTDd, HomeTDs = _homeTDs, HomeYDp = homeMetrics.YDp, HomeYDr = homeMetrics.YDr, AwayTDr = _awayTDr, AwayTDp = _awayTDp, AwayTDs = awayMetrics.TDs, AwayTDd = awayMetrics.TDd, AwayYDp = awayMetrics.YDp, AwayYDr = awayMetrics.YDr, AwayFg = _awayFg }; if (AuditTrail) { AuditIt(game, game.Result, homeRating, awayRating); } if (StorePrediction) { StorePredictedResult( game, game.Result); } // pulled this out to its own job "GameProjectionReportsJob" //if ( WriteProjection ) // game.WriteProjection(); return(game.Result); }
public SpreadTips(IStorePredictions storer) { Storer = storer; }
public SpreadTips( IStorePredictions storer ) { Storer = storer; }
public NFLResult PredictGame( NFLGame game, IStorePredictions persistor, DateTime predictionDate ) { if ( TakeActuals ) if ( game.Played() ) return game.Result; const int homeRating = 0; const int awayRating = 0; if (game.HomeNflTeam == null) game.HomeNflTeam = Masters.Tm.GetTeam( game.Season + game.HomeTeam ); if (game.AwayNflTeam == null) game.AwayNflTeam = Masters.Tm.GetTeam( game.Season + game.AwayTeam ); var homeMetrics = CalculateGameMetrics( true, game, predictionDate ); var awayMetrics = CalculateGameMetrics( false, game, predictionDate ); var homeScore = homeMetrics.Score; var awayScore = awayMetrics.Score; if (homeScore == awayScore) homeScore++; // no ties game.Result = new NFLResult( game.HomeTeam, homeScore, game.AwayTeam, awayScore ) { HomeTDp = _homeTDp, HomeTDr = _homeTDr, HomeFg = _homeFg, HomeTDd = _homeTDd, HomeTDs = _homeTDs, HomeYDp = homeMetrics.YDp, HomeYDr = homeMetrics.YDr, AwayTDr = _awayTDr, AwayTDp = _awayTDp, AwayTDs = awayMetrics.TDs, AwayTDd = awayMetrics.TDd, AwayYDp = awayMetrics.YDp, AwayYDr = awayMetrics.YDr, AwayFg = _awayFg }; if ( AuditTrail ) AuditIt( game, game.Result, homeRating, awayRating ); if ( StorePrediction ) StorePredictedResult( game, game.Result ); // pulled this out to its own job "GameProjectionReportsJob" //if ( WriteProjection ) // game.WriteProjection(); return game.Result; }