betting_combat.rounds.models.meta
The meta model (López’s meta-labelling, Sam 2026-10-27): one row per bet (backtest.labeler:
a break x strategy x contract, the round’s adds folded in), label 1 if the bet’s contract paid. The
primary (models.primary) picks the bets; the meta gives each bet its own probability. It never
changes the executions: a strategy only uses the probability to drop a bet or to scale it.
final ``MetaModel`` - LightGBM stumps (``TREE_META``: 2 leaves, 50 trees, bagged over 3 seeds) correcting the primary's chance of the bet (its log-odds the start), on ``INPUTS`` (11: the bet's own price vs the primary, the same event priced in the fight's other markets vs the primary, the bet's own price move over 3 minutes and over the round, its volatility, the two engines' gap, the strategy / contract flags), trained on ``STRATEGIES`` (distance, no KO: on rounds it did not beat the primary), each row weighted by its uniquenessuse distance: ``MetaModel.take`` - a bet whose probability is not above its all-in price is not taken (not at the break, not in its round); no KO: ``MetaModel.size`` - the execution's size x Lopez's size of the probability over its average (AFML 10.1); rounds: nonehonest 2026-10-27, purged over whole cards with every choice inside the outer split: log loss -3.6% vs the primary (distance -4.8%, no KO -0.4%); research data/ufc/cito/assess/meta2data prep ``features``: every candidate input of a row as of its decision (numbers and bool flags, in named blocks) - the selection's poolClasses
MetaModel
LightGBM on the inputs, correcting the start (the primary’s chance of the bet: its
log-odds the initial score); rows weighted (uniqueness); one tree model per seed, their
probabilities averaged. features None / empty: the start alone. size_norm: the
average Lopez size of the no-KO bets it was fitted on (size).
fit
fit(X: pd.DataFrame, y: np.ndarray, w: np.ndarray, start: np.ndarray) -> MetaModelpredict
predict(X: pd.DataFrame, start: np.ndarray) -> np.ndarrayEach row’s probability that its bet pays.
refit
refit(X: pd.DataFrame, y: np.ndarray, w: np.ndarray, start: np.ndarray, event_date: pd.Series, before: Any = None, features: list[str] | None = None) -> MetaModelThe live refit: fitted on every row dated before before (None: every row) - what
the card dated before trades on.
size
size(p: Any) -> np.ndarrayNo KO: the execution’s size x this factor - Lopez’s size of the probability (AFML 10.1: 2 N(z) - 1, nothing at or below one half) over its average on the fitted bets.
take
take(p: Any, price: Any) -> np.ndarrayDistance: the bet is taken only when its probability is above its all-in price.
walk_forward
walk_forward(X: pd.DataFrame, y: np.ndarray, w: np.ndarray, start: np.ndarray, event_date: pd.Series, cards: Sequence[Any]) -> Iterator[tuple[Any, MetaModel]]Each card with the meta refitted on every row before it (refit), one at a time.
Functions
card_splits
card_splits(event_date: pd.Series, n_groups: int = 8, embargo_cards: int = 4) -> Iterator[tuple[np.ndarray, np.ndarray]](train, test) row positions: the cards in n_groups contiguous groups, each held out in
turn; the embargo_cards cards after a held-out group dropped from training (inputs looking
back over earlier cards).
event_chance
event_chance(oos: pd.DataFrame, tag: str, inst: pd.Series) -> np.ndarrayThe bet’s chance from one engine of the primary (‘primary’, ‘lgbm’, ‘bayes’): rounds NO = no finish this round; distance YES / the pair = a decision; distance NO = not; KO NO = not by KO.
features
features(rows: pd.DataFrame, dataset: pd.DataFrame, oos: pd.DataFrame, minutes: pd.DataFrame, bells: pd.DataFrame, bouts: pd.DataFrame, referees: pd.DataFrame, fighter_inputs: Sequence[str], layer1_today: pd.DataFrame | None = None) -> tuple[pd.DataFrame, dict[str, list[str]]]Every row’s inputs (row_id + numbers / bool flags) and their blocks.
rows backtest.labeler rows (row_id, fight_id, round_idx, event_date, strategy, inst, t, p,
ask, bid, c, held, held_basis, last)
dataset the primary’s rows (Dataset 1 v2: round stats, matchup, priors, card, venue)
oos the primary’s purged out-of-sample chances (lgbm_ / bayes_ / primary_)
minutes the Kalshi minute bars (_kalshi: oriented to the bet, bars up to the decision);
bells: the market’s bells per fight (fight_id, bell_1..); bouts: every bout (event,
card position, method); referees: fight_id, referee
fighter_inputs the primary’s matchup inputs (its A-B / A+B / style columns)
layer1_today today’s layer 1 chances, purged out of sample (fight_id, round_idx, chances)
Every other numeric column of dataset (fighters’ own A / B numbers, the decayed rates, the
divisions, the fight’s context) goes in too: nothing it has is left out.
inputs
inputs(rows: pd.DataFrame, oos: pd.DataFrame, minutes: pd.DataFrame, bells: pd.DataFrame) -> pd.DataFrameThe final model’s INPUTS for rows (row_id, fight_id, round_idx, strategy, inst, t)
as of each row’s decision: the bet’s own price vs the primary, the same event in the other
markets vs the primary, the bet’s own price moves and volatility (_kalshi), the engines’
gap (oos: the primary’s chances per engine, primary_ / lgbm_ / bayes_) and the
flags. features builds the same columns among every candidate input.
logit
logit(p: Any) -> np.ndarrayoos
oos(features_: list[str] | None, X: pd.DataFrame, y: np.ndarray, w: np.ndarray, start: np.ndarray, event_date: pd.Series, seeds: Sequence[int] = (0, 1, 2), tree: dict[str, Any] | None = None, **split: Any) -> np.ndarrayEvery row’s held-out probability (card_splits).
wlogloss
wlogloss(y: np.ndarray, p: np.ndarray, w: np.ndarray) -> float