Sunday, January 22, 2006

The Gnostic Knowledge of Fantasy Football and a suggested attack using genetic algorithms

The only way for me to have interest in the end of the football season is to involve myself in a playoff fantasy football pool. It combines some of the excitement of picking your own team from fantasy football, but doesn't last 17 weeks and only involves picking the team once at the beginning of the playoffs, so it is doable. My twin sister put together a very nice spreadsheet with the list of positions that the fantasy team "owner" must fill in. Each entry had a easy to use drop down menu for each player, but for the completely clueless like me it was difficult because I don't have every players team memorized and so I had to hunt for some more resources.

It is this gnostic wisdom, or hidden knowledge (gnosis) that frustrates newbies everywhere. Economists and sociologists call it a barrier to entry. What kind of club would you have if everyone could join it. Let's set up a secret handshake, or use incomprehensible jargon to keep out people who we don't want to join. The free masons have 33 degrees for goodness sake. In scattering experiments the scattering vector is called q, h, s or any number of different symbols just so the physicists, engineers, colloid scientists, and chemists don't have to talk to each other. Woe to the student trying to read papers in the different disciplines. Lawyers have to take the bar to practice, engineers a professional engineering exam. It is all about exclusion.

The funny thing is it always seems to the uninitiated that there is this hidden knowledge about how to actually be successful at fantasy football. It may also be that you have to be slightly interested. I think that football is a complicated game, that is what makes it so interesting to those that like it. The game is essentially a series of set piece battles, down after down, drive after drive. What I did to prepare myself for the playoffs was to get some good advice from coworkers and my sister and then go to my favorite resources, the NFL Sagarin Ratings, to try to predict who would win the games each week and my sister helped me with some info from to learn something about the players. What I most wanted to do was explore all of the combinations to find the best fantasy football playoff lineup to try to actually win the contest.

Genetic Algorithm Approach:

I think one cool way to generate the winning lineup would be to use a genetic algorithm to "breed" the best lineup (look here for a tutorial on genetic algorithms). The whole idea behind a genetic algorithm is that we will evolve an optimized playoff fantasy football lineup. Out of the many combinations we generate some combinations, subject them to a Darwinian fitness test, keep the winners, breed the winners and start the process over again. After a few generations I would have the winning, most fit, playoff fantasy football lineup.

The combinations:

One approach would be to just randomly generate lineups from the lookup table of players. It turns out there are over 55 trillion possible combinations in the rkbfanstasyfootball playoff setup. We would need to be sure that we included enough combinations to randomly hit upon lineups that would eventually evolve to be winners. Another approach could be to use some rules to generate lineups. Perhaps there could be a "follow a single team" rule, or a "load up on wild card" players rule, or a "spread your players across the teams" rule. All would be valid selections, but they would have to face the fitness gauntlet later on in the process, which we hope would generate winners for use after enough generations of breeding and culling.

The fitness test:

This particular fantasy playoff pool uses points scored (see here for the rules). We need to simulate the playoff season and calculate the final score for the hundreds of lineups. It would be great if we could play millions of games of Madden 2006 to simulate the playoff weeks of the season, add up the scores and compile individual player statistics, but I don't have the time or ability to do that. Some other suggestions I have are to use the seasonal averages for each player and use the Sagarin ratings or other ratings to simulate the wins and losses. One could also run a Monte Carlo simulation using the win/loss ratios of the teams over the past few seasons combined with the individual player stats. Each of these approaches will be better or worse predictors. The better we can do with this, the better our evolved playoff picks will be.

We can pick a fraction of the top of the population, preserve the best one (elitism) so we don't lose it, and cull the rest.

The breeding step:

Breed the resulting strains together. I suggest we take each position and have a 50/50 chance that the resultant offspring will have a player from one parent or another. Be sure to use players only once. We should also try to perform all of the combinations that we can. Some genetic algorithms include the possibility of a mutation. Perhaps we should allow that every so often a position comes from random from the starting list rather than from either parent. We can adjust this rate as appropriate.

These offspring go back into the fitness test for more testing and then culling. We will know to stop the evolution of the playoff fantasy lineups when we see the system settle down to an equilibrium with what I would hope would be a single high scoring lineup.

Results Pending:
My main problem with these clever ideas I come up with is that I am so far out of grad school that I have run out of programmable computers to do that actual work. The last computer language I knew was Fortran, because it was the mid-90's and I was an engineer. I don't even have a compiler and computer to run it on anyway. I have gotten adept at using Microsoft Excell to run Monte Carlo simulations, but the process still remains too manual, with me cutting and pasting my results to other sheets and letting the program chug through the random number generator again. I will probably simulate the season using the scores thus far just to test the concept. Maybe next year I will have found a fitness test I can use and test this proposal in real use.

I will have to satisfy myself with setting up the problem for now, and save looking for execution resources for later. Please offer useful comments on the scheme outlined above, or even point me to places where I could actually get it done.


Bex said...

Hey Rich,

I didn't think it was possible to actually make Fantasy Football look like homework! Way to go, Bro.

Love ya, Bex (his twin sister)

P.S. For the best fantasy football around, check out RKB Fantasy Football...the best damn league around!

Sony Ericsson Takes Over Title said...
This comment has been removed by a blog administrator.
Jon said...

I evolved my fantasy premier league (soccer) team for the '07/'08 season using a GA. Its past a third of the way through the season and I am current top of the three leagues I am in and 8,344th of over one and a half million teams. I have made no transfers during the season and based my fitness function only on last years data. The impetus for doing this was to see if the optimum team of last year (no tranfers) included Cristiano Ronaldo who easily topped the points per player ranking with over 250. Anyway, the best team didn't need Ronaldo to win. Shadwell Army!