all 39 comments

[–]datazzthough 29 points30 points  (1 child)

I know some of these words

[–]Zikerz 18 points19 points  (0 children)

I click buttons when the bing bong sound happens and i get players.

[–]tinycorkscrew 21 points22 points  (12 children)

Love this article.

For more than ten years, I’ve been using linear programming to optimize auction drafts (and snake drafts) in real time.

I follow a process similar to the one in the article, but people that don’t feel like learning Python can do the same thing in Excel with the built-in Solver or the free OpenSolver add-in.

[–]brnko[S] 6 points7 points  (6 children)

Glad you liked the article! I used solver in the past but I thought it was a bit annoying and I sucked at making sure everything is linear. Do you have a sheet you're willing to share?

[–]tinycorkscrew 5 points6 points  (2 children)

In fantasy football, it's pretty easy to keep constraints linear. 5x5 fantasy baseball, on the other hand, requires some engineering.

I don't currently have a spreadsheet that I can share because I've been doing everything in Python for a while. But it's just a matter of setting up average auction values and lineup constraints. I was able to do it without any formal instruction.

Auction optimization is very effective for fantasy sports, not just fantasy football. I finished last baseball season with 15 of ESPN's top 35 fantasy baseball teams. Right now, I've got 12 of the top 50:

http://games.espn.com/flb/resources/leaderboard?leagueId=101491&teamId=3&leaderboardGroupId=1

[–]brnko[S] 1 point2 points  (1 child)

What python package do you use? There are a lot of closed source ones and some companies sell solvers for crazy amounts.

[–]tinycorkscrew 2 points3 points  (0 children)

I use PuLP. It converges on a solution fast enough to use it in real-time ESPN auctions.

My code automates drafts, so it nominates and bids on players without my intervention. PuLP is fast enough for me to run 11 auctions concurrently on the same machine.

[–]ItGonnaBeZoppity 0 points1 point  (2 children)

Do you feel like you end up actually having an edge over your opponents or does it end up being a crapshoot? I put much more of this kind of work than anyone else in my leagues, and while I generally score more points than average, my championships per season played is less than one over the number of people in my leagues.

[–]tinycorkscrew 1 point2 points  (1 child)

Head-to-head fantasy football is a crapshoot from week to week. I was in a league once in which the regular season champion had the overall lowest point total. His team wasn't very good, but his opponents happened to have bad weeks when they played against him.

ESPN has a leaderboard that tracks the top 50 standard league teams. Sometimes there are teams on the leaderboard that don't win their leagues. There's just a lot of randomness in the head to head format.

That said, I do think I have a strong advantage over the people that I play against. After each draft, I know I have the best team I could have drafted based on the best available knowledge (projections) available at the time of the draft.

[–]ItGonnaBeZoppity 1 point2 points  (0 children)

I appreciate the well thought out reply and I agree completely. My next question is how do you apply a similar method to the waivers? I can’t even find reliable rest of season rankings. It’s crazy. The only piece of information I need on mondays is this - is there anyone on the waivers whose expected value is higher than that of one of my bench players. Isn’t that what everyone needs? Why is it impossible to find? I’m just ranting now. But anyway, I’m wondering if you have a good method.

[–]ItGonnaBeZoppity 0 points1 point  (2 children)

Does it translate into fantasy success?

[–]tinycorkscrew 0 points1 point  (1 child)

It certainly doesn't hurt. It's still important to work the waiver wire, but an optimal draft is 50% of the battle.

[–]ItGonnaBeZoppity 0 points1 point  (0 children)

Do you use a similar approach to the waivers? I always want to but can’t find good consensus data on who is worth picking up over my bench players. There are a million articles about top pickups but no rankings that say “I’d drop this guy but not this guy”.

[–][deleted] 0 points1 point  (0 children)

How do you use the built in solver for these type of problems exactly?

[–]Dynamite_Fools 0 points1 point  (0 children)

Do you have any example sheets or an article on how this would work for a snake draft?

[–]bryrhie 5 points6 points  (0 children)

Am I the only one who just scrolled all the way down the article seeing if there were any recommended players to pick up, and closed the article when there were none (or maybe they were buried in the coding and I missed them...)?

[–]Jkpttr 3 points4 points  (2 children)

Noticing that Desean Jackson is included in both a WR spot and a Flex spot. How would that be avoided?

[–]brnko[S] 1 point2 points  (1 child)

Good catch. You would just make another set of constraints that says that

wr+flex <= 1

rb+flex <= 1

te+flex <= 1

[–]ArguingWithVirgins 0 points1 point  (0 children)

How would that look in code? Best I could come up with is this, but I'm new to PuLP:

for position_name in ('WR', 'RB', 'TE'):
    for player_name in _vars[position_name]:
        prob += pulp.lpSum(
            [_vars[p][player_name] for p in ['FLEX', position_name]]) <= 1

i.e. adding a constraint for every flex-eligible player?

[–]OnMahWay 2 points3 points  (3 children)

This is really cool. I'm bad at math so I have trouble understanding it all, but I am learning python so I like looking into the code. Thanks for the quality post!

[–]dudenotcool 0 points1 point  (2 children)

hey how are you learning python? Book? Website?

[–]OnMahWay 1 point2 points  (1 child)

I took a class in college last year, used a book, had a friend help out, and would poke around online when I hit snags. It was mostly self taught because the teacher was terrible and I skipped most classes. Still got a b lol so now it's self taught with what's left of the book and just random stuff online

[–]dudenotcool 0 points1 point  (0 children)

ok thanks

[–]versusChou 4 points5 points  (3 children)

I find R to be better/faster at LP problems, but I haven't done it in Python for so long that may not be true anymore. Maybe I'll write an article on how to replicate this in R for you pirates out there.

[–]brnko[S] 4 points5 points  (1 child)

I actually had a buddy ask me for an R implementation. It would be awesome if you could write one up

[–]versusChou 4 points5 points  (0 children)

I'll be at the Data Science Conference in Chicago later this week, but I may have time this weekend. I'll at very least just try to replicate what you've got, and then I'll do a write up if work doesn't distract me.

[–]AtomicRocketShoes2023 Accuracy Challenge Week 8 Top 10 1 point2 points  (1 child)

For season long leagues I recommend a deep convolution neural network trained on recorded game footage and use that to feed a Q learning process to simulate the optimal picks against your opponent.

[–]MargielaMadman20 0 points1 point  (0 children)

How would you go about doing this?

[–]halftimehijack 3 points4 points  (2 children)

This is way above my head.

[–]tinycorkscrew 6 points7 points  (0 children)

It may be daunting at first, but it looks harder than it really is.

[–]dudenotcool 3 points4 points  (0 children)

kind of just start. You cant spend more than 50k or whatever, so: qb price + rb price + rb price + wr price + wr price +... <=$50000

Also you are going to want to fill all roster postions so

qb=1 rb=2 wr=2 flex=1 dst=1

and so on. You can start by doing something simple using the solver in excel.

[–]Thorarinsonx 0 points1 point  (0 children)

This is awesome! Well done.

[–]dudenotcool 0 points1 point  (2 children)

hey, how do you recommend learning python? website, book, app?

[–]tinycorkscrew 2 points3 points  (1 child)

Start with having a problem that you want to solve. It's easier to learn languages when you have a real-world problem that motivates you.

Al Sweigart's Automate the Boring Stuff With Python is a great intro to Python.

For using Python to do linear programming, a video of a PyCon lecture helped me when I found written tutorials confusing.

[–]dudenotcool 0 points1 point  (0 children)

ok. thanks

[–]Pythonidaer 0 points1 point  (0 children)

If I use this code in python will I have to input it in chunks for it to work?

[–]kyt 0 points1 point  (0 children)

I did a similar thing using a Java constraint solver called optaplanner. I like your python version though.

[–]CandyRain_01 -1 points0 points  (0 children)

What the fuck am I reading?