James McCool
commited on
Commit
·
2fd6d6d
1
Parent(s):
3820d21
Update exposure_spread function to introduce lineups_to_add calculation, ensuring accurate adjustments for player additions during exposure evaluations. Modify related logic to reflect this change and enhance debugging output for lineups_to_add.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -259,6 +259,7 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 259 |
lineups_to_remove = (player_exposure * len(working_frame))
|
| 260 |
else:
|
| 261 |
lineups_to_remove = ((player_exposure - exposure_target) * len(working_frame)) * 1.01
|
|
|
|
| 262 |
|
| 263 |
# isolate the rows that contain the player
|
| 264 |
player_rows = working_frame[player_mask]
|
|
@@ -326,9 +327,9 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 326 |
break
|
| 327 |
change_counter += 1
|
| 328 |
else:
|
| 329 |
-
|
| 330 |
for row in random_row_indices_replace:
|
| 331 |
-
if change_counter < math.ceil(
|
| 332 |
comparable_players = projections_df[
|
| 333 |
(projections_df['salary'] >= comp_salary_low) &
|
| 334 |
(projections_df['salary'] <= comp_salary_high + (salary_max - working_frame['salary'][row])) &
|
|
@@ -345,7 +346,7 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 345 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 346 |
|
| 347 |
# Create a list of comparable players
|
| 348 |
-
print(
|
| 349 |
comparable_player_list = comparable_players['player_names'].tolist()
|
| 350 |
print(comparable_player_list)
|
| 351 |
if comparable_player_list:
|
|
|
|
| 259 |
lineups_to_remove = (player_exposure * len(working_frame))
|
| 260 |
else:
|
| 261 |
lineups_to_remove = ((player_exposure - exposure_target) * len(working_frame)) * 1.01
|
| 262 |
+
lineups_to_add = (exposure_target * len(working_frame)) * 1.01
|
| 263 |
|
| 264 |
# isolate the rows that contain the player
|
| 265 |
player_rows = working_frame[player_mask]
|
|
|
|
| 327 |
break
|
| 328 |
change_counter += 1
|
| 329 |
else:
|
| 330 |
+
lineups_to_add = lineups_to_add * -1
|
| 331 |
for row in random_row_indices_replace:
|
| 332 |
+
if change_counter < math.ceil(lineups_to_add):
|
| 333 |
comparable_players = projections_df[
|
| 334 |
(projections_df['salary'] >= comp_salary_low) &
|
| 335 |
(projections_df['salary'] <= comp_salary_high + (salary_max - working_frame['salary'][row])) &
|
|
|
|
| 346 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 347 |
|
| 348 |
# Create a list of comparable players
|
| 349 |
+
print(lineups_to_add)
|
| 350 |
comparable_player_list = comparable_players['player_names'].tolist()
|
| 351 |
print(comparable_player_list)
|
| 352 |
if comparable_player_list:
|