Purpose

The goal of this notebook is to do some analysis and forecasting as a tool to plan for an upcoming fantasy baseball draft. Data will be pulled from ESPN regarding player statistics and teams in the fantasy league. I will come up with features for prediction from my experience with previous fantasy league drafts.

Data Gathering

Some data has been prepared through the data/update.py script outside of the function of this notebook. We will pull this data in to get us started.

Proposed features for weights and biases

Many factors go into the decision making of a fantasy draft, and they are dynamically different as a draft progresses. As the baseline of this exercise, we will use the following weights for decision features in our algorithm.

Draft Rank = 45%
Projected Season Points = 15%
Positions needing to be filled on the team = 35%
Position Value = 5%

We will now start to build out mechanics for measuring these features.

Position analysis

For each position that will be used in our league, we are going to evaluate the strength and value of players in those positions. The positions our league uses is: Catcher, 1B, 2B, 3B, SS, 3 OF, DH, 4 Utility, and 9 Pitchers SP are limited to 8 starts per week, so it is best to plan to have 6 SP and 3 RP

We are going to aggregate the following statistics:

Evaluate Players:

We are going to weight the following features for individual players:

Determine Position Needs

Formula for calculating position needs: $$ \int \frac{StartersNeeded - \frac{1}{PlayersEligiblePositions}}{RosterSize -(PickNumber - 1)} $$

The purpose of using this formula is to encourage drafting a player whose fielding position is still needed to be filled on the roster. Additionally, players that have flexible position eligibility should not diminish the weight of a position as strongly as a player who can only fill one specific position.

We will create a function that both calculates this formula and update the weight of a drafters positional needs after every pick.

Picking Algorithm

Picks will use our previously defined weights and available draft data to make a decision on who to pick. These considerations will include:

  1. Consider who is at the top of the draft board
  2. Apply statistical normalization of scores to ellicit a more balanced decision
  3. Evaluate the positional needs of the drafter

A weighted overall score will be assigned to each player available on the draft board using our considerations and weights to determine which player delivers the most value for our drafter.

Run the prediction program

Now that we've built all the pieces of how our program will decide on draft picks, we create a loop to simulate each pick of the draft. As each pick is made, new scores are calculated in the same way individuals re-evaluate the draft table in a real life draft.

The program will iterate through all 324 picks in the draft

Wrapup

At this point we have built a pretty robust prediction algorithm. There are some improvement opportunities such as:

I'm happy with the result this far and will consider enhancing to use in future Fantasy Drafts.