NRL Margin Predictor
The margin predictor is an operator-run workflow. dbt builds point-in-time
features, Python trains and predicts, and the FastAPI website reads the
prediction output.
Train and Evaluate
cd analytics/dbt_nrl
dbt build --select ml_nrl_match_training_examples
cd ../..
python ml/evaluate_margin_model.py --holdout-season 2025
python ml/train_margin_model.py --train-through-season 2025
Model artifacts are written to:
nrl/models/lgbm_v1.pkl ← trained LightGBM model
nrl/models/metrics.json ← evaluation metrics
Weekly Prediction
bash scripts/weekly_2026_round.sh <ROUND>
bash scripts/stage_nrl_datasets.sh weekly
cd analytics/dbt_nrl
dbt build
cd ../..
python ml/predict_weekly_margin.py --season 2026 --round <ROUND>
predict_weekly_margin.py writes predictions to gold_nrl_predictions and
exports a Parquet artifact. The FastAPI bet-advisor website uses the separate
logit/Elo backtest pipeline in nrl-bet-advisor/data/backtest.py for the
game-day value board, rather than the LightGBM margin model.
DQ Checks
The dbt ML layer includes checks for:
- one training row per completed match
- one upcoming row per unscored match
- exactly two team-form and ladder feature rows per fixture
- no future match or ladder data in point-in-time features
- latest-prior match and latest-prior ladder selection
- rolling feature ranges such as last-3/last-5 counts and win rates
- target correctness for
home_margin