Spaces:
Running
Running
| from __future__ import annotations | |
| def win_probability(score_diff: int, inning: int, is_home_batting: bool) -> float: | |
| """ | |
| Simple explainable baseline for live WP. | |
| """ | |
| base = 0.50 + (score_diff * 0.065) | |
| inning_pressure = min(0.20, max(0.0, (inning - 1) * 0.02)) | |
| home_edge = 0.015 if is_home_batting else -0.015 | |
| wp = base + inning_pressure + home_edge | |
| return max(0.01, min(0.99, wp)) |