chkp-talexm commited on
Commit
3c8ed5d
·
1 Parent(s): 2202679
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -290,11 +290,19 @@ if uploaded_file:
290
  #rf_probs = rf.predict_proba(input_df)[:, 1]
291
  #test
292
  # Combine results
 
 
 
 
 
293
  predictions_df = pd.DataFrame({
294
  "CatBoost": catboost_preds,
295
  "XGBoost": xgb_preds,
296
  # "RandomForest": rf_preds
297
  })
 
 
 
298
  # Apply "at least one model predicts 1" rule
299
  predictions_df["is_click_predicted"] = predictions_df.max(axis=1)
300
 
 
290
  #rf_probs = rf.predict_proba(input_df)[:, 1]
291
  #test
292
  # Combine results
293
+ # ✅ Apply Threshold to Convert Probabilities into Binary Predictions
294
+ THRESHOLD = 0.7 # Adjust to control false positives
295
+
296
+
297
+
298
  predictions_df = pd.DataFrame({
299
  "CatBoost": catboost_preds,
300
  "XGBoost": xgb_preds,
301
  # "RandomForest": rf_preds
302
  })
303
+
304
+ catboost_preds = (catboost_probs >= THRESHOLD).astype(int)
305
+ xgb_preds = (xgb_probs >= THRESHOLD).astype(int)
306
  # Apply "at least one model predicts 1" rule
307
  predictions_df["is_click_predicted"] = predictions_df.max(axis=1)
308