05 — Personal Analytics / Dashboard

Cricket Venue Intelligence Hub

A multi-page Streamlit dashboard turning four IPL data sources — ball-by-ball deliveries, match metadata, statistical venue profiles, and qualitative stadium reports — into an interactive venue-intelligence tool. Single-venue deep dive, side-by-side comparator with K-Means similarity clustering, player rankings, and composite predictive scoring. Reference tool, not a calibrated predictor — and the page is honest about which is which.

DomainIPL Venues
ApproachDashboard + Light ML
Pages4 analytical views
Data Sources4 merged
01 / Problem

Venues are a reference. Not a prediction.

Cricket analysts don't ask "predict the venue type." They ask "what's Wankhede's profile? Who historically scores at Chepauk? What should we do at the toss here? Which venues are similar to where we're playing tomorrow?"

Those are lookup-with-context questions — they need a structured interactive tool, not a regression model. Most cricket analytics work overshoots this distinction: it tries to predict what should be a reference lookup, and ends up with overfit toy models that hide the actual signal a coach is looking for.

This project is what an analyst actually opens 30 minutes before a match. Four pages, four data sources, one tool.

02 / The Four Pages

Four analytical views.

PAGE 01 — VENUE OVERVIEW

Single-venue deep dive

Three tabs for one venue — statistics (matches, avg score, runs/over, balls/wicket), phase analysis (PP/Middle/Death rates), and toss impact (bat-first vs bowl-first win %). The pitch profile from Stadium Reports surfaces qualitative tags too — pitch type, bounce, spin assistance, seam movement, dew impact.

  • 3 tabs · Plotly visualizations
  • Quantitative + qualitative profile
  • Toss strategy recommendation
PAGE 02 — VENUE COMPARISON

Side-by-side + similarity

Pick two venues, see their metrics side by side and their phase-wise scoring profiles overlaid. Then K-Means clusters all venues on 3-feature space (PP / Middle / Death run rates) and surfaces "venues similar to X" — useful for travel days when you want a proxy for a venue you've never played.

  • K-Means · StandardScaler
  • 3-feature similarity
  • Auto-grouped venue tiers
PAGE 03 — PLAYER PERFORMANCE

Who scores here

For a chosen venue, rank batters by career runs at that ground with min-runs threshold. Surface top-5 by volume, plus a Strike Rate × Average quadrant scatter — Elite, Anchors, Slow-but-solid, Aggressive-but-prone. Each player point sized by total runs for instant scan.

  • Min-runs slider · live filter
  • Quadrant scatter analysis
  • Top-N leaderboard
PAGE 04 — PREDICTIVE ANALYTICS

Composite candidate score

Two sub-tools. Batter Prediction: pick venue + opponent — composite-scored ranking of likely top performers. Match Strategy: toss recommendation + pitch-aware playing-XI tips. Honest framing — the composite score is a ranked candidate list, not a calibrated probability.

  • 0.4 venue + 0.3 form + 0.3 vs-opp
  • Stacked factor-contribution chart
  • Stadium-Reports-driven strategy
03 / Architecture

Four data sources. One merge pipeline.

The unglamorous foundation. Cricket data is messy — the same stadium appears under five name variants across sources. Without normalization, every groupby produces garbage. The pipeline below is what makes the rest of the dashboard correct.

SOURCE 01deliveries_2024ball-by-ball SOURCE 02matches_2024metadata · toss SOURCE 03venue_profilesaggregates SOURCE 04Stadium_Reportspitch · dew · seam VENUE NORMALIZATION — 11 mappings"Ekana Cricket Stadium, Lucknow" → "BRSABV Ekana Cricket Stadium" 4-way merge · phase tagging · @st.cache_datadeliveries × matches × venue_profiles × stadium_reports PAGE 01Overviewstats · phase · toss PAGE 02ComparisonK-Means · similarity PAGE 03PlayerSR × Avg quadrant PAGE 04Predictivecomposite score
Four sources merged on match_id and a normalized venue key. The 11-entry venue name map is the unglamorous piece that makes every downstream groupby trustworthy.
04 / How It Works

From CSV to dashboard.

01

Load and merge four data sources

@st.cache_data caches the heavy merge so each page navigation is instant. Inner-join deliveries × matches on match_id. Outer-join venue profiles + stadium reports on the normalized venue key. Filter to innings 1 and 2. Phase-tag every delivery (PP / Middle / Death).

pandasst.cache_data4-way merge
02

Normalize venue names

11-entry hand-curated map collapses variants — "Ekana Cricket Stadium, Lucknow", "Bharat Ratna Shri Atal Bihari Vajpayee Ekana Cricket Stadium, Lucknow", "BRSABV Ekana Cricket Stadium" — into one canonical name. This is the boring step that makes everything else correct. Without it, every groupby splits one stadium into multiple rows.

string normalizationdata cleaning
03

Compute venue-level aggregates

Per venue: total matches, total runs, runs per over, balls per wicket, average 1st-innings and 2nd-innings scores. Per (venue × phase): run rate, strike rate, balls per wicket. Per (venue × batter): runs, balls, dismissals, strike rate, average, runs per match.

groupbyaggregationpivot
04

K-Means venue clustering

Pivot phase rates to (venues × 3) matrix — PP, Middle, Death. StandardScaler normalizes. K-Means with n_clusters = min(5, n_venues) and random_state=42. Output: cluster ID per venue. "Similar venues to X" = same cluster.

scikit-learnKMeansStandardScaler
05

Composite batter prediction score

For a (venue, opponent) pairing: compute each batter's avg-runs-at-venue, recent-form average, and average vs that opponent. MinMax-normalize each component within the result set. Weighted sum: 0.4 × venue + 0.3 × form + 0.3 × vs-opp. Heuristic ranking, not a calibrated probability — labelled clearly in the UI.

weighted compositeMinMax normalization
06

Strategy rules over Stadium Reports labels

If Spin Assistance == 'Very High' → recommend extra spinners. If Seam Movement == 'High' → recommend quality pace bowlers. If Dew Impact == 'High' → flag dew factor for second-innings bowling. Combined with phase analysis (highest-scoring phase at venue) → playing-strategy brief.

if-then rulesdecision-aid
07

Streamlit sidebar nav + Plotly interactivity

Sidebar radio button routes between the four pages. Each page uses Plotly Express for interactive bar/line/scatter charts and pie charts. Hover tooltips, click-to-zoom, all native. Tabs within each page for sub-sections (Stats / Phase / Toss).

StreamlitPlotly Expressst.tabs
05 / The Composite

The one formula on the Predictive page.

For full transparency — here's exactly what the "Predict Top Batters" feature computes. Three components, hand-set weights, MinMax-normalized within the result set. Ranked candidate list, not a probability.

▸ Composite Predictive Score ◂
predicted_score = 0.4 · normalized_avg_runs_at_venue
                    + 0.3 · normalized_recent_avg
                    + 0.3 · normalized_vs_opponent_avg
  // weights hand-set, not calibrated
  // all 3 components MinMax-normalized within result set
  // ranked candidate list — NOT a forecast probability
06 / Honest Framing

A dashboard, not a predictor.

— What this is and isn't —

The most honest thing about this project is what it doesn't claim.

The "Predictive Analytics" page is not a calibrated probability forecast. It's a ranked candidate list from a transparent composite formula. There's no held-out test set, no accuracy metric, no AUC, no Brier score. Stating any of those would be dishonest.

The K-Means venue clusters are not validated by silhouette or Davies-Bouldin score. They're interpretable groupings that pass face-validity checks — high-scoring decks cluster together, low-scoring decks cluster together — but I haven't proven they're statistically optimal.

The Stadium Reports labels (Spin Assistance: Very High, Dew Impact: Medium) are manually compiled. They're useful for the strategy recommendations, but they're not BCCI-authoritative.

Where the project is genuinely strong: the foundational pipeline. The venue name normalization map, the four-way merge, the cached load, the phase tagging, the per-venue aggregates, the multi-page navigation. That's the work most cricket dashboards skip and get wrong — and getting it right is what makes every other view in the app correct.

07 / Technical Decisions

Why these choices.

Why a dashboard,
not a model?
Because the questions analysts ask about venues are lookup-with-context, not prediction. "What's Wankhede's phase profile?" isn't a regression problem — it's a structured query. A calibrated win-probability model (which I have separately, in the ODI Full Match Predictor) uses venue features as inputs. This dashboard makes venue features the unit of analysis. Different jobs, different tools.
Why merge
four sources?
Each fills a gap. Deliveries gives ball-by-ball patterns. Matches gives outcomes and toss. Venue profiles gives pre-computed historical aggregates. Stadium Reports gives qualitative pitch character — pitch type, dew impact — that no statistical aggregate can recover. A single source would miss either the granular detail or the qualitative context.
Why K-Means
for similarity?
Simple, interpretable, fast. With ~10–15 venues, k=5 gives meaningful tier groupings — high-scoring decks, balanced, bowler-friendly, dewy chase venues, anchor-friendly. The cluster centroids are inspectable. Hierarchical clustering or DBSCAN would add complexity without obvious payoff at this scale. Honest caveat: silhouette score wasn't computed to validate k=5.
Why hand-weighted
composite, not ML?
Three reasons. One: no labeled "future performance" target exists — no clean signal to train against. Two: the composite is auditable — a coach can ask "why is X projected to score?" and see the 40/30/30 factor breakdown. A learned model would obscure that. Three: the use case is exploratory comparison, not deployment-grade forecasting. The honest cost: no validation, hence the "ranked candidate list" framing.
Why the venue
normalization map?
Real cricket data is dirty. The same stadium appears under five different name variants across the four data sources — "Ekana Cricket Stadium, Lucknow", "BRSABV Ekana Cricket Stadium", and "Bharat Ratna Shri Atal Bihari Vajpayee Ekana Cricket Stadium, Lucknow" are all the same ground. Without normalization, every groupby silently splits one stadium into multiple rows and the aggregates lie. This is the boring step that makes everything else trustworthy.
Why Streamlit
with sidebar nav?
Multi-page Streamlit lets each analyst stick to the view they need — Overview / Comparison / Player / Predictive — without rebuilding a custom SPA. Sidebar radio routing keeps the four pages clearly separated, and @st.cache_data on the heavy data load means page-switching is instant. A custom React frontend would take 10× the effort for no analyst-facing benefit.
08 / Limitations

What needs fixing.

The honest gaps between this dashboard and what a production-grade franchise tool would look like. Every one is a real V2 target, not hand-waving.

01
"Predict Top Batters" has no validation. No held-out test set checking whether the top-5 predicted batters actually outperform the rest in real matches. The label "Predictive" oversells; "Ranked Candidate List" would be more honest.
02
Single-season data. Filenames suggest 2024 IPL only. Some venues hosted very few matches in one season — bat-first win percentages are noisy on small samples. Multi-year aggregation stabilizes the numbers.
03
K-Means uses only 3 features. Powerplay / Middle / Death run rates. Misses wicket rates by phase, dew, pitch type, boundary %. "Similar" venues mean "similar scoring patterns," nothing deeper.
04
n_clusters = 5 is fixed. No silhouette score, no elbow method. Reasonable for 10–15 venues, but not statistically validated.
05
Stadium Reports labels are qualitative and manually compiled. "Spin Assistance: Very High" — source not cited. The strategy recommendations depend on these labels' accuracy.
06
"Recent form" is partially double-counted. The recent_avg includes matches at the prediction venue, so venue history shows up in two of the three composite factors.
07
Composite weights aren't calibrated. 0.4 / 0.3 / 0.3 are domain reasoning. V2 calibrates against historical outcomes.
08
Venue normalization map is hardcoded. 11 mappings handle the known variants; a new typo would slip through silently. Fuzzy matching would self-handle new cases.
09
File-upload feature is non-functional. The sidebar accepts a CSV but doesn't process it — a clear "not implemented in this demo" note appears.
Version 2 — Build Order

What ships next.

  • 01Multi-year aggregation — roll forward through every IPL season (2008–2024+) so per-venue stats stabilize.
  • 02Backtest the composite predictor — check correlation between predicted score and actual runs on past matches; recalibrate weights against the result.
  • 03Expand K-Means features — add wicket rates by phase, dew impact, boundary %, ground shape; compute silhouette to pick k.
  • 04Fuzzy-match venue normalization with rapidfuzz. New venues self-map.
  • 05Cite Stadium Reports source — either link to official BCCI/ICC pitch reports or replace with a CNN classifier on pitch images.
  • 06Add small-sample warnings — gray out toss percentages when n < 5 matches at a venue.
  • 07Wire up the file-upload feature so users can add their own match data.
  • 08Add a backtest tab — pick a historical match, see what the dashboard would have recommended, compare to actual outcome.
— Open the dashboard / read the code —

A reference tool. Used like one.

Full code on GitHub — four data sources merged, four analytical pages, K-Means clustering, composite scoring, deployment config.