Spaces:
Running
Running
James McCool
commited on
Commit
·
b6f18d3
1
Parent(s):
8dedc8e
Refactor app.py to enhance prop percentage calculations by updating 'Over%' and 'Under%' metrics to use a weighted average approach. This change improves the accuracy of player projections by incorporating 'Imp Over', 'Trending Over', 'Imp Under', and 'Trending Under' with specified weights, ensuring a more reliable analysis of prop outcomes.
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ prop_format = {'L5 Success': '{:.2%}', 'L10_Success': '{:.2%}', 'L20_success': '
|
|
| 60 |
'Implied Over': '{:.2%}', 'Implied Under': '{:.2%}', 'Over Edge': '{:.2%}', 'Under Edge': '{:.2%}'}
|
| 61 |
all_sim_vars = ['NHL_GAME_PLAYER_SHOTS_ON_GOAL', 'NHL_GAME_PLAYER_POINTS', 'NHL_GAME_PLAYER_SHOTS_BLOCKED', 'NHL_GAME_PLAYER_ASSISTS']
|
| 62 |
pick6_sim_vars = ['Points', 'Shots on Goal', 'Assists', 'Blocks']
|
| 63 |
-
sim_all_hold = pd.DataFrame(columns=['Player', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', '
|
| 64 |
|
| 65 |
@st.cache_resource(ttl=200)
|
| 66 |
def pull_baselines():
|
|
@@ -293,10 +293,10 @@ with tab3:
|
|
| 293 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 294 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 295 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 296 |
-
players_only['Over%'] = players_only[
|
| 297 |
players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
|
| 298 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 299 |
-
players_only['Under%'] = players_only[
|
| 300 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 301 |
players_only['prop_threshold'] = .10
|
| 302 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
|
@@ -311,7 +311,7 @@ with tab3:
|
|
| 311 |
players_only['Player'] = hold_file[['Player']]
|
| 312 |
players_only['Team'] = players_only['Player'].map(team_dict)
|
| 313 |
|
| 314 |
-
leg_outcomes = players_only[['Player', 'Team', 'Book', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', '
|
| 315 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 316 |
|
| 317 |
final_outcomes = sim_all_hold
|
|
@@ -421,10 +421,10 @@ with tab3:
|
|
| 421 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 422 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 423 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 424 |
-
players_only['Over%'] = players_only[
|
| 425 |
players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
|
| 426 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 427 |
-
players_only['Under%'] = players_only[
|
| 428 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 429 |
players_only['prop_threshold'] = .10
|
| 430 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
|
@@ -439,7 +439,7 @@ with tab3:
|
|
| 439 |
players_only['Player'] = hold_file[['Player']]
|
| 440 |
players_only['Team'] = players_only['Player'].map(team_dict)
|
| 441 |
|
| 442 |
-
leg_outcomes = players_only[['Player', 'Team', 'Book', 'Prop', 'Prop Type', 'Mean_Outcome', 'Imp Over', '
|
| 443 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 444 |
|
| 445 |
final_outcomes = sim_all_hold
|
|
|
|
| 60 |
'Implied Over': '{:.2%}', 'Implied Under': '{:.2%}', 'Over Edge': '{:.2%}', 'Under Edge': '{:.2%}'}
|
| 61 |
all_sim_vars = ['NHL_GAME_PLAYER_SHOTS_ON_GOAL', 'NHL_GAME_PLAYER_POINTS', 'NHL_GAME_PLAYER_SHOTS_BLOCKED', 'NHL_GAME_PLAYER_ASSISTS']
|
| 62 |
pick6_sim_vars = ['Points', 'Shots on Goal', 'Assists', 'Blocks']
|
| 63 |
+
sim_all_hold = pd.DataFrame(columns=['Player', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', 'Trending Over', 'Over%', 'Imp Under', 'Trending Under', 'Under%', 'Bet?', 'Edge'])
|
| 64 |
|
| 65 |
@st.cache_resource(ttl=200)
|
| 66 |
def pull_baselines():
|
|
|
|
| 293 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 294 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 295 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 296 |
+
players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
|
| 297 |
players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
|
| 298 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 299 |
+
players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
|
| 300 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 301 |
players_only['prop_threshold'] = .10
|
| 302 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
|
|
|
| 311 |
players_only['Player'] = hold_file[['Player']]
|
| 312 |
players_only['Team'] = players_only['Player'].map(team_dict)
|
| 313 |
|
| 314 |
+
leg_outcomes = players_only[['Player', 'Team', 'Book', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', 'Trending Over', 'Over%', 'Imp Under', 'Trending Under', 'Under%', 'Bet?', 'Edge']]
|
| 315 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 316 |
|
| 317 |
final_outcomes = sim_all_hold
|
|
|
|
| 421 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 422 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 423 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 424 |
+
players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
|
| 425 |
players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
|
| 426 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 427 |
+
players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
|
| 428 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 429 |
players_only['prop_threshold'] = .10
|
| 430 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
|
|
|
| 439 |
players_only['Player'] = hold_file[['Player']]
|
| 440 |
players_only['Team'] = players_only['Player'].map(team_dict)
|
| 441 |
|
| 442 |
+
leg_outcomes = players_only[['Player', 'Team', 'Book', 'Prop', 'Prop Type', 'Mean_Outcome', 'Imp Over', 'Trending Over', 'Over%', 'Imp Under', 'Trending Under', 'Under%', 'Bet?', 'Edge']]
|
| 443 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 444 |
|
| 445 |
final_outcomes = sim_all_hold
|