Inspiration

Cricket is a game of momentum — a single wicket or a six can flip a match entirely. Yet platforms like ESPN Cricinfo only show static scorecards. As a fan and analyst, I wanted to see how and why win probability shifted ball-by-ball, not just who won. That gap inspired CricketIQ — a live win probability engine that turns every delivery into a data point.

What It Does

CricketIQ is an interactive dashboard that:

  • Trains a ML model on 3,281 T20 international matches (749,336 ball-by-ball deliveries)
  • Visualizes win probability as a smooth curve updated every ball
  • Auto-detects momentum shifts — the top 5 deliveries that caused the biggest probability swings
  • Lets you explore "What If" scenarios via a State Explorer: input any hypothetical score, wickets, overs remaining and get an instant win probability

How I Built It

  1. Data: Parsed Cricsheet.org's free ball-by-ball CSVs into game states
  2. Features: Engineered 13 contextual features per delivery (run rate, required rate, last-3-over momentum, pressure signals, etc.)
  3. Model: Trained a Random Forest with isotonic calibration to output realistic probabilities. Evaluated with Log Loss (0.49) and ROC-AUC (0.84)
  4. API: Built a FastAPI backend with 3 endpoints (/matches, /match/{id}, /predict)
  5. Frontend: React + Recharts for the interactive probability chart, hover tooltips, and key-moments annotations
  6. Deployment: Vercel (frontend) + Railway (backend)

Challenges I Faced

  • Data leakage: Had to split train/test by match (not by row) since deliveries within a match are highly correlated
  • Probability calibration: Raw Random Forest probabilities were overconfident; isotonic regression fixed this
  • Feature engineering at scale: Computing rolling "last 3 overs" stats across 749k rows required careful vectorized pandas operations
  • Deployment: Railway's free tier cold starts meant the first API call after idle could be slow — added caching on the frontend

What I Learned

  • Cricket momentum is quantifiable: wickets in the death overs cause 2–3x larger probability swings than early wickets
  • Model calibration matters more than raw accuracy for a probability product
  • FastAPI + Railway is surprisingly robust for hackathon demos

What's Next

  • Live match integration via CricAPI
  • Player-level features (bowler economy, batsman strike rate)
  • ODI format support
  • Strategy recommender: "ideal bowling change moment"

Built With

Share this project:

Updates

Submission history