Skip to content

betting_combat.features.inplay

inplay — the fight so far at each break (Sam 2026-11-13): the final table’s prev_ (the round just fought) and sofar_ (rounds 1..k) blocks, from a fight’s round lines. ONE function for the training rows and for the card run: in training the official lines mapped to what live shows at the bell (LiveView), live Cito’s lines as they come; either way the same columns.

A break k (1..) is the minute after round k. Its round k is as live sees it at the bell (mapped); rounds 1..k-1 exact (fixed by then). Break 0 has no rows here (final writes its zeros).

Per fighter (a our fighter A, b B), from the lines (LINE_SUMS) through fighter_stats.rates: prev_{a,b}{stat} round k’s every rate, and the round’s call (lines_p: the chance a judge gives him the round from its lines), 10-8 chance, a knockdown round sofar{a,b}{stat} rounds 1..k summed, every rate, rounds taken by the lines’ call (expected), the lines’ margin, knockdowns sofar{a,b}mom{s} round k’s rate less rounds 1..k-1’s (momentum; 0 at break 1) The spreads and the comparisons with each fighter’s typicals are final’s (it holds the history): prev_d_, prev_vs_typ_, prev_vs_opp_, sofar_d_, sofar_vs_typ_, sofar_vs_opp_.

LiveView: per line, a map from the official count of the round just fought to the live one at the bell + delay_s (identity, a ratio or a linear map with the round’s significant attempts), chosen leave-one-card-out on the recorded live cards (fit; the default LIVE_VIEW_1113).

Classes

LiveView

Official round counts -> what live shows at the bell + delay_s (module doc).

apply

apply(D: pd.DataFrame) -> pd.DataFrame

D’s counts (his and opp_) as live shows them; secs, control and neutral recomputed.

fit

fit(live: pd.DataFrame, official: pd.DataFrame, delay_s: float, card: str = 'card', margin: float = 0.05) -> tuple[LiveView, pd.DataFrame]

Per line: identity, ratio (sum live / sum official) or linear (live ~ a + b x official + g x official sig attempts), whichever has the lowest leave-one-card-out mean absolute error (identity unless another beats it by margin). live and official are fighter-round rows keyed alike with the lines as columns and card; returns the view and the CV table.

load

load(path: Path) -> LiveView

save

save(path: Path) -> None

Functions

breaks

breaks(rounds: pd.DataFrame, fights: pd.DataFrame, view: LiveView | None = None) -> pd.DataFrame

The prev_ and sofar_ columns of every break k >= 1 of fights (bout_id, fighter_a_id, fighter_b_id, end_round): rounds is fighter_stats’ round rows (official: counts both ways, secs, lines_p, lines_10_8) or the live lines in the same columns. One row per bout per break, keyed bout_id + brk.