Spaces:
Running
Running
Update src/inference_utils.py
Browse files- src/inference_utils.py +2 -1
src/inference_utils.py
CHANGED
|
@@ -19,7 +19,8 @@ def compute_metrics(y_true, y_pred_proba, threshold=0.5):
|
|
| 19 |
def add_predictions(df, probs):
|
| 20 |
df['Predicted Probability'] = probs
|
| 21 |
pred_col = f"{st.session_state.target_col} Prediction"
|
| 22 |
-
|
|
|
|
| 23 |
|
| 24 |
df_with_gt = df[['Predicted Probability', pred_col]].join(st.session_state.targets_df)
|
| 25 |
|
|
|
|
| 19 |
def add_predictions(df, probs):
|
| 20 |
df['Predicted Probability'] = probs
|
| 21 |
pred_col = f"{st.session_state.target_col} Prediction"
|
| 22 |
+
threshold = 0.5
|
| 23 |
+
df[pred_col] = ['POSITIVE' if p >= threshold else 'NEGATIVE' for p in probs]
|
| 24 |
|
| 25 |
df_with_gt = df[['Predicted Probability', pred_col]].join(st.session_state.targets_df)
|
| 26 |
|