gg2
Deploy Iddaai Backend / build-and-deploy (push) Successful in 35s

This commit is contained in:
2026-05-29 13:35:17 +03:00
parent b5cb412236
commit 671979b07d
3 changed files with 648 additions and 1 deletions
@@ -56,7 +56,7 @@ from services.match_commentary import generate_match_commentary
from utils.top_leagues import load_top_league_ids
from utils.league_reliability import load_league_reliability
from config.config_loader import build_threshold_dict, get_threshold_default
from models.calibration import get_calibrator
from models.calibration import get_calibrator, get_final_recalibrator
# ── V30: Post-calibration trust factors ─────────────────────────────
# Controls how much to trust isotonic calibrator vs raw model output.
@@ -1153,6 +1153,18 @@ class MarketBoardMixin:
# overconfidence without destroying probability signal.
# The tier system (V31b) is the real profitability gatekeeper.
calibrated_conf = max(1.0, min(99.0, raw_conf * 0.92))
# ── FINAL-OUTPUT RECALIBRATION (V31e) ──────────────────────────
# Last-step per-market map: "system says X% -> reality is Y%". ONLY
# badly-miscalibrated markets carry a map (fit-ECE >= 5: OU15, OU35,
# HT_OU05, HT_OU15). MS and every already-good market pass through
# UNCHANGED -> guaranteed no regression. Out-of-sample proven (e.g.
# HT_OU15 ECE 29.2->0.8) and identity-safe for MS (1.1->1.3).
# This adjusts ONLY the displayed confidence so users see honest
# probabilities; all analysis below (probabilities, edges, vetoes,
# tiers, bands) is preserved, and the pre-recal value is kept for audit.
pre_recal_conf = calibrated_conf
calibrated_conf = get_final_recalibrator().recalibrate_conf(market, calibrated_conf)
min_conf = self.market_min_conf.get(market, 55.0)
implied_prob = (1.0 / odd) if odd > 1.0 else 0.0
@@ -1361,6 +1373,7 @@ class MarketBoardMixin:
{
"raw_confidence": round(raw_conf, 1),
"calibrated_confidence": round(calibrated_conf, 1),
"calibrated_confidence_pre_recal": round(pre_recal_conf, 1),
"unified_score": round(bgs, 1),
"unified_score_label": bgs_label,
"min_required_confidence": round(min_conf, 1),