Open oraj92 opened 4 years ago
The weird thing I just found out and is really interesting: I just ran 400 LUs with min 0.05 and max 0.35 and IT WORKED. Then SECOND try with the same specs!! and the error "Can´t generate lineups" appears. Both runs were with randomness=true
@DimaKudosh can you help here maybe?
You can also use the randomize
feature to solve this problem. If projections are close on a point-per-dollar basis, then it will even out your exposures. If you are generating a large number of lineups, you probably don't want to use identical projections for each lineup.
iterations = 150
min_deviation = 0
max_deviation = .15
optimizer.set_deviation(min_deviation, max_deviation)
for _ in range(iterations):
for lineup in optimizer.optimize(1, randomness=True):
lineups.append(lineup)
sir this does not help and gives for this line for lineup in optimizer.optimize(n=number_lineups, max_exposure=max_exposure, exposure_strategy=exposure_strategy, randomness=True): this exception raise LineupOptimizerException('Can\'t generate lineups')
My example is instead of using max_exposure and exposure_strategy - the idea is that you can accomplish the same end result (not too high % of player in your lineups) by randomizing their projections.
Take an example of Player A with projection of 10 and salary of 5000, player B has a projection of 9.6 and a salary of 5000. The optimizer will always choose Player A over Player B. If you randomize the projections by up to 15% over 150 lineups, you are going to get a mix of Player A and Player B.
Iteration 1, Player A is decreased by 5%, so projection is 9.5, Player B is increased by 10%, so projection is 10.55 and would be chosen over Player A.
Iteration 2, Player A increased by more than Player B, so player A would be chosen over Player B, and so on and so forth.
The bottom line is that most choices to limit ownership (I only want 40% of this player, etc.) are fairly arbitrary, so why not let randomization do the work for you?
for lineup in optimizer.optimize(n=number_lineups, max_exposure=max_exposure, exposure_strategy=exposure_strategy): for player in lineup.players: player_usage[player.full_name] = player_usage[player.full_name] + 1 csv = csv + player.id + ',' lineups.append(lineup) csv = csv[:-1] + '\n' sir this is my code and i used the randomnes as well but that does not help out
sir i am waiting for ur response how can i make the lineups upto 150 in the minimum time in my scenario so request time out does not happen pr use the background worker for it?? @sansbacon @trevordavies095
The Error Code
appears always when I set the min exposure of players (I tried different min exposures like 0.05 or 0.01). I do not believe that it is impossible to create my given number of Lineups (100) with this spec so there has to be another error that stops the algo. Has anyone experienced this issue? Do you have an idea how to fix this?
In general my Lineups are to heavy weighted for value players and for example in NBA the proj difference between 2 players is 3 points but that makes the higher projected player have an exposure of over 70% and the other one 0%. I want to have a more flat exposure outcome.
Any help is appreciated!