A graph-based soccer prediction engine using streaming Elo ratings, multinomial logistic regression, and disciplined bankroll management.
MathShard processes match data through four distinct layers: sourcing, algorithms, execution, and strategy. Each layer is isolated and testable.
Match results, expected goals (xG), and bookmaker odds flow through a unified JSONL pipeline.
{
"match_id": "12345",
"date": "2024-08-17",
"home_team_id": "Arsenal",
"away_team_id": "Chelsea",
"home_score": 2,
"away_score": 1,
"home_xg": 1.8,
"away_xg": 0.9,
"outcome": 0 // 0=Home, 1=Draw, 2=Away
}
Streaming Elo ratings form the backbone. Features flow through a DAG of operations into multinomial logistic regression for 3-way prediction.
| Operation | Type | Description |
|---|---|---|
ELO_UPDATE |
Feature | Streaming Elo ratings with home advantage, optional xG hybrid mode |
ROLLING_MEAN |
Feature | Rolling window statistics per team (form indicators) |
EWMA |
Feature | Exponentially weighted moving average (recency bias) |
DIFF |
Transform | Element-wise difference (home - away) |
STACK_COLUMNS |
Transform | Concatenate features into matrix X |
LOGISTIC_FIT |
Model | Multinomial logistic regression with L2 regularization |
SOFTMAX_PREDICT |
Model | Softmax probabilities โ p_home, p_draw, p_away |
CALIBRATION |
Post | Temperature scaling for probability calibration (T=0.27) |
// EloState holds streaming Elo ratings for all teams type EloState struct { K float64 // K-factor (default: 20) HomeAdv float64 // Home advantage in Elo points InitElo float64 // Initial Elo for new teams Ratings map[string]map[string]float64 // scope โ team โ elo // Layer 2 upgrades ShrinkageLambda float64 // Early-season shrinkage AdaptiveK0 float64 // Adaptive K-factor base TeamHomeAdv map[...] // Team-specific home advantage } // Update modes: "goals" (default), "xg", "hybrid" // Hybrid: S = (1-blend)*S_result + blend*S_xg
Models are defined as JSON DAGs. The executor topologically sorts nodes and runs operations in dependency order.
{
"graph_id": "soccer_3way_elo_baseline",
"nodes": [
{
"id": "elo",
"op": "ELO_UPDATE",
"in": ["matches"],
"out": ["elo_pre_home", "elo_pre_away"],
"params": { "k": 20.0, "home_adv": 100.0 }
},
{
"id": "elo_diff",
"op": "DIFF",
"in": ["elo_pre_home", "elo_pre_away"],
"out": ["elo_diff"]
},
{
"id": "fit",
"op": "LOGISTIC_FIT",
"in": ["X", "outcome"],
"out": ["W"],
"params": { "num_classes": 3, "l2": 0.01 }
}
],
"outputs": ["p_home", "p_draw", "p_away"]
}
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/predict |
Predict single match outcome |
GET |
/api/slate |
Weekly predictions with edge vs odds |
POST |
/api/v1/backtest |
Walk-forward backtesting |
GET |
/api/season-odds |
Monte Carlo season simulation |
POST |
/api/v1/graph/run |
Execute arbitrary computation graph |
Two complementary systems: Growth Mode for serious alpha extraction, ACCA Fun for controlled entertainment betting.
Validated on 160 out-of-sample 2025/26 EPL matches using walk-forward backtesting.
| Strategy | ROI | Notes |
|---|---|---|
| Model picks (Growth Mode) | +32.6% | 4-month validation (Aug-Dec 2025) |
| Model picks (basic) | +6.56% | All model picks vs Bet365 |
| Always home | -8% | Baseline strategy |
| Random | -10% | House edge |