James McCool
commited on
Commit
·
7928ec7
1
Parent(s):
b35724d
Enhance Lineup Edge calculation in predict_dupes.py by normalizing the edge values based on the maximum and minimum edges. This adjustment improves the scaling of the Lineup Edge, leading to more accurate portfolio predictions.
Browse files
global_func/predict_dupes.py
CHANGED
|
@@ -421,7 +421,9 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
| 421 |
portfolio['Finish_percentile'] = portfolio.apply(lambda row: row['Finish_percentile'] if row['low_own_count'] <= 0 else row['Finish_percentile'] / row['low_own_count'], axis=1)
|
| 422 |
portfolio['Lineup Edge'] = (portfolio['Win%'] * ((.5 - portfolio['Finish_percentile']) * (Contest_Size / 2.5)))
|
| 423 |
# portfolio['Lineup Edge'] = portfolio.apply(lambda row: row['Lineup Edge'] / (row['Dupes'] + 1) if row['Dupes'] > 0 else row['Lineup Edge'], axis=1)
|
| 424 |
-
portfolio['Lineup Edge'] = ((portfolio['Lineup Edge'] - portfolio['Lineup Edge'].mean())) - ((portfolio['Dupes'] - portfolio['Dupes'].mean()) / 50)
|
|
|
|
|
|
|
| 425 |
portfolio['Weighted Own'] = portfolio[own_columns].apply(calculate_weighted_ownership_wrapper, axis=1)
|
| 426 |
portfolio['Geomean'] = np.power((portfolio[own_columns] * 100).product(axis=1), 1 / len(own_columns))
|
| 427 |
|
|
|
|
| 421 |
portfolio['Finish_percentile'] = portfolio.apply(lambda row: row['Finish_percentile'] if row['low_own_count'] <= 0 else row['Finish_percentile'] / row['low_own_count'], axis=1)
|
| 422 |
portfolio['Lineup Edge'] = (portfolio['Win%'] * ((.5 - portfolio['Finish_percentile']) * (Contest_Size / 2.5)))
|
| 423 |
# portfolio['Lineup Edge'] = portfolio.apply(lambda row: row['Lineup Edge'] / (row['Dupes'] + 1) if row['Dupes'] > 0 else row['Lineup Edge'], axis=1)
|
| 424 |
+
portfolio['Lineup Edge'] = ((portfolio['Lineup Edge'] - portfolio['Lineup Edge'].mean())) - ((portfolio['Dupes'] - portfolio['Dupes'].mean()) / 50)
|
| 425 |
+
max_edge = portfolio['Lineup Edge'].max()
|
| 426 |
+
portfolio['Lineup Edge'] = 2 * max_edge * (portfolio['Lineup Edge'] - portfolio['Lineup Edge'].min()) / (portfolio['Lineup Edge'].max() - portfolio['Lineup Edge'].min()) - max_edge
|
| 427 |
portfolio['Weighted Own'] = portfolio[own_columns].apply(calculate_weighted_ownership_wrapper, axis=1)
|
| 428 |
portfolio['Geomean'] = np.power((portfolio[own_columns] * 100).product(axis=1), 1 / len(own_columns))
|
| 429 |
|