You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
optimizer.remove_player(player) # Remove all Nets centers from optimizer
145
-
harden =optimizer.get_player_by_name('Harden')
146
-
westbrook =optimizer.get_player_by_name('Westbrook') # Get Harden and Westbrook
162
+
pool= optimizer.player_pool
163
+
for player inpool.get_players(PlayerFilter(positions=['C'], teams=['Nets'])):
164
+
pool.remove_player(player) # Remove all Nets centers from optimizer
165
+
harden =pool.get_player_by_name('Harden')
166
+
westbrook =pool.get_player_by_name('Westbrook') # Get Harden and Westbrook
147
167
harden.max_exposure =0.6
148
168
westbrook.max_exposure =0.4# Set exposures for Harden and Westbrook
149
-
optimizer.add_player_to_lineup(harden)
150
-
optimizer.add_player_to_lineup(westbrook) # Lock Harden and Westbrook
169
+
optimizer.lock_player(harden)
170
+
optimizer.lock_player(westbrook) # Lock Harden and Westbrook
151
171
for lineup in optimizer.optimize(n=10, max_exposure=0.3):
152
172
print(lineup)
153
173
154
174
Late-Swap
155
175
--------------------
156
176
157
177
Optimizer provides additional functionality that allows to re-optimize existed lineups.
158
-
Currently this feature implemented for DK and FanDuel.
159
-
For this you should load lineups, you can do it from csv file generated for specific contest.
178
+
Currently, this feature is implemented for DK and FanDuel.
179
+
For this you should load lineups, you can do it from csv file generated for a specific contest.
160
180
Then you should pass loaded lineups to `optimize_lineups` method.
161
-
Players with started game will be locked on specific positions and optimizer will change only players with upcoming game.
181
+
Players with the started game will be locked on specific positions and the optimizer will change only players with the upcoming game.
162
182
163
183
.. code-block:: python
164
184
@@ -169,7 +189,7 @@ Players with started game will be locked on specific positions and optimizer wil
169
189
for lineup in optimizer.optimize_lineups(lineups):
170
190
print(lineup)
171
191
172
-
Because FanDuel doesn't provide information about locked player and games start time you should manually add information about started games like in example below:
192
+
Because FanDuel doesn't provide information about locked player and games start time you should manually add information about started games like in the example below:
173
193
174
194
.. code-block:: python
175
195
@@ -196,7 +216,7 @@ You can change it using `set_timezone` function:
196
216
Export lineups
197
217
==============
198
218
199
-
You can export lineups into a csv file. For this you should call export method of the optimizer after you generate all lineups.
219
+
You can export lineups into a csv file. For this, you should call the export method of the optimizer after you generate all lineups.
200
220
201
221
.. code-block:: python
202
222
@@ -226,22 +246,22 @@ There are several strategies already implemented in this package:
226
246
227
247
RandomFantasyPointsStrategy adds some deviation for players projection for creating less optimized but more randomized lineups.
228
248
You can set this deviation when creating strategy by default min deviation is 0 and max deviation is 12%.
229
-
You also can specify playerspecific deviation using `min_deviation` and `max_deviation` attributes for player,
249
+
You also can specify player-specific deviation using `min_deviation` and `max_deviation` attributes for a player
230
250
or using additional columns `Min Deviation` and `Max Deviation` in import csv.
231
-
Also you can randomize players fppg by specifying projection range using `fppg_floor` and `fppg_ceil` attributes for player or
232
-
`Projection Floor` and `Projection Ceil` csv columns. In this case this method has priority over deviation.
251
+
Also, you can randomize players fppg by specifying projection range using `fppg_floor` and `fppg_ceil` attributes for player or
252
+
`Projection Floor` and `Projection Ceil` csv columns. In this case, this method has priority over deviation.
233
253
It works only if both fields are specified.
234
254
235
255
.. code-block:: python
236
256
237
257
optimizer.set_fantasy_points_strategy(RandomFantasyPointsStrategy(max_deviation=0.2)) # set random strategy with custom max_deviation
doncic.fppg_floor =60# Randomize using projection range
246
266
doncic.fppg_ceil =90
247
267
lineups = optimizer.optimize(n=10)
@@ -250,22 +270,21 @@ It works only if both fields are specified.
250
270
251
271
With RandomFantasyPointsStrategy optimizer generate lineups without ordering by max points projection.
252
272
253
-
ProgressiveFantasyPointsStrategy is another method to randomize optimizer result.
273
+
ProgressiveFantasyPointsStrategy is another method to randomize optimizer results.
254
274
It increases fantasy points for each player that wasn't used in the previous lineup by some specified percent of original fantasy points.
255
-
It works cumulatively so fantasy points will be greater if player didn't used in lineup multiple times.
256
-
After player will be selected to lineup his points will be reset to the original value.
257
-
You can change this value for specific player by setting `progressive_scale` property of Player or by adding `Progressive Scale` column to import csv.
258
-
275
+
It works cumulatively so fantasy points will be greater if the player wasn't used in the lineup multiple times.
276
+
After the player will be selected to lineup his points will be reset to the original value.
277
+
You can change this value for a specific player by setting `progressive_scale` property of Player or by adding `Progressive Scale` column to import csv.
259
278
.. code-block:: python
260
279
261
280
optimizer.set_fantasy_points_strategy(ProgressiveFantasyPointsStrategy(0.01)) # Set progressive strategy that increase player points by 1%
262
-
optimizer.get_player_by_name('Stephen Curry').progressive_scale =0.02# For curry points will be increased by 2%
281
+
optimizer.player_pool.get_player_by_name('Stephen Curry').progressive_scale =0.02# For curry points will be increased by 2%
263
282
264
283
Exclude lineups
265
284
===============
266
285
267
286
You can run the optimizer several times. In this case, you probably want to avoid duplicated lineups in the result.
268
-
You can provide a list of excluded lineups to optimize method.
287
+
You can provide a list of excluded lineups to the optimize method.
269
288
All of these lineups will be excluded from optimization and newly generated lineups will count them in max repeating players rule.
0 commit comments