pydfs-lineup-optimizer icon indicating copy to clipboard operation
pydfs-lineup-optimizer copied to clipboard

BOOSTS to players based on another player

Open lightninglarry opened this issue 2 years ago • 4 comments

How could I code in when player A is in lineup, player B gets a positive or negative bump to his projection?

example: Lebron James and Anthony Davis. Both high ceiling players and high priced. More than likely they dont get to the optimal together. 1 goes off, that hurts other usually.

So If lineup has Lebron, giving AD a -20 % boost to his projection? Or in NFL If lineup has QB Josh Allen, giving WR Stefon Diggs a + 20 % boost to his projection?

This would not force or not force guys in, but rather tweak their projections.

lightninglarry avatar Dec 17 '22 17:12 lightninglarry

I think you would have to do some complex coding for the optimizer to boost or subtract another players points IF a certain player is selected in a lineup. What I would suggest is looking into the grouping. As far as NBA goes, you are probably better off to make some solid grouping rules or player/position correlation stacks to your optimizer due to the amount of games in one night and the amount of changes made to final rosters before a game. There isn't much time between sites posting starters and the game actually beginning. That, in combination with games starting every 30 minutes, up to 14 games in a single night, and late swapping...it sound like it would be a nightmare.

You can put Lebron and Davis in a group and make it so only 1 is selected.(max_from_group)

group = PlayersGroup(optimizer.player_pool.get_players('LeBron James', 'Anthony Davis'), max_from_group=1) optimizer.add_players_group(group)

You could also group wide receivers based on if a quarterback is in your lineup. If Josh Allen is in your lineup, it will pair with at least one WR from the group.

group = PlayersGroup( optimizer.player_pool.get_players('Stephon Diggs', 'Gabriel Davis', 'Isaiah Mckenzie'), max_from_group=1, depends_on=optimizer.player_pool.get_player_by_name('Josh Allen'), strict_depend=False, # if you want to generate lineups with Diggs, Davis, Mckenzie but without Josh Allen ) optimizer.add_players_group(group)

chrisbach1 avatar Dec 27 '22 08:12 chrisbach1

i understand the logic and do use your examples that you listed. I guess my query was more for a smaller/single game type slate. Mainly NFL. I have access to another premium optimizer that allows to do this, but was just seeing if anyone had insight on ways to do this with python.

lightninglarry avatar Jan 03 '23 12:01 lightninglarry

@lightninglarry I think the easiest programmatic solution here is to add a step during your lineup sorting at the end that boosts the overall projection. For example: if this row contains "Player A" & "Player B" then multiply the total projection by 1.05 #5% boost.

Dr-Two-Inch avatar Feb 16 '23 16:02 Dr-Two-Inch

@Dr-Two-Inch I follow what your saying, but could you give an example with code?

lightninglarry avatar Feb 16 '23 17:02 lightninglarry