Files
iddaai-be/scripts/test_surprise_detection.py
T
fahricansecer 2f0b85a0c7
Deploy Iddaai Backend / build-and-deploy (push) Failing after 18s
first (part 2: other directories)
2026-04-16 15:11:25 +03:00

59 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Test surprise detection on known surprise matches."""
import sys
sys.path.insert(0, 'ai-engine')
from services.single_match_orchestrator import SingleMatchOrchestrator
import json
# Test Bayern vs Augsburg (24 Jan 2026) - 1/2 Reversal
match_id = 'en78ih6ec7exnpxcku3xc3das'
orch = SingleMatchOrchestrator()
result = orch.analyze_match(match_id)
if result:
print('=== Bayern Munch vs Augsburg (24 Jan 2026) ===')
print('Actual: HT 1-0, FT 1-2 (1/2 Reversal!)')
print()
# Check risk
risk = result.get('risk', {})
print(f"Risk Level: {risk.get('level', 'N/A')}")
print(f"Is Surprise Risk: {risk.get('is_surprise_risk', False)}")
print(f"Surprise Type: {risk.get('surprise_type', 'N/A')}")
print(f"Risk Score: {risk.get('score', 'N/A')}")
print()
# Check HT/FT probabilities from market_board
htft = result.get('market_board', {}).get('HTFT', {}).get('probs', {})
print('HT/FT Probabilities:')
if htft:
for k, v in sorted(htft.items(), key=lambda x: x[1], reverse=True):
print(f" {k}: {v*100:.1f}%")
else:
print(" EMPTY!")
print()
# Check main pick
main = result.get('main_pick', {})
print(f"Main Pick: {main.get('market', 'N/A')} - {main.get('pick', 'N/A')}")
print(f"Confidence: {main.get('calibrated_confidence', 'N/A')}%")
print(f"Is Guaranteed: {main.get('is_guaranteed', False)}")
print()
# Check aggressive pick
agg = result.get('aggressive_pick', {})
if agg:
print(f"Aggressive Pick: {agg.get('market', 'N/A')} - {agg.get('pick', 'N/A')}")
print(f"Odds: {agg.get('odds', 'N/A')}")
print()
# Check bet_summary for HTFT
bet_summary = result.get('bet_summary', [])
for bet in bet_summary:
if bet.get('market') == 'HTFT':
print(f"HTFT Bet: {bet}")
else:
print('Match not found')