Skip to content

betting_combat.strategies.inputs

inputs — which inputs a strategy’s model uses, López’s way (Sam 2026-11-16; shared by every strategy). The steps, each its own method:

near_copies of any pair correlated |rho| >= ``max_corr`` keep one (a fixed order of blocks: the round just fought first);
no outcome used
clusters López's ONC (MLAM ch. 4) on the denoised correlation of what is left: k-means over a grid of k scored by the
silhouette's mean / std, the low-quality clusters re-clustered; then any cluster over ``cap`` inputs clustered
again on its own RAW correlation (the denoised one is flat inside a big cluster), and what still cannot be split
(a loose remainder) split by concept (block + stat word)
importance clustered MDA (MLAM ch. 6, ``ml.importance.clustered_mda``) with 20 random probe inputs as their own cluster,
over whole cards in time with the same fighters' fights within ``embargo_days`` purged (AFML ch. 7)
keep a cluster whose mean - 2 SE beats max(the probe cluster's, 0)

InputSelector.fit runs them on the rows given and keeps the result (clusters, kept) for saving with the model; a strategy’s research checks it nested (the selection inside each outer fold’s training cards). Built on the research of 2026-11-15/16 (data/ufc/cito/assess/final_v1: r12 nested, r15 finer, r16 variants).

Classes

InputSelector

López’s input selection (module doc). After fit: clusters (every cluster) and kept (the kept clusters).

cluster

cluster(X: pd.DataFrame) -> dict[int, list[str]]

fit

fit(X: pd.DataFrame, y: np.ndarray, rows: pd.DataFrame, base: np.ndarray | None = None, log: Callable[[str], None] | None = None) -> InputSelector

from_json

from_json(b: dict[str, Any]) -> InputSelector

keep

keep(imp: pd.DataFrame, clusters: dict[int, list[str]]) -> dict[int, list[str]]

mda

mda(X: pd.DataFrame, y: np.ndarray, rows: pd.DataFrame, clusters: dict[int, list[str]], base: np.ndarray | None = None, k: int | None = None) -> pd.DataFrame

Clustered MDA with the probe cluster, over purged card folds; base a starting log-odds (None: structural).

near_copies

near_copies(X: pd.DataFrame) -> list[str]

to_json

to_json() -> dict[str, Any]

Functions

card_folds

card_folds(rows: pd.DataFrame, k: int, embargo_days: int = 28) -> list[tuple[np.ndarray, np.ndarray]]

Whole cards in time cut into k blocks; a training row is purged when one of its fighters fights in the test block within embargo_days of it. rows: event_id, date, fighter_a_id, fighter_b_id (positional).