betting_combat.features.history
history — each fighter as of each of his fights (Sam 2026-11-13), from fighter_stats (what he did
in every round and fight) and the books’ prices (book): the blocks of the final table that look
back (final: hist, mkt, the round typicals of up / prev / sofar). Nothing here is a stored
table; final calls it.
An appearance is one fighter in one official fight (UFC, the Contender Series, Road to UFC) or in a fight to come. Everything an appearance holds is from his fights dated BEFORE it.
Windows over his earlier fights: c career; l3 the last three; e3 weights halving every three
fights; y2 weights halving every two years. A rate is a ratio of the window’s sums (never a mean
of fights’ rates), computed by fighter_stats.rates on the sums, so every stat means exactly
what it means for one round. Shrinkage: every window’s sums take PRIOR_SECS seconds of his
division’s lines before the day (its per-second rates), so every rate built on them (accuracy,
shares, margins, pace …) is pulled the same way and a debut is his division exactly. The
exposures stay (xm_ minutes, xn_ fights).
lines every rate of rates (LINE_STATS) for each window
rounds his rounds’ outcomes (judges’ share, the lines’ call, finishes for and against, 10-8s,
knockdown rounds, dominant rounds, dropped and survived …) as window means
record the fights’ outcomes (wins / losses by method, splits, first-round finishes, rounds
taken, comebacks, blown leads, deductions, distance, close fights) as window shares,
counts in his career; how his fights go inside (SHAPE)
sequence Elo before the fight, his opponents’ mean Elo and the best beaten, the streak, the
last three, the layoff, years in the UFC, times knocked out (ever, two years), days
since the last KO loss, the move in weight
adjusted his rate in each fight less what that opponent allowed before it (ADJUSTED)
styles his win share against grapplers, strikers and power punchers (each opponent typed
by his own career lines before the fight)
market against the books’ close (MARKET): beat the price (won less his chance), as
favourite and as underdog, finished / was finished / went the distance against the
books’ chances, the line’s moves and whether they were right
by round the same lines and round outcomes over his round-u rows only (round_typicals,
u = 1..5), and over his rounds 1..k (through_typicals, k = 1..4), shrunk toward
his own career rate times his division’s round-u factor; how often he reaches round u
Functions
appearances
appearances(stats: pd.DataFrame, upcoming: pd.DataFrame | None = None) -> pd.DataFrameOne row per fighter per official fight (stats’ fight rows of OFFICIAL sources) and
per fight to come (upcoming: bout_id, date, bout_order, fighter_a_id, fighter_b_id,
weight_class), in each fighter’s order: his lines summed (blank-free: no lines, zeros and
has_lines 0), the fight’s outcome from his side, upcoming 1 for a fight to come.
division_key
division_key(weight_class: pd.Series) -> pd.SeriesThe division a fight counts in: ‘W’/‘M’ and its weight; a catch or open weight ‘M0’/‘W0’.
fight_history
fight_history(stats: pd.DataFrame, upcoming: pd.DataFrame | None = None) -> pd.DataFrameEvery appearance’s fight-level history (module doc: lines, rounds, record, shape, sequence,
adjusted, styles), keyed fighter_id + bout_id, plus A’s keys.
market_history
market_history(A: pd.DataFrame, book: pd.DataFrame) -> pd.DataFrameEach appearance against the books’ close in his EARLIER fights (MARKET; c and e3):
book is features.book (A’s columns b_fighter_a_*, B’s b_fighter_b_*).
round_typicals
round_typicals(stats: pd.DataFrame, A: pd.DataFrame) -> dict[int, pd.DataFrame]Each appearance’s typical for round u (u = 1..5): his lines and round outcomes over his earlier fights’ round-u rows (c, e3), shrunk toward his career rate x the division’s round-u factor; how often he reaches round u when it is scheduled.
through_typicals
through_typicals(stats: pd.DataFrame, A: pd.DataFrame) -> dict[int, pd.DataFrame]Each appearance’s typical over rounds 1..k (k = 1..4): the same over his rounds 1..k.
window_sums
window_sums(A: pd.DataFrame, values: Sequence[str] | pd.DataFrame, windows: Sequence[str] = WINDOWS) -> dict[str, pd.DataFrame]Each appearance’s sums of values (A’s columns, or a frame row-aligned with A)
over his EARLIER appearances (A in each fighter’s order, n_before his place): career,
last three, weights halving every HALF_FIGHTS fights back (the latest weighs 1), weights
halving every HALF_DAYS days back.