Reference no: EM133095185
Project
The Problem
Inspired by Jonah Hill's character in the movie Moneyball, you have decided to take up sports analytics as your retirement activity, following a successful career selling widgets in the mall on Namek. Eight players are competing to become the Go Fish Champion of Namek. Figure 1 shows the draw for a single-elimination tournament that will decide the champion. Single-elimination means the loser of each matchup exits the tournament.
Your task in this project is to predict the most likely winner of the entire tournament. You will make use of Arpad Elo's rating scheme. This system is also how international chess ratings are derived and form the basis of a lot of sports prediction models, like those used by FiveThirtyEight) to pick the likely winner. Here are some major assumptions involved.
- Each player is assumed to have a certain skill level (given by a number often denoted by s). This quantity is unknown and cannot be directly measured. Below, we will learn to infer this value from historical Go Fish match data.
- We assume that a player's skill level does not change over time.
- When two players A and B with skill levels sa and sb, respectively, compete, the probability of player A winning is impacted by the difference in skill levels defined as δ = (sa sb)/c. The value c in the expression is a scale parameter: it describes how sensitive the win-loss probability is to the difference in skill levels. For our purposes, we'll select c = 100 for this entire assignment. A formula which expresses the probability that player A wins is given below:
P(A wins) = eδ/1+ eδ
- Every match played has exactly one winner; the outcome can never be a tie.
Task 1: YOU will first obtain an estimate of each player's skill level by writing a FUNCTION named calculate_ratings, which takes as INPUT a "past matches" filename that indicates a file in the format of past_matches.csv file described above.
Task 2: Next, write a short FUNCTION named display_ratings which takes as INPUT a dictionary containing 8 entries where keys are the player names and the VALUES are the ratings for the players (i.e., it takes as INPUT the dictionary yOUR calculate_ratings FUNCTION RETURNS). It SHOULD both generate to the console and save to a file named projections.pdf a bar graph displaying the
ratings of each player.
Task 3: Next, write a FUNCTION named project_win_probs that will repeat- edly SIMULATe the completed TOURNAMENT based on the bracket shown in Fig- URE 1.
Task 4: Next, write a short FUNCTION named display_probs that takes as INPUT a dictionary of the style OUTPUT by yOUR project_win_probs FUNCTION, and generates two OUTPUT files. The FUNCTION does not RETURN a VALUE, BUT it will also display a plot on the screen.
Attachment:- Projects.rar