BraydenMoore commited on
Commit
2b36ba0
·
1 Parent(s): 112a098

Update Source/Predict/predict.py

Browse files
Files changed (1) hide show
  1. Source/Predict/predict.py +3 -2
Source/Predict/predict.py CHANGED
@@ -171,9 +171,10 @@ def predict(home,away,season,week,total):
171
  xgb_ou = xgb.Booster()
172
  xgb_ou.load_model(file_path)
173
  try:
174
- ou_predicted_proba = xgb_ou.predict(matrix)[0][1].item()
 
175
  over_under = {'Over/Under': ['Over' if ou_predicted_proba>0.5 else 'Under'],
176
- 'Probability': [ou_predicted_proba]}
177
  except:
178
  over_under = {'Over/Under': 'N/A',
179
  'Probabilities': ['N/A']}
 
171
  xgb_ou = xgb.Booster()
172
  xgb_ou.load_model(file_path)
173
  try:
174
+ ou_predicted_proba = xgb_ou.predict(matrix)[0][1]
175
+ ou_proba = max([ou_predicted_proba, 1-ou_predicted_proba]).item()
176
  over_under = {'Over/Under': ['Over' if ou_predicted_proba>0.5 else 'Under'],
177
+ 'Probability': [ou_proba]}
178
  except:
179
  over_under = {'Over/Under': 'N/A',
180
  'Probabilities': ['N/A']}