Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -84,6 +84,8 @@ model = joblib.load('joblib_model/tjstuff_model_20240318.joblib')
|
|
84 |
y_pred_mean = 0.0011434511
|
85 |
y_pred_std = 0.006554768
|
86 |
|
|
|
|
|
87 |
features = ['start_speed','spin_rate','extension','ivb','hb','x0','z0','fb_max_velo_diff','fb_max_ivb_diff','fb_max_hb_diff']
|
88 |
|
89 |
targets = ['delta_run_exp_mean']
|
@@ -93,6 +95,12 @@ df_2024_update['y_pred'] = model.predict(df_2024_update[features])
|
|
93 |
|
94 |
df_2024_update['tj_stuff_plus'] = 100 + 10*((-df_2024_update.y_pred +y_pred_mean) / y_pred_std)
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
team_logos = pd.read_csv('team_logos.csv')
|
97 |
|
98 |
mlb_stats = MLB_Scrape()
|
|
|
84 |
y_pred_mean = 0.0011434511
|
85 |
y_pred_std = 0.006554768
|
86 |
|
87 |
+
xwoba_model = joblib.load('joblib_model/xwoba_model.joblib')
|
88 |
+
|
89 |
features = ['start_speed','spin_rate','extension','ivb','hb','x0','z0','fb_max_velo_diff','fb_max_ivb_diff','fb_max_hb_diff']
|
90 |
|
91 |
targets = ['delta_run_exp_mean']
|
|
|
95 |
|
96 |
df_2024_update['tj_stuff_plus'] = 100 + 10*((-df_2024_update.y_pred +y_pred_mean) / y_pred_std)
|
97 |
|
98 |
+
df_2024_update['woba_pred'] = np.nan
|
99 |
+
|
100 |
+
df_2024_update.loc[df_2024_update[['launch_angle','launch_speed']].isnull().sum(axis=1)==0,'woba_pred'] = [sum(x) for x in xwoba_model.predict_proba(df_2024_update.loc[df_2024_update[['launch_angle','launch_speed']].isnull().sum(axis=1)==0][['launch_angle','launch_speed']]) * ([0, 0.883,1.244,1.569,2.004])]
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
team_logos = pd.read_csv('team_logos.csv')
|
105 |
|
106 |
mlb_stats = MLB_Scrape()
|