Skip to content

betting_combat.features.rows

rows — the feature tables joined into the model’s rows (the combine): each fight joins each fighter’s latest row dated before its day, the rates pulled toward the division’s, the join-time features (layoffs, moves) and the two forms (Sam 2026-11-11):

division_priors each division's rates (``RATES``) from its fights before each day: the
shrinkage's target, and the fight table's priors
prefight one row per fight: a_ / b_ (each fighter's) and d_ (A less B) of every
fighter column, the matchups (mu_), the Elo's win chance; a debut joins
nothing and takes the division's; with the career table, his record
outside since his debut, what of it came after his last UFC fight, the
layoff counting any fight, and (with the profile) his whole pro record

Fill (Sam 2026-11-11: “fill everything”): no blank reaches a row. A debut’s layoff is the days since his last pro fight (Cito’s careers), drawn from a debut’s of the same era where Cito does not tell it (one of the debuts in the five years before the day, the same draw however much history follows; whether Cito tells it leans to those who lasted: career’s presence note); “days since” a thing that never happened (a KO loss, a fight outside) is his career’s length; every other blank (a share of nothing: KO losses by kick with no KO loss, the judges of a man never judged, a debut’s numbers the shrinkage does not reach) is the division’s mean of that column over the fights before the day (the league’s where the division has none). Pass the history (every fight before the rows wanted), so the first rows have fights before them to take a mean from.

Shrinkage: a window’s rate x over exposure X (its denominator’s sum) becomes (x X + k p) / (X + k), p the division’s rate before the day, k EXPOSURE_K of the denominator’s units (a fight’s 15 minutes, 100 strikes attempted, 10 takedowns tried): a three-fight record says less than a fifteen-fight one, and a debut says the division.

Functions

division_priors

division_priors(A: pd.DataFrame) -> pd.DataFrame

One row per division per day it fought: each rate of RATES over the division’s official lines before that day (the league’s for a division with none yet).

lbs

lbs(weight_class: pd.Series) -> pd.Series

prefight

prefight(fights: pd.DataFrame, table: pd.DataFrame, A: pd.DataFrame, profile: pd.DataFrame | None = None, career: pd.DataFrame | None = None) -> pd.DataFrame

One row per fight of fights (bout_id, date, fighter_a, fighter_b, weight_class, country): a_ / b_ / d_ of every fighter column (with profile, his profile too; with career, his record outside since his debut, and with both his whole pro record), the matchups (mu_), the Elo’s log-odds for A (mu_elo), every blank filled (the module’s Fill: pass the history); A: fighter.appearances (the division priors).

spreads

spreads(a: pd.DataFrame, b: pd.DataFrame, cols: list[str]) -> pd.DataFrame

A less B of cols.