James McCool
commited on
Commit
·
6c56d9c
1
Parent(s):
9051c91
Adjust ownership average calculation in predict_dupes function to a new ratio of 0.33, and add a debug print statement to display key portfolio metrics, enhancing data verification and accuracy in ownership assessments.
Browse files
global_func/predict_dupes.py
CHANGED
@@ -471,7 +471,7 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
471 |
portfolio['FLEX5_Own'] = portfolio.iloc[:,5].map(maps_dict['own_map']).astype('float32') / 100
|
472 |
|
473 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
474 |
-
portfolio['own_average'] = (portfolio['Own'].max() * .
|
475 |
portfolio['own_sum'] = portfolio[own_columns].sum(axis=1)
|
476 |
portfolio['avg_own_rank'] = portfolio[dup_count_columns].mean(axis=1)
|
477 |
|
@@ -520,9 +520,11 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
520 |
portfolio['Team_Own'] = portfolio.iloc[:,6].map(maps_dict['own_map']).astype('float32') / 100
|
521 |
|
522 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
523 |
-
portfolio['own_average'] = (portfolio['Own'].max() * .
|
524 |
portfolio['own_sum'] = portfolio[own_columns].sum(axis=1)
|
525 |
portfolio['avg_own_rank'] = portfolio[dup_count_columns].mean(axis=1)
|
|
|
|
|
526 |
|
527 |
# Calculate dupes formula
|
528 |
portfolio['dupes_calc'] = (portfolio['own_product'] * portfolio['avg_own_rank']) * Contest_Size + ((portfolio['salary'] - (50000 - portfolio['Own'])) / 100) - ((50000 - portfolio['salary']) / 100)
|
@@ -593,6 +595,7 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
593 |
portfolio['Finish_percentile'] = portfolio['Finish_percentile'] + .005 + (.005 * (Contest_Size / 10000))
|
594 |
portfolio['Finish_percentile'] = portfolio['Finish_percentile'] * percentile_multiplier
|
595 |
portfolio['Win%'] = portfolio['Win%'] * (1 - portfolio['Finish_percentile'])
|
|
|
596 |
|
597 |
portfolio['low_own_count'] = portfolio[own_columns].apply(lambda row: (row < 0.10).sum(), axis=1)
|
598 |
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)
|
|
|
471 |
portfolio['FLEX5_Own'] = portfolio.iloc[:,5].map(maps_dict['own_map']).astype('float32') / 100
|
472 |
|
473 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
474 |
+
portfolio['own_average'] = (portfolio['Own'].max() * .33) / 100
|
475 |
portfolio['own_sum'] = portfolio[own_columns].sum(axis=1)
|
476 |
portfolio['avg_own_rank'] = portfolio[dup_count_columns].mean(axis=1)
|
477 |
|
|
|
520 |
portfolio['Team_Own'] = portfolio.iloc[:,6].map(maps_dict['own_map']).astype('float32') / 100
|
521 |
|
522 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
523 |
+
portfolio['own_average'] = (portfolio['Own'].max() * .33) / 100
|
524 |
portfolio['own_sum'] = portfolio[own_columns].sum(axis=1)
|
525 |
portfolio['avg_own_rank'] = portfolio[dup_count_columns].mean(axis=1)
|
526 |
+
|
527 |
+
print(portfolio[['Own', 'own_product', 'own_average', 'own_sum', 'avg_own_rank']].head(10))
|
528 |
|
529 |
# Calculate dupes formula
|
530 |
portfolio['dupes_calc'] = (portfolio['own_product'] * portfolio['avg_own_rank']) * Contest_Size + ((portfolio['salary'] - (50000 - portfolio['Own'])) / 100) - ((50000 - portfolio['salary']) / 100)
|
|
|
595 |
portfolio['Finish_percentile'] = portfolio['Finish_percentile'] + .005 + (.005 * (Contest_Size / 10000))
|
596 |
portfolio['Finish_percentile'] = portfolio['Finish_percentile'] * percentile_multiplier
|
597 |
portfolio['Win%'] = portfolio['Win%'] * (1 - portfolio['Finish_percentile'])
|
598 |
+
portfolio['Win%'] = portfolio['Win%'].clip(lower=0, upper=max_allowed_win)
|
599 |
|
600 |
portfolio['low_own_count'] = portfolio[own_columns].apply(lambda row: (row < 0.10).sum(), axis=1)
|
601 |
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)
|