predictive-modeling
Skill54 starsChanged 6 days agoMITView on GitHub
Build and evaluate predictive sports models from user-provided modeling data. Use for binary outcome models, feature/model selection, chronological backtests, probability scoring, and comparison to baselines.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- lancegui/causal-powerstheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- lancegui/causal-powers★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- anti-slop-analyticsSkill
- baseline-modelsSkill
- calibration-checkSkill
- data-sourcesSkill
- eda-sportsSkill
- environment-setupSkill
- experiment-logSkill
- feature-rulesSkill
- leakage-auditSkill
- model-cardSkill
- model-interpretationSkill
- ratings-strength-modelsSkill
- results-reportingSkill
- simulation-sportsSkill
- sports-modeling-doctrineSkill
- sports-visualizationSkill
- statistical-modelingSkill
- time-series-sportsSkill
- validation-designSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 21 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
keep/reject rules for a predictive candidate
- Distinctive: line 37
Use this skill when:
- Distinctive: line 45
Do not use this skill as a substitute for:
- Distinctive: line 66
Read the user's CSV, Parquet, or JSON table.
- Very specific: line 80
Confirm features are legal at T: If that is unproven, run leakage-audit rather than fitting.
- Very specific: line 84
Fit one candidate ML model per fold: only if baselines exist. Default tree: HistGradientBoostingClassifier / regressor.
- Very specific: line 85
Default tree: HistGradientBoostingClassifier / regressor.
- Distinctive: line 93
Read model_ladder.md before adding model complexity, metrics.md before locking the primary score, walk_forward.md when applying the frozen …
- Distinctive: line 120
no unresolved leakage flags
- Distinctive: line 122
If trees lose to logistic, keep logistic.
- Distinctive: line 182
never fit scalers/encoders on train+test together
- Distinctive: line 183
never early-stop on the true test fold
- Distinctive: line 192
Before fitting, define the target, row grain, decision time, eligible population, chronological split unit, primary metric, practical …
- Distinctive: line 273
If the regularized model does not beat the constant, stop and examine grain, feature timing, target quality, drift, and data coverage …
- Distinctive: line 279
Default first: Use package defaults / modest trees before search.
- Distinctive: line 282
One locked config for final fold metrics: Do not refit after seeing the answer.
- Distinctive: line 295
No final-season aggregates applied backward onto early weeks.
- Distinctive: line 296
No opponent “season stats” that include the current matchup.
- Distinctive: line 297
No target encoding fit on the full shuffled dataset.
- Distinctive: line 298
No scaler/imputer fit on train+test together.
- Distinctive: line 299
If a feature needs same-game information, the task is no longer pre-game — redefine T.
- Distinctive: line 311
no single season carries the entire claim
- Distinctive: line 374
Do not drop ugly seasons after seeing scores.
- Distinctive: line 375
Do not tune on the final test season.
≈ “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.
Files
Predictive Modeling for Sports
Overview
This skill's job is to fit and compare predictive candidates on a user-owned modeling table under a locked chronological evaluation.
It is not the project charter, data acquisition, the EDA, the feature-legality review, or the results report. Those are other skills. Start here only after the question, decision time T, legal features, and walk-forward design exist.
Goal: a candidate that beats honest baselines under walk-forward evaluation, with the primary metric locked before peeking at test folds.
This skill owns:
- the model ladder (when complexity is allowed)
- metrics by task
- the fold-local fitting loop and the candidate comparison
- keep/reject rules for a predictive candidate
Validation design details live in validation-design. Leakage verdicts live in
leakage-audit. Probability reliability lives in calibration-check.
When to Use This Skill
Use this skill when:
- Forecasting game winners, margins, or score-derived targets
- Building player/team prediction models from historical panels
- Comparing ML models against logistic/rating baselines
- Setting up season-based walk-forward training
- User says “build a model,” “predict winners,” or “does ML help here?”
Do not use this skill as a substitute for:
| Need | Go to instead |
| Data not loaded yet | data-sources, then return with a user-owned sportsleader-data table |
| No EDA yet | eda-sports |
| Explanatory inference / GLM writeup | statistical-modeling |
| Feature legality unsure | feature-rules then leakage-audit |
| Only ratings as the model | ratings-strength-models |
| Probability reliability deep-dive | calibration-check |
Installation
Fit candidates in the user's environment:
python -m pip install pandas numpy scikit-learn pyarrowRead the user's CSV, Parquet, or JSON table. This repository does not ship a fold runner.
Analysis Workflow
This skill assumes a user-owned modeling table and a written charter. If those
are missing, stop and use sports-modeling-doctrine, data-sources, eda-sports,
feature-rules, and validation-design first.
On the prepared table:
- Confirm the locked contract. Target, grain, T, primary metric, fold unit, and eligible population must already be written down.
- Confirm features are legal at T. If that is unproven, run
leakage-auditrather than fitting. - Fit baselines on each frozen fold (
baseline-models). Constant / mean, then home or rating, then a simple legal-feature model. - Fit one candidate ML model per fold only if baselines exist.
Default tree:
HistGradientBoostingClassifier/ regressor. - Aggregate metrics across folds. Mean, per-season table, and how many folds beat the baseline.
- Hand off. Calibration →
calibration-check. Slices/misses →model-interpretation. Narrative →results-reporting.
Skipping baselines or using random K-fold on seasons is a failed analysis.
Read model_ladder.md before adding model complexity,
metrics.md before locking the primary score,
walk_forward.md when applying the frozen folds, and
leakage_rules.md as a fitting-time checklist — not
as a substitute for leakage-audit.
Model Ladder
Climb only when the previous rung is beaten on the primary walk-forward metric on multiple folds — not one lucky season.
| Rung | Model | Role |
| 0 | Constant rate / mean target | sanity floor |
| 1 | Home-only or simple rating differential | domain baseline |
| 2 | Logistic / linear on engineered form features | strong classical |
| 3 | HistGradientBoosting / other tabular trees | nonlinear ML |
| 4 | Deeper nets / specialized architectures | only with lots of data + clear gain |
Implement the constant, regularized logistic, and histogram-gradient rungs on the team-game panel from data-sources. Regression, ranking, and neural-network choices stay in the metric and model sections above; do not add a rung that the walk-forward table did not beat.
Promotion rule:
- mean primary metric improves vs previous best and
- improvement appears on a majority of folds and
- no unresolved leakage flags
If trees lose to logistic, keep logistic. Complexity is not a virtue.
Metrics
Lock the primary metric before fitting candidates.
Probability / classification (wins, binary events)
| Priority | Metric | Notes |
| Primary | log-loss | proper scoring rule; default |
| Secondary | Brier score | interpretable MSE of probs |
| Secondary | calibration (ECE / curve) | required before quoting percents |
| Tertiary | accuracy | base-rate sensitive; never alone |
Regression (margins, counts-as-continuous)
| Priority | Metric | Notes |
| Primary | MAE | robust headline |
| Secondary | RMSE | penalizes blowups |
| Secondary | bias | systematic over/under by season |
Ranking tasks
- Spearman / pairwise accuracy on a true holdout period
- Still prefer a proper scoring rule if probabilities exist
See references/metrics.md.
Validation Protocol (default)
Use season walk-forward:
train 2021–2022 → test 2023
train 2021–2023 → test 2024
...Represent folds explicitly in the modeling artifact:
fold 1: train groups < 2023 → test 2023
fold 2: train groups < 2024 → test 2024
fold 3: train groups < 2025 → test 2025The split group may be season, date block, event sequence, or another predeclared chronological unit. The essential property is that every training row precedes its test rows.
Rules:
- train max season
<test season - tune hyperparameters inside training data only (nested or fixed a priori)
- never fit scalers/encoders on train+test together
- never early-stop on the true test fold
- report per-fold and mean metrics
Details: validation-design, references/walk_forward.md.
Binary model comparison
Before fitting, define the target, row grain, decision time, eligible population, chronological split unit, primary metric, practical success threshold, baseline ladder, and required prediction artifact.
Compare three candidates on identical expanding folds:
- training-fold event-rate constant;
- regularized logistic regression;
- histogram gradient boosting.
Save JSON with the modeling contract, validation design, candidate ladder, per-fold metrics, and means. The row-level prediction table contains identifiers, split/fold, y_true, and each candidate probability. Pass that table to calibration and interpretation.
Modeling-table contract
| Field class | Requirement |
| target | binary 0/1, one value per evaluated decision |
| split column | chronologically sortable and stable |
| features | numeric and legally available at decision time |
| identifiers | enough to reconcile predictions to source events |
| duplicated perspectives | explicitly retained or filtered; never accidental |
Keep rows with missing feature values and place median imputation inside each fitted candidate. Drop only rows missing the target or split value. Reject nonnumeric or infinite feature values, and record both drop counts plus the number of imputed rows. If a feature is entirely missing in a training fold, stop instead of inventing a value. Any encoding, scaling, selection, or tuning must also live inside the fold-local pipeline.
Custom model loop
panel is the team-game panel from data-sources. The shift uses only earlier games for that team. Fit every candidate inside the fold, then score the same test rows.
import pandas as pd
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import log_loss
from sklearn.pipeline import make_pipeline
frame = panel.dropna(subset=["won", "season", "is_home"]).copy()
frame["is_home"] = frame["is_home"].astype(int)
frame["won"] = frame["won"].astype(int)
frame = frame.sort_values(["team", "event_time", "game_id"])
frame["pre_win"] = frame.groupby("team")["won"].shift(1)
features = ["is_home", "pre_win"]
records = []
for test_season in sorted(frame["season"].unique())[2:]:
train = frame[frame["season"] < test_season]
test = frame[frame["season"] == test_season]
y_train = train["won"].to_numpy()
constant = float(y_train.mean())
logistic = make_pipeline(SimpleImputer(strategy="median"), LogisticRegression(max_iter=500))
tree = make_pipeline(
SimpleImputer(strategy="median"),
HistGradientBoostingClassifier(max_iter=50, random_state=0),
)
logistic.fit(train[features], y_train)
tree.fit(train[features], y_train)
y = test["won"].to_numpy()
records.append({
"season": int(test_season),
"n": len(test),
"log_loss_constant": log_loss(y, [constant] * len(test)),
"log_loss_logistic": log_loss(y, logistic.predict_proba(test[features])[:, 1]),
"log_loss_hgb": log_loss(y, tree.predict_proba(test[features])[:, 1]),
})
print(pd.DataFrame(records))For continuous outcomes, use a training-mean dummy baseline, then ridge/linear regression, then a nonlinear regressor only if justified. Prefer MAE when typical absolute error drives the decision; add RMSE when large errors deserve extra weight.
Expected result shape
A credible analysis includes:
- fold-level sample sizes and every candidate metric;
- mean and dispersion across folds;
- candidate-minus-baseline deltas on matched rows;
- held-out predictions for calibration and error analysis;
- an explicit keep/reject decision tied to the predeclared threshold.
If the regularized model does not beat the constant, stop and examine grain, feature timing, target quality, drift, and data coverage before adding complexity.
Hyperparameter Discipline
- Default first. Use package defaults / modest trees before search.
- Tune inside training only. Nested walk-forward or a fixed inner validation season.
- Small search spaces. Depth, learning rate, max_iter — not kitchen-sink grids.
- One locked config for final fold metrics. Do not refit after seeing the answer.
- Report the config in the experiment log.
Anti-pattern: repeatedly tweaking until the last season looks good.
Leakage Rules (Non-Negotiable)
A passing smoke check is not CLEAN. Issue the verdict with leakage-audit.
During fitting, still refuse:
- No
points_for/points_against/won/ current-game EPA as pre-game features. - No final-season aggregates applied backward onto early weeks.
- No opponent “season stats” that include the current matchup.
- No target encoding fit on the full shuffled dataset.
- No scaler/imputer fit on train+test together.
- If a feature needs same-game information, the task is no longer pre-game — redefine T.
See references/leakage_rules.md. A smoke check never certifies cleanliness.
Interpreting Results
Good outcome
- logistic and/or ML primary metric beats constant on most folds
- home / strength effects point the right way
- no single season carries the entire claim
- calibration not catastrophic (
calibration-check)
Bad outcome
- beats baseline only in one season
- huge tree gains on tiny data
- train metrics great, walk-forward dead
- perfect accuracy / absurd log-loss → assume leakage until proven otherwise
Decision table
| Result | Action |
| ML < logistic < constant (lower log-loss better) | ship simplest winner; log experiment |
| logistic ≈ ML, both beat constant | prefer logistic unless trees win clearly on multiple folds |
| neither beats constant | debug features/EDA/leakage; do not add complexity |
| only one season wins | do not claim generalization |
Reporting Template
Predictive model report
Question: …
Sport/league: …
Grain: …
Decision time T: …
Target: …
Features: … (all knowable at T: yes/no)
Baselines: constant; logistic form; (optional rating)
Candidate models: …
Validation: season walk-forward, min_train_seasons=…
Primary metric: …
Mean walk-forward metrics: …
Per-season table: …
Calibration: …
Leakage audit: CLEAN / NOT CLEAN
Decision: keep logistic | keep ML | discard | follow-up
Limits: …Also use results-reporting and experiment-log.
References
references/
| File | Contents |
| model_ladder.md | when to climb complexity |
| metrics.md | metric definitions and pitfalls |
| walk_forward.md | fold design details |
| leakage_rules.md | predictive leakage checklist |
Integrity Rules
- Lock target, T, and primary metric before candidate fitting.
- Always run baselines.
- Walk-forward over random season shuffles.
- Do not drop ugly seasons after seeing scores.
- Do not tune on the final test season.
- Report failures and non-improvements.
- Log the experiment (
experiment-log).
Related Skills
| Need | Skill |
| Doctrine / charter | sports-modeling-doctrine |
| EDA | eda-sports |
| Features | feature-rules, time-series-sports |
| Ratings features | ratings-strength-models |
| Baselines only | baseline-models |
| GLM inference | statistical-modeling |
| Validation design | validation-design |
| Leakage | leakage-audit |
| Calibration | calibration-check |
| Interpretation | model-interpretation |
| Writeup | results-reporting, model-card |
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
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.

