betting_combat.features.assess
assess — the check every feature group goes through before anything about it is decided (Sam
2026-11-11). One row per fight: the completed fights of numbered and Fight Night cards from 2015
(SINCE, KINDS), each fighter’s features aligned to the base’s A and B (ufc.bouts
fighter_a / fighter_b).
labels one row per fight, from the base: the keys, who won, how and when it ended, the judges, A's priceround_labels one row per fight x round: the judges' verdict on the roundAssessment a feature group against what happened (``report`` writes all of it): coverage the share of fights with a value, by year distribution p10 / median / p90 and the median by year (drift shows) levels a feature that is not a number: each value's fights and what they did correlations rank correlation with every label, a 95% interval from resampling cards beyond_price rank correlation with the result net of the price, the price held fixed: both taken from their price band's mean (2026-11-07: ranking y - p itself sorts by the price inside wins and losses) redundancy the features' rank correlations and their clusters: ONC on the denoised matrix, a stat's a_ / b_ / d_ one unit, cut into substitute groups (|rho| >= 0.5), the primary's l01 rule and fight_level's f09 lopez clustered MDA of ONE LightGBM fitted on every feature plus 20 noise probes, over the purged 10-fold over cards (28-day embargo), both orientations: ``winner`` from the price (its logit the start), ``ending`` (decision / KO / submission) from the base rates; a cluster counts when its mean - 2 SE clears the probes' meanFeatures: a_x / b_x are each fighter’s, d_x (a_x - b_x) and mu_x (A on B minus B
on A) say whom they favour: the SIDE features. Any other column is the FIGHT’s (the same for
both). Side features are correlated through d_ / mu_ with each fight in both orientations (A and
B swapped, the signs with them), so the red corner’s lean is out; fight features with the fight’s
own labels.
Correlations describe the data; whether a feature earns its place is López’s (always: Sam 2026-11-07).
Classes
Assessment
rows: one row per fight, bout_id and the group’s features (aligned to the base’s A
and B); labels: labels(db). Only fights in both are assessed.
beyond_price
beyond_price() -> pd.DataFrameEach d_ / mu_ against the result net of the price (both orientations, priced fights
with a winner), the price held fixed: inside each of PRICE_BINS price bands the
feature’s rank and the result net of the price (y - p) are each left with what the price
(a line in it, the band’s own) does not explain, so neither a feature that only tracks
the price nor the price’s own bias (the favourites’ lean) shows; what is left is the rank
correlation of the two.
correlations
correlations() -> pd.DataFrameRank correlation of each d_ / mu_ with the side labels (both orientations) and of each fight feature with the fight’s labels; 95% intervals from resampling cards.
coverage
coverage() -> pd.DataFramefeature x year: the share of fights with a value.
distribution
distribution() -> pd.DataFramefeature: n, p10, median, p90, then the median of each year.
levels
levels() -> pd.DataFrameA non-numeric feature: each value’s fights and their decision / KO / submission rates, A’s win rate and A’s result net of the price (a side feature’s a_ value with b_’s).
lopez
lopez(target: str = 'winner') -> pd.DataFrameClustered MDA of one model on every feature plus the probes (_Model): per cluster its
mean and SE over the folds and kept (mean - 2 SE above the probes’ mean and above 0: a
cluster the model never used is not kept, however low the probes fall). winner:
priced fights with a winner; ending: fights ending by decision, KO or submission.
attrs: the probe bar, the model’s and the start’s (price / base rates) log loss per fold.
redundancy
redundancy() -> tuple[pd.DataFrame, dict[int, list[str]]](the rank correlation of the stats, one column each; the clusters: ONC on the denoised matrix, cut into substitute groups, each holding all of its stats’ columns).
report
report(out: Path, targets: tuple[str, ...] = ('winner', 'ending')) -> strEverything into out (coverage, distribution, levels, correlations, beyond_price,
clusters, mda_
Functions
is_side
is_side(c: str) -> boollabel_frame
label_frame(fights: pd.DataFrame, cards: pd.DataFrame, odds: pd.DataFrame) -> pd.DataFramelabels from its three reads (separate so a test can hand them in).
labels
labels(db: DBClient, schema: str = 'ufc', since: str = SINCE, kinds: tuple[str, ...] = KINDS) -> pd.DataFrameOne row per completed fight of kinds cards from since: bout_id, event_id,
event_date, year, fighter_a / fighter_b, y (1 A won, 0 B, NaN a draw or no contest), end
(dec / ko / sub, NaN otherwise), won / won_dec / won_ko / won_sub (+1 A, -1 B, 0 the other),
distance / ko / sub, end_round, fight_share (the share of the scheduled time fought),
judges_margin (the judges’ mean card for A, points), judges_rounds (the share of judge-rounds
A took minus B’s), p_mkt and p_source.
price_of
price_of(odds: pd.DataFrame, fights: pd.DataFrame) -> pd.DataFrameA’s de-vigged winner price per fight and its source: Kalshi’s card price first (its first reading of each side), else the sportsbook close (ufc_master, else sportsbook); both sides needed.
rank_corr
rank_corr(X: pd.DataFrame, Y: pd.DataFrame, cards: np.ndarray, n_boot: int = 200, seed: int = 0) -> pd.DataFrameEvery column of X against every column of Y: Spearman’s rho (Pearson on the ranks,
each pair on the rows both have), its 95% interval from n_boot card resamples (the ranks
held, the rows reweighted) and the rows it stands on.
round_labels
round_labels(db: DBClient, schema: str = 'ufc') -> pd.DataFrameOne row per fight x round the judges scored: a_share (the judges’ mean verdict for A: +1 every judge gave A the round, -1 every one gave B) and margin (the mean points for A).
stat_units
stat_units(cols: list[str]) -> dict[str, list[str]]Each stat’s columns, keyed by the one that stands for it in a correlation: a_x / b_x / d_x
together under d_x (else a_x), a mu_ or fight column on its own (f09’s stats).
swap
swap(X: pd.DataFrame) -> pd.DataFrameThe same fights with A and B swapped: a_ <-> b_, d_ / mu_ and the price’s logit negated, the fight’s columns as they are.