betting_combat.strategies.logistic
logistic — the rounds strategy’s simplest fair value (Sam 2026-11-19: the bar every other model has to beat): the chance the fight ends in this round, per 30-second block row, from the price alone.
VARIANTS 'v1' the round's starting price (x, its log-odds), where the row is in the round (its block: the break's two and the round's ten), how much of the round is gone with the price (x times the share fought), which round (1 / 2 / 3 / later, the last scheduled one, a five-rounder). No block prices. 'v2' v1 + the finish market's price at the block's end and what it has done (features.price_features: its middle as log-odds and against the start, its spread, its change since the bell / the block before / three blocks before, the round's range, its last changes' spread). Only rows with a quote (a row without one cannot be traded); a change with nothing before it: 0.design the inputs of a variant from the strategy's rows (RoundsStrategy.read_rows) - the same columns whatever the rows' prices are (real or simulated)Logistic fit (the scaling from the rows it is given, never others) / p_ends; to_json / from_jsoncross_fit_cards purged: each card's rows predicted by a fit on every OTHER card's rowsscore how good a prediction is (log loss, calibration through the round), with the market's own price beside itThe output is the model’s own prediction for each row - nothing else is taken from the fit.
Classes
Logistic
One fit of a variant: the inputs standardised on the rows fitted (dummies too), a ridge-penalised logistic.
fit
fit(rows: pd.DataFrame) -> LogisticOn rows with a label (y) the variant can price.
fit_matrix
fit_matrix(X: np.ndarray, y: np.ndarray, cols: list[str]) -> Logisticfrom_json
from_json(b: dict[str, Any]) -> Logisticp_ends
p_ends(rows: pd.DataFrame) -> np.ndarrayThe chance the fight ends in this round, per row (blank where the variant cannot price the row).
predict_matrix
predict_matrix(X: np.ndarray) -> np.ndarrayto_json
to_json() -> dict[str, Any]Functions
cross_fit_cards
cross_fit_cards(rows: pd.DataFrame, variant: str, cards: list[str] | None = None, c: float = 10.0, n_jobs: int = 1) -> pd.SeriesPURGED, one card at a time: each of cards (None: every card) has its rows predicted by a fit on every OTHER
card’s labelled rows. Returns p_ends on rows’ index (blank: a card not asked for, a row the variant cannot price).
design
design(rows: pd.DataFrame, variant: str) -> pd.DataFrameThe variant’s inputs (module doc), one row per row of rows (its index); blank where the row is not usable.
score
score(rows: pd.DataFrame, p: Any, others: dict[str, Any] | None = None) -> dict[str, Any]p (a chance the fight ends this round, per row) against what happened, on the rows with p and a label: rows,
fights, cards, the finish rate, the mean prediction, the log loss; others: more predictions scored on the same rows
(each also only where it has a value: <name>_ll, <name>_rows). The market’s own price is one of them where given.
usable
usable(rows: pd.DataFrame, variant: str) -> np.ndarrayThe rows a variant can price: a starting price; ‘v2’ also a finish-market quote at the block’s end.