NFL Predictor Algorithm (Part 1)

By now you've seen enough rants and raves about the NFL from me. I had a bit of time off and decided to have a go at writing code to predict the outcome of games. I'm already in a pool for no money so I might as well give myself a legitimate edge. The first thing I thought of was Heal Points. The next thing I thought of was the old BCS computer scores for NCAA football. Both were designed to deal with comparing teams that never played each other. Then I made an abomination of the two. Somehow it's working halfway decently. Follow along if you want to copy it in your language of choice.

The first thing you're going to need is a list of who beat who this season up until the end of last week. For every team, add 100 points for every win and 50 points for every tie, then divide by the number of games played. A 7-3 record = 70 points, 6-3 = 66.666666 points, etc. These are basically your seed values.

Now the fun part begins. We're going to iteratively try to solve a set of 32 equations with 32 variables! I found that 1000 iterations is enough to make the numbers not vary beyond a thousandth of a point. Make a copy of whatever you're using to hold your seed values. Use them as inputs for each team equation and write the result out to the copy.

You may notice that the results of each equation are almost always lower than the inputs going in. We need to scale it, otherwise after 1000 iterations, we'll only get 0's back. After each equation is complete, get the lowest and highest values and scale them such that the lowest value is 0 and the highest value is 100. After that's done, overwrite the seed values with the resulting values, and you've finished one iteration. Repeat that 1000 times and your resulting values will look very different from your seed values.

After 11 weeks, the results are somewhat realistic but there are some real questions with others:

  1. Dallas Cowboys: 100.000
  2. Tampa Bay Buccaneers: 65.047
  3. Buffalo Bills: 57.619
  4. Pittsburgh Steelers: 51.906
  5. Los Angeles Chargers: 44.442
  6. Philadelphia Eagles: 38.058
  7. Arizona Cardinals: 36.277
  8. Minnesota Vikings: 36.014
  9. Tennessee Titans: 33.039
  10. Carolina Panthers: 31.511
  11. Kansas City Chiefs: 30.620
  12. Atlanta Falcons: 28.588
  13. New York Jets: 27.061
  14. Cincinnati Bengals: 25.914
  15. Denver Broncos: 17.888
  16. Indianapolis Colts: 17.351
  17. Cleveland Browns: 16.583
  18. New England Patriots: 16.335
  19. San Francisco 49ers: 16.188
  20. Green Bay Packers: 16.122
  21. Miami Dolphins: 15.780
  22. Houston Texans: 15.366
  23. Washington Football Team: 14.814
  24. Baltimore Ravens: 14.482
  25. Las Vegas Raiders: 12.445
  26. Los Angeles Rams: 11.393
  27. Jacksonville Jaguars: 11.278
  28. New Orleans Saints: 10.799
  29. Seattle Seahawks: 9.330
  30. New York Giants: 8.335
  31. Chicago Bears: 6.695
  32. Detroit Lions: 0.000

I tested this against every game this season (excluding the tie game) and while I wouldn't put any money on it, it's better than 50/50:

  1. Correct 102 games, incorrect 62 games (62.195% correct) across the season
  2. Correct 9 games, incorrect 7 games (56.250% correct) in week 1
  3. Correct 10 games, incorrect 6 games (62.500% correct) in week 2
  4. Correct 10 games, incorrect 6 games (62.500% correct) in week 3
  5. Correct 8 games, incorrect 8 games (50.000% correct) in week 4
  6. Correct 12 games, incorrect 4 games (75.000% correct) in week 5
  7. Correct 10 games, incorrect 4 games (71.429% correct) in week 6
  8. Correct 9 games, incorrect 4 games (69.231% correct) in week 7
  9. Correct 10 games, incorrect 5 games (66.667% correct) in week 8
  10. Correct 7 games, incorrect 7 games (50.000% correct) in week 9
  11. Correct 9 games, incorrect 4 games (69.231% correct) in week 10
  12. Correct 8 games, incorrect 7 games (53.333% correct) in week 11

I'll continue to hack away at it and see if I can't get the success rate higher. I think adding a recency bias will help some.

Day 77 of #100DaysToOffload