agentleFS
WalrusQuantWalrusQuant/sports-analytic-skills/skills/baseline-models/SKILL.md

baseline-models

Skill54 starsChanged 7 days agoMITView on GitHub

Design and evaluate simple sports prediction baselines before accepting more complex models. Use for constant-rate, home-advantage, logistic, Elo-style, or market-reference comparisons.

  • Installs packages

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a fancy model cannot beat simple baselines under time-safe validation, it is not progress.

    line 13
  2. Distinctive:

    Do not skip this skill and jump to trees.

    line 32
  3. Distinctive:

    Read Parquet with pandas or DuckDB.

    line 52
  4. Distinctive:

    Read references/baseline_ladder.md when selecting the minimum credible ladder and promotion rule.

    line 69
  5. Very specific:

    Create walk-forward folds (validation-design).

    line 79
  6. Very specific:

    Only then try ML (predictive-modeling).

    line 84
  7. Distinctive:

    Keep the simplest model that wins.

    line 85
  8. Distinctive:

    Use a pre-event rating-difference column supplied in the modeling table and evaluate it on the same rows and folds as the other baselines.

    line 156
  9. Distinctive:

    If trees barely beat logistic, prefer logistic

    line 166
  10. Distinctive:

    No predictive project without Tier A.

    line 181
  11. Distinctive:

    Do not hide folds where baseline wins.

    line 183

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Baseline Models for Sports

Overview

If a fancy model cannot beat simple baselines under time-safe validation, it is not progress.

This skill defines the baseline ladder and standardizes matched, chronological comparison before ML.

Baselines are not disposable. Often they are the ship candidate.


When to Use This Skill

Use when:

  • Starting a predictive sports project
  • Auditing an ML result that looks shiny
  • Building the first model you might actually keep
  • User says “what’s the baseline?” or “does this beat home field?”
  • Comparing form vs Elo vs constant on NFL/NBA/MLB

Do not skip this skill and jump to trees.

NeedGo instead
Validation foldsvalidation-design
Featuresfeature-rules
ML candidates after baselinespredictive-modeling
GLM inference writeupstatistical-modeling
Ratings baseline detailratings-strength-models

Installation

Fit baselines in the user's environment. A binary comparison needs pandas, NumPy, and scikit-learn:

python -m pip install pandas numpy scikit-learn pyarrow

Read Parquet with pandas or DuckDB. This repository does not ship the fitting code.


Baseline Ladder

TierBaselineImplemented here
AConstant training-fold win rate / mean targetrequired
BHome-only rate or mean home margindescriptive, then fold-local if used as a forecast
CLogistic/linear on home + legal form differentialsfit inside each training fold
DRating differential logistic/linearratings-strength-models or a supplied as-of rating column

Climb to ML only after Tier A–C (or A–D) exist under walk-forward evaluation.

Fit Tier A and Tier C on the same rows. A home-only rate is a pooled description until it is scored on the same chronological folds. Elo, a user-supplied market probability, and other ladder entries need their own matched prediction column.

Read references/baseline_ladder.md when selecting the minimum credible ladder and promotion rule. Read references/interpretation.md when deciding whether a candidate's delta is stable and practically meaningful.


Workflow

  1. Define target + primary metric.
  2. Build legal features (feature-rules).
  3. Create walk-forward folds (validation-design).
  4. Fit Tier A constant baseline each fold.
  5. Fit Tier C logistic/linear baseline each fold.
  6. Optional: rating-difference or market-reference baseline.
  7. Compare per-fold and mean metrics.
  8. Only then try ML (predictive-modeling).
  9. Keep the simplest model that wins.
  10. Log the experiment.

Run Baselines

Work from a user-owned table, usually a sportsleader-data Parquet file chosen with data-sources, and use identical rows, folds, target, and scoring rules for every candidate.

Score a training-rate constant and a regularized logistic baseline on expanding chronological folds. Record the modeling contract, validation design, model names, per-fold metrics, means, and complete-case row accounting. Do not impute inside the baseline comparison: rows missing the target, split, or any named feature are excluded from both candidates and counted.

Minimum training groups default to 2. With seasons [2022, 2023, 2024], only 2024 is tested (train on 2022+2023). Use one training group when 2023 should also be a test fold. Print the planned test folds before scoring.

The prediction table should keep identifiers, split/fold, y_true, constant_probability, logistic_probability, and p_pred (the logistic probability, for calibration-check).

A home-only summary can report group rates and a continuity-corrected odds ratio with a Wald interval. Treat that as pooled descriptive inference unless the same home indicator is scored inside the chronological folds. It does not by itself establish predictive generalization.

panel is the team-game panel from data-sources. Score each fold with log loss and Brier score, and keep the prediction rows calibration-check reads.

import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import brier_score_loss, log_loss

df = panel.dropna(subset=["won", "season", "is_home"]).copy()
df["is_home"] = df["is_home"].astype(int)
df["won"] = df["won"].astype(int)
fold_rows, pred_rows = [], []
for season in sorted(df["season"].unique())[2:]:
    train = df[df["season"] < season]
    test = df[df["season"] == season]
    constant = float(train["won"].mean())
    model = LogisticRegression(max_iter=500)
    model.fit(train[["is_home"]], train["won"])
    y = test["won"].to_numpy()
    p_const = [constant] * len(test)
    p_model = model.predict_proba(test[["is_home"]])[:, 1]
    fold_rows.append({
        "season": int(season),
        "n": len(test),
        "log_loss_constant": log_loss(y, p_const),
        "log_loss_home": log_loss(y, p_model),
        "brier_constant": brier_score_loss(y, p_const),
        "brier_home": brier_score_loss(y, p_model),
    })
    part = test[["game_id", "team", "season"]].copy()
    part["y_true"] = y
    part["constant_probability"] = p_const
    part["logistic_probability"] = p_model
    part["p_pred"] = p_model
    pred_rows.append(part)
print(pd.DataFrame(fold_rows))
predictions = pd.concat(pred_rows, ignore_index=True)

Tier Details

Tier A — Constant rate

The constant baseline predicts the training-fold mean of the target for every test row. On balanced team-game panels this is near 0.5 and log-loss near ~0.693.

Tier B — Home only

Report the home-row win rate or the mean home margin. When that rate is used as a forecast, score a home indicator on the same walk-forward folds as Tier A. A pooled rate is a description, not a held-out result.

Tier C — Form logistic

Uses a small declared set of legal pre-event form differentials.

Tier D — Rating differential

Use a pre-event rating-difference column supplied in the modeling table and evaluate it on the same rows and folds as the other baselines.


What “Good” Looks Like

  • Logistic log-loss < constant on most folds
  • Coefficients point the right way (home effect positive in log-odds)
  • Gains are not from one freak season only
  • If trees barely beat logistic, prefer logistic

Decision table

ResultAction
C beats A on most foldsstrong baseline; ML must beat C
C fails to beat Adebug features/leakage before ML
D beats Cconsider ratings as primary features
ML ≈ Cship C

Hard Constraints

  1. No predictive project without Tier A.
  2. Walk-forward only for claims of generalization.
  3. Do not hide folds where baseline wins.
  4. Simplest winning model is the default ship candidate.
  5. Cross-sport claims require sport-specific evaluation; do not assume transportability.

Anti-Patterns

  • Jumping to GBM with no constant baseline
  • Reporting accuracy without log-loss/MAE
  • One-season hero baselines
  • Calling home-rate on the full doubled panel “home advantage”
  • Hiding folds where ML loses to logistic

Reporting Template

Baseline report
Sport/target/T:
Features:
Validation: season walk-forward
Tier A mean metric:
Tier C mean metric:
Tier D mean metric (if any):
Per-season table:
Decision: promote to ML | keep logistic | debug features
Reproduce:

Output Contract

Done means:

  • Tier A present
  • At least one stronger baseline (B/C/D) present
  • Walk-forward comparison table present
  • Decision stated
  • Repro commands present

References

references/

FileContents
baseline_ladder.mdladder and promotion rules
interpretation.mdhow to read baseline comparisons

Related Skills

NeedSkill
Featuresfeature-rules
Validationvalidation-design
MLpredictive-modeling
GLM writeupstatistical-modeling
Ratingsratings-strength-models
Calibrationcalibration-check

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.