Skip to content

Commit b12094a

Browse files
author
Devin Smith
committed
Added the number of seasons where your forecasts are better, worse, or tied with the elo forecasts
1 parent 1487ba8 commit b12094a

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

util.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,35 @@ def evaluate_forecasts(games):
5858
my_points *= 2
5959
my_points_by_season[game['season']] += my_points
6060

61+
62+
my_better_forecast_count = 0
63+
my_worse_forecast_count = 0
64+
my_tie_forecast_count = 0
6165
# Print individual seasons
6266
for season in my_points_by_season:
63-
print("In %s, your forecasts would have gotten %s points. Elo got %s points." % (season, round(my_points_by_season[season], 2), round(elo_points_by_season[season], 2)))
67+
my_points_for_season = round(my_points_by_season[season], 2)
68+
elo_points_for_season = round(elo_points_by_season[season], 2)
69+
70+
if my_points_for_season > elo_points_for_season:
71+
my_better_forecast_count += 1
72+
elif my_points_for_season < elo_points_for_season:
73+
my_worse_forecast_count += 1
74+
else:
75+
my_tie_forecast_count += 1
76+
77+
print("In %s, your forecasts would have gotten %s points. Elo got %s points." % (season, my_points_for_season, elo_points_for_season))
6478

6579
# Show overall performance
6680
my_avg = sum(my_points_by_season.values())/len(my_points_by_season.values())
6781
elo_avg = sum(elo_points_by_season.values())/len(elo_points_by_season.values())
82+
6883
print("\nOn average, your forecasts would have gotten %s points per season. Elo got %s points per season.\n" % (round(my_avg, 2), round(elo_avg, 2)))
6984

85+
print("Your forecasts are better than elo for %s seasons" % (my_better_forecast_count))
86+
print("Your forecasts are worse than elo for %s seasons" % (my_worse_forecast_count))
87+
if my_tie_forecast_count != 0:
88+
print("Your forecasts are the same as elo for %s seasons" % (my_tie_forecast_count))
89+
7090
# Print forecasts for upcoming games
7191
if len(upcoming_games) > 0:
7292
print("Forecasts for upcoming games:")

0 commit comments

Comments
 (0)