James McCool
commited on
Commit
·
c1137d7
1
Parent(s):
bb549d3
Update sorting and ownership calculations in large_field_preset.py to use 'median' instead of 'Finish_percentile' and 'Own'. This change improves accuracy in lineup generation by aligning calculations with the updated data structure.
Browse files
global_func/large_field_preset.py
CHANGED
@@ -11,20 +11,20 @@ def large_field_preset(portfolio: pd.DataFrame, lineup_target: int, exclude_cols
|
|
11 |
for team in portfolio['Stack'].unique():
|
12 |
rows_to_drop = []
|
13 |
working_portfolio = portfolio.copy()
|
14 |
-
working_portfolio = working_portfolio[working_portfolio['Stack'] == team].sort_values(by='
|
15 |
working_portfolio = working_portfolio.reset_index(drop=True)
|
16 |
-
curr_own_type_max = working_portfolio.loc[0, '
|
17 |
|
18 |
for i in range(1, len(working_portfolio)):
|
19 |
-
if working_portfolio.loc[i, '
|
20 |
rows_to_drop.append(i)
|
21 |
else:
|
22 |
-
curr_own_type_max = working_portfolio.loc[i, '
|
23 |
|
24 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
25 |
concat_portfolio = pd.concat([concat_portfolio, working_portfolio])
|
26 |
|
27 |
if len(concat_portfolio) >= lineup_target:
|
28 |
-
return concat_portfolio.sort_values(by='
|
29 |
|
30 |
-
return concat_portfolio.sort_values(by='
|
|
|
11 |
for team in portfolio['Stack'].unique():
|
12 |
rows_to_drop = []
|
13 |
working_portfolio = portfolio.copy()
|
14 |
+
working_portfolio = working_portfolio[working_portfolio['Stack'] == team].sort_values(by='Similarity Score', ascending = True)
|
15 |
working_portfolio = working_portfolio.reset_index(drop=True)
|
16 |
+
curr_own_type_max = working_portfolio.loc[0, 'median'] + (slack_var / 20 * working_portfolio.loc[0, 'median'])
|
17 |
|
18 |
for i in range(1, len(working_portfolio)):
|
19 |
+
if working_portfolio.loc[i, 'median'] < curr_own_type_max:
|
20 |
rows_to_drop.append(i)
|
21 |
else:
|
22 |
+
curr_own_type_max = working_portfolio.loc[i, 'median'] + (slack_var / 20 * working_portfolio.loc[i, 'median'])
|
23 |
|
24 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
25 |
concat_portfolio = pd.concat([concat_portfolio, working_portfolio])
|
26 |
|
27 |
if len(concat_portfolio) >= lineup_target:
|
28 |
+
return concat_portfolio.sort_values(by='median', ascending = False).head(lineup_target)
|
29 |
|
30 |
+
return concat_portfolio.sort_values(by='median', ascending = False)
|