fix(ai-engine): hoist ms_edge before score prediction branch to prevent UnboundLocalError
Deploy Iddaai Backend / build-and-deploy (push) Successful in 5s
Deploy Iddaai Backend / build-and-deploy (push) Successful in 5s
This commit is contained in:
@@ -925,6 +925,7 @@ class SingleMatchOrchestrator:
|
|||||||
prediction.handicap_confidence = hcap_top * 100.0
|
prediction.handicap_confidence = hcap_top * 100.0
|
||||||
|
|
||||||
# ── Score Prediction: Model-first, heuristic fallback ──────────
|
# ── Score Prediction: Model-first, heuristic fallback ──────────
|
||||||
|
ms_edge = prediction.ms_home_prob - prediction.ms_away_prob
|
||||||
score_result = self._predict_score_with_model(features)
|
score_result = self._predict_score_with_model(features)
|
||||||
if score_result is not None:
|
if score_result is not None:
|
||||||
# ML model predicted scores
|
# ML model predicted scores
|
||||||
@@ -939,7 +940,7 @@ class SingleMatchOrchestrator:
|
|||||||
# Heuristic fallback (original formula)
|
# Heuristic fallback (original formula)
|
||||||
base_home_xg = max(0.25, (float(data.home_goals_avg) + float(features.get("away_xga", data.away_conceded_avg))) / 2.0)
|
base_home_xg = max(0.25, (float(data.home_goals_avg) + float(features.get("away_xga", data.away_conceded_avg))) / 2.0)
|
||||||
base_away_xg = max(0.25, (float(data.away_goals_avg) + float(features.get("home_xga", data.home_conceded_avg))) / 2.0)
|
base_away_xg = max(0.25, (float(data.away_goals_avg) + float(features.get("home_xga", data.home_conceded_avg))) / 2.0)
|
||||||
ms_edge = prediction.ms_home_prob - prediction.ms_away_prob
|
# ms_edge already computed above
|
||||||
total_target = max(
|
total_target = max(
|
||||||
1.4,
|
1.4,
|
||||||
min(
|
min(
|
||||||
|
|||||||
Reference in New Issue
Block a user