Spaces:
Sleeping
Sleeping
Update models/pitch_model.py
Browse files63 unmodified lines64656667686963 unmodified lines"ball_in_play_prob": float(min(1.0, ball_in_play_prob)),}def pitcher_baseline_from_events(df: pd.DataFrame) -> dict[str, float]:if df.empty:63 unmodified lines6465666768697071727374757677787980818283848586878889909163 unmodified lines"ball_in_play_prob": float(min(1.0, ball_in_play_prob)),}def blend_pitch_outcome_probabilities(baseline_probs: dict[str, float],live_probs: dict[str, float],baseline_weight: float,live_weight: float,) -> dict[str, float]:"""Blend baseline and live pitch-outcome probabilities at the probability layer.This is stronger than only blending raw inputs."""keys = ["strike_prob", "whiff_prob", "damage_prob", "ball_in_play_prob"]out: dict[str, float] = {}for key in keys:base_val = float(baseline_probs.get(key, 0.0) or 0.0)live_val = float(live_probs.get(key, base_val) or base_val)blended = (base_val * baseline_weight) + (live_val * live_weight)out[key] = float(max(0.0, min(1.0, blended)))return outdef pitcher_baseline_from_events(df: pd.DataFrame) -> dict[str, float]:if df.empty:
models/pitch_model.py+22