James McCool
commited on
Commit
·
8b35df7
1
Parent(s):
2cde0be
Enhance ownership calculations in predict_dupes.py: add support for an additional FLEX5 ownership column, improving the accuracy of duplication predictions for CS2 portfolios and ensuring comprehensive analysis of player ownership metrics.
Browse files
global_func/predict_dupes.py
CHANGED
@@ -127,14 +127,15 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
127 |
)
|
128 |
if type_var == 'Classic':
|
129 |
if sport_var == 'CS2':
|
130 |
-
dup_count_columns = ['CPT_Own_percent_rank', 'FLEX1_Own_percent_rank', 'FLEX2_Own_percent_rank', 'FLEX3_Own_percent_rank', 'FLEX4_Own_percent_rank']
|
131 |
-
own_columns = ['CPT_Own', 'FLEX1_Own', 'FLEX2_Own', 'FLEX3_Own', 'FLEX4_Own']
|
132 |
calc_columns = ['own_product', 'own_average', 'own_sum', 'avg_own_rank', 'dupes_calc', 'low_own_count', 'Ref_Proj', 'Max_Proj', 'Min_Proj', 'Avg_Ref', 'own_ratio']
|
133 |
flex_ownerships = pd.concat([
|
134 |
portfolio.iloc[:,1].map(maps_dict['own_map']),
|
135 |
portfolio.iloc[:,2].map(maps_dict['own_map']),
|
136 |
portfolio.iloc[:,3].map(maps_dict['own_map']),
|
137 |
-
portfolio.iloc[:,4].map(maps_dict['own_map'])
|
|
|
138 |
])
|
139 |
flex_rank = flex_ownerships.rank(pct=True)
|
140 |
|
@@ -144,12 +145,14 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
144 |
portfolio['FLEX2_Own_percent_rank'] = portfolio.iloc[:,2].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
145 |
portfolio['FLEX3_Own_percent_rank'] = portfolio.iloc[:,3].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
146 |
portfolio['FLEX4_Own_percent_rank'] = portfolio.iloc[:,4].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
|
|
147 |
|
148 |
portfolio['CPT_Own'] = portfolio.iloc[:,0].map(maps_dict['cpt_own_map']) / 100
|
149 |
portfolio['FLEX1_Own'] = portfolio.iloc[:,1].map(maps_dict['own_map']) / 100
|
150 |
portfolio['FLEX2_Own'] = portfolio.iloc[:,2].map(maps_dict['own_map']) / 100
|
151 |
portfolio['FLEX3_Own'] = portfolio.iloc[:,3].map(maps_dict['own_map']) / 100
|
152 |
portfolio['FLEX4_Own'] = portfolio.iloc[:,4].map(maps_dict['own_map']) / 100
|
|
|
153 |
|
154 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
155 |
portfolio['own_average'] = (portfolio['Own'].max() * .33) / 100
|
|
|
127 |
)
|
128 |
if type_var == 'Classic':
|
129 |
if sport_var == 'CS2':
|
130 |
+
dup_count_columns = ['CPT_Own_percent_rank', 'FLEX1_Own_percent_rank', 'FLEX2_Own_percent_rank', 'FLEX3_Own_percent_rank', 'FLEX4_Own_percent_rank', 'FLEX5_Own_percent_rank']
|
131 |
+
own_columns = ['CPT_Own', 'FLEX1_Own', 'FLEX2_Own', 'FLEX3_Own', 'FLEX4_Own', 'FLEX5_Own']
|
132 |
calc_columns = ['own_product', 'own_average', 'own_sum', 'avg_own_rank', 'dupes_calc', 'low_own_count', 'Ref_Proj', 'Max_Proj', 'Min_Proj', 'Avg_Ref', 'own_ratio']
|
133 |
flex_ownerships = pd.concat([
|
134 |
portfolio.iloc[:,1].map(maps_dict['own_map']),
|
135 |
portfolio.iloc[:,2].map(maps_dict['own_map']),
|
136 |
portfolio.iloc[:,3].map(maps_dict['own_map']),
|
137 |
+
portfolio.iloc[:,4].map(maps_dict['own_map']),
|
138 |
+
portfolio.iloc[:,5].map(maps_dict['own_map'])
|
139 |
])
|
140 |
flex_rank = flex_ownerships.rank(pct=True)
|
141 |
|
|
|
145 |
portfolio['FLEX2_Own_percent_rank'] = portfolio.iloc[:,2].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
146 |
portfolio['FLEX3_Own_percent_rank'] = portfolio.iloc[:,3].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
147 |
portfolio['FLEX4_Own_percent_rank'] = portfolio.iloc[:,4].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
148 |
+
portfolio['FLEX5_Own_percent_rank'] = portfolio.iloc[:,5].map(maps_dict['own_map']).map(lambda x: flex_rank[flex_ownerships == x].iloc[0])
|
149 |
|
150 |
portfolio['CPT_Own'] = portfolio.iloc[:,0].map(maps_dict['cpt_own_map']) / 100
|
151 |
portfolio['FLEX1_Own'] = portfolio.iloc[:,1].map(maps_dict['own_map']) / 100
|
152 |
portfolio['FLEX2_Own'] = portfolio.iloc[:,2].map(maps_dict['own_map']) / 100
|
153 |
portfolio['FLEX3_Own'] = portfolio.iloc[:,3].map(maps_dict['own_map']) / 100
|
154 |
portfolio['FLEX4_Own'] = portfolio.iloc[:,4].map(maps_dict['own_map']) / 100
|
155 |
+
portfolio['FLEX5_Own'] = portfolio.iloc[:,5].map(maps_dict['own_map']) / 100
|
156 |
|
157 |
portfolio['own_product'] = (portfolio[own_columns].product(axis=1))
|
158 |
portfolio['own_average'] = (portfolio['Own'].max() * .33) / 100
|