Cochon123/clash-royale-winner-predictor
Clash Royale full-game winner predictor
Perspective-symmetric ensemble that predicts which player wins a Clash Royale battle from replay action sequences (card plays and Hero/Champion ability activations).
Model summary
Trained on 13,873 RoyaleAPI replays with battle-level train/val/test splits (70/15/15). Baseline (most-common legal action) test accuracy: 77.4%.
Architecture
- HistGradientBoostingClassifier + ExtraTreesClassifier blend (30% HGB / 70% Extra Trees, selected on validation log-loss)
- 426 tabular features from deck composition, elixir/leak tables, and action-prefix statistics
- Symmetric inference: every battle is scored from both player perspectives and averaged
- Confidence head: separate blend optimized for area under the risk-coverage curve, with isotonic calibration to estimate P(prediction is correct)
Files
Usage
Install the companion pipeline from cochon123/clash-royale-ai, then download this checkpoint:
pip install git+https://github.com/cochon123/clash-royale-ai.git
huggingface-cli download Cochon123/clash-royale-winner-predictor --local-dir models/winner_predictorLoad the artifact in Python:
import pickle
from pathlib import Path
with Path("models/winner_predictor/hgb_ensemble.pkl").open("rb") as f:
artifact = pickle.load(f)
hgb = artifact["models"]["hist_gradient_boosting"]
trees = artifact["models"]["extra_trees"]
hgb_weight = artifact["hgb_weight"]
card_index = artifact["card_index"]Retrain or reproduce from raw replays:
cr-replays train-winner-hgb --input data/raw --trees 100Training data
Features are extracted from RoyaleAPI replay HTML payloads. The model does not see live arena state (unit positions, HP, projectiles)—only the ordered sequence of card plays and ability activations plus deck metadata. See the investigation report for labeling details around Hero/Champion abilities.
Limitations
- Replay-only features; not suitable as a standalone real-time bot without synchronized game-state input
- Trained on a specific meta window; performance may drift with balance patches and new cards
- Confidence scores are calibrated on the validation split and should be treated as estimates, not guarantees
