Spaces:
Running
Running
James McCool
commited on
Commit
·
3a0d10d
1
Parent(s):
f48225e
Refactor app.py to improve 'over_adj' and 'under_adj' calculations by adjusting the logic to use conditional checks instead of division, enhancing the accuracy of player projections. Additionally, update 'Bet_check' calculations to incorporate these adjustments, ensuring a more reliable analysis of betting suggestions based on player performance metrics.
Browse files
app.py
CHANGED
|
@@ -288,8 +288,8 @@ with tab3:
|
|
| 288 |
players_only['Book'] = players_only['Player'].map(book_dict)
|
| 289 |
players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
|
| 290 |
players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
|
| 291 |
-
players_only['over_adj'] = np_where((players_only['Mean_Outcome']
|
| 292 |
-
players_only['under_adj'] = np_where((players_only['Prop']
|
| 293 |
players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
|
| 294 |
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
| 295 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
|
@@ -304,7 +304,7 @@ with tab3:
|
|
| 304 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
| 305 |
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
| 306 |
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
| 307 |
-
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
|
| 308 |
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
| 309 |
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
| 310 |
players_only['Edge'] = players_only['Bet_check']
|
|
@@ -418,23 +418,23 @@ with tab3:
|
|
| 418 |
players_only['Book'] = players_only['Player'].map(book_dict)
|
| 419 |
players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
|
| 420 |
players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
|
| 421 |
-
players_only['over_adj'] = np_where((players_only['Mean_Outcome']
|
| 422 |
-
players_only['under_adj'] = np_where((players_only['Prop']
|
| 423 |
players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
|
| 424 |
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
| 425 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 426 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 427 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 428 |
-
players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
|
| 429 |
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))
|
| 430 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 431 |
-
players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
|
| 432 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 433 |
players_only['prop_threshold'] = .10
|
| 434 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
| 435 |
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
| 436 |
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
| 437 |
-
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
|
| 438 |
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
| 439 |
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
| 440 |
players_only['Edge'] = players_only['Bet_check']
|
|
|
|
| 288 |
players_only['Book'] = players_only['Player'].map(book_dict)
|
| 289 |
players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
|
| 290 |
players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
|
| 291 |
+
players_only['over_adj'] = np_where((players_only['Mean_Outcome'] - players_only['Prop']) > 0, 1, (players_only['Mean_Outcome'] / players_only['Prop']) - 1)
|
| 292 |
+
players_only['under_adj'] = np_where((players_only['Prop'] - players_only['Mean_Outcome']) > 0, 1, (players_only['Prop'] / players_only['Mean_Outcome']) - 1)
|
| 293 |
players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
|
| 294 |
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
| 295 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
|
|
|
| 304 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
| 305 |
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
| 306 |
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
| 307 |
+
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] * players_only['over_adj'], players_only['Under_diff'] * players_only['under_adj'])
|
| 308 |
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
| 309 |
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
| 310 |
players_only['Edge'] = players_only['Bet_check']
|
|
|
|
| 418 |
players_only['Book'] = players_only['Player'].map(book_dict)
|
| 419 |
players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
|
| 420 |
players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
|
| 421 |
+
players_only['over_adj'] = np_where((players_only['Mean_Outcome'] - players_only['Prop']) > 0, 1, (players_only['Mean_Outcome'] / players_only['Prop']) - 1)
|
| 422 |
+
players_only['under_adj'] = np_where((players_only['Prop'] - players_only['Mean_Outcome']) > 0, 1, (players_only['Prop'] / players_only['Mean_Outcome']) - 1)
|
| 423 |
players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
|
| 424 |
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
| 425 |
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
| 426 |
players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
|
| 427 |
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
| 428 |
+
players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
|
| 429 |
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))
|
| 430 |
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
| 431 |
+
players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
|
| 432 |
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
| 433 |
players_only['prop_threshold'] = .10
|
| 434 |
players_only = players_only[players_only['Mean_Outcome'] > 0]
|
| 435 |
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
| 436 |
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
| 437 |
+
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] * players_only['over_adj'], players_only['Under_diff'] * players_only['under_adj'])
|
| 438 |
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
| 439 |
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
| 440 |
players_only['Edge'] = players_only['Bet_check']
|