Common Struggles — and Fixes That Work
This page collects the problems students hit most often, part by part, with fixes that have worked in
class. The chapter notes in chapter-notes/ go deeper for each chapter. Seven struggles recur across the
whole book, so they come first.
The seven recurring struggles
1. Small samples (every part)
What it looks like. A student ranks IPL batters on one season's strike rate, declares a bowler "in form" after three matches, or builds a matchup case on 14 balls. They agree with Chapter 6 in the abstract and then ignore it for their favourite player.
Why it happens. Cricket numbers feel large. "Strike rate 199.0" sounds like a measurement, not a noisy estimate from 105 balls. And fans have been trained by commentary to treat the latest sample as the truth.
Fixes. - Make the reliability formula a reflex: r(n) = n / (n + k), with k ≈ 98 balls for IPL strike rate and ≈ 554 for dismissal rate (Chapter 6). Before any comparison, students write down n and r(n). - Use the Rahane hook (209 off 105 balls, SR 199.0, to open IPL 2023, then 139.3 for the rest of the season) as a prediction exercise before teaching anything. Students who predicted 180 remember it. - Require shrunk estimates with intervals from Chapter 6 onward. Anchor D is the model: de Kock against off-spin is reported as shrunk SR 115.5 (90% interval 108.5–122.4) against an expected 125.8, never as the raw 112.9. - Show the cost of ignoring it. In Chapter 11, using raw head-to-head matchups made predictions worse than ignoring matchups altogether (out-of-sample error 404 against 220); shrinking them helped a little (208).
2. Phase and format confusion (Parts I–III especially)
What it looks like. An ODI death-overs number compared with a T20 one; a "powerplay" defined as overs 1–10 in a T20 script; a Test average used to scout a T20 batter; The Hundred analysed as if its phases were overs.
Fixes.
- Put the phase definitions on the wall: T20 powerplay 1–6, middle 7–15, death 16–20; ODI 1–10, 11–40,
41–50; The Hundred by balls, 1–25, 26–75, 76–100; Tests have no phases (the toolkit labels them
"none"). The phase column already applies these, so the fix is usually "use the column, don't
recompute it".
- Teach Chapter 5's exchange rates as the reason: a wicket every 55.5 balls in Tests against one every 17.6
in men's T20Is; 72.8% of Test innings all out against 16.3% of men's T20I innings. Scarce wickets and
scarce balls are different economies.
- Mark down any metric reported without its format. "SR 140" is not a statement until it says T20, which
competition, which phase and which seasons.
- The Hundred is stored as T20 with five-ball sets and mixes men's and women's matches (188 of its 389
matches are women's). Filter on gender first.
3. Leakage in model validation (Parts IV–VII)
What it looks like. A gradient-boosted win-probability model with a near-perfect test score; a backtest with a smooth upward profit line; a commentary stat pack that "predicted" an innings using numbers that included it.
Fixes. - Teach Chapter 20's experiment as a set piece. On a random 80/20 split of balls, a flexible model scores a test Brier of 0.0185. Split by match and the same model scores 0.1933. The logistic regression barely moves (0.1274 against 0.1301) because it is too simple to memorise matches. Ask students to explain the gap before you do: every match had about 80% of its balls in training, and the target, environment and Elo gap act as a fingerprint. - Make "split by match or by time" the default rule for every model in the course, and "fit on the past, test on the future" the gold standard. - Show the three other faces of leakage the book teaches. Chapter 14's simulated-tracking expected-wickets model scores an AUC of 0.648 against 0.617 for the outcome-only model, and the extra is leakage from the simulator, which was told the outcomes. Chapter 35's backtest returns +37.0% with season-peeking against an honest +10.1% (interval −3.2 to +24.0). Chapter 37's stat pack shows KL Rahul's 2026 line as 593 runs in 14 innings when computed on the whole season; as of the morning of 8 April 2026 it was 1 run in 2 innings. - A smooth profit curve or a suspiciously good score is a symptom. Teach students to be most suspicious of their best results.
4. Calibration (Parts IV–VII)
What it looks like. "My model is 72% accurate, so it's good." "The model said 80% and they lost, so the model was wrong." Students compare Brier scores across different test sets.
Fixes. - Teach Chapter 20's threshold concept with the reliability diagram: of all the times the model said 70%, did the side win about 70% of the time? Accuracy throws away the probability; calibration keeps it. - The Brier score only means something relative to another model on the same test set. Early chase states are hard (Brier near 0.2) and late ones easy, so a Brier score from a different split is not comparable. - Use the era problem as the case study. Chapter 9's WP table, fitted before 2023 and tested on 2023–26, scored a Brier of 0.1252 but underrated IPL chasers since 2023 by 13.4 points. A model can be decent overall and badly miscalibrated where it matters most. (Chapter 9 also shows the IPL chase of 200: P(win) 0.168 on the pre-2023 table against 0.491 on the 2023–26 table.) - For "the favourite lost, so the model was wrong", use Chapter 35: the walk-forward Elo favourite won only 47.6% of 286 IPL matches in 2023–26 (Brier 0.2576, worse than a coin's 0.2500), while men's full-member T20I favourites won 64.1%. The IPL is built for parity; about 92% of the spread in IPL team-season records is luck (Chapter 6).
5. Simulated versus real data (Chapters 7, 14, 15, 17, 32, 37)
What it looks like. A student writes "Bumrah's yorker share is 31%" from a sim_ column, or presents a
simulated pitch map in a write-up without a label, or treats an impressive simulated-tracking model as a
finding.
Fixes.
- State the rule on day one and enforce it in every rubric: Hawk-Eye, pitch locations, beehives, release
speeds and shot angles are not public. The toolkit's tracking_sim.py attaches simulated sim_*
columns to real deliveries. Outcomes are real; locations are simulated, conditioned on the real outcome.
No sim_ number is ever a fact about a real player.
- Every chart on the simulated layer carries "simulated tracking layer — real outcomes, simulated
locations" in its title or caption; every write-up section using it has a 🧪 label.
- Teach Chapter 15's audits, which are the most transferable lesson in the book. With the link to real
outcomes switched off, every length at the IPL death costs the same, 9.60–9.62 runs an over: the
"yorkers are cheapest" result came from the simulation's assumptions. A hash of the bowler's name
explains R² 0.78 of simulated yorker share. An LBW model with an AUC of 0.823 falls to 0.503 when its
labels are shuffled. Students should run these checks on any tracking model anyone hands them.
- Fielding (Chapter 17) is the half-way case: catches, run-outs and stumpings taken are real; drops and
runs saved come only from a simulated or hand-charted layer.
6. pandas pitfalls (Chapters 2–3, then everywhere)
| Pitfall | Symptom | Fix |
|---|---|---|
| Counting rows as balls | Strike rates too low, overs too long. The first over of the 2026 IPL final has six legal balls and three wides: nine rows | Use batting_summary / bowling_summary; balls faced exclude wides (no-balls count); bowling balls are is_legal only |
runs_total for a batter |
Batters credited with wides and byes | Batting runs are runs_batter; bowling runs conceded exclude byes, leg-byes and penalties |
| Super overs left in | A few extra balls and runs in big games | The summary functions drop super_over rows; hand-rolled code must too |
| Season labels | IPL 2008 "missing"; seasons sorting wrongly | Seasons are strings; "2007/08" is IPL 2008 and "2020/21" is IPL 2020. Chapter 2's season_years() converts them |
| Merges that multiply rows | Totals jump after a join | Check len() before and after every merge; use validate="many_to_one" |
| Averages with no dismissals | NaN or infinite averages at the top of a leaderboard |
Average is NaN when outs = 0. Set a minimum-balls filter (Chapter 3, §3.6) |
SettingWithCopyWarning |
Changes silently not applied | Take .copy() after filtering, then assign |
| Tied and rain-affected matches | Odd winners and targets | Ties have an empty winner (a super-over winner is in eliminator); rain-rule results are marked in method (D/L, and a few VJD) |
| Test fourth-innings targets | No target column for Tests |
Compute targets from the innings totals |
| Memory on big tables | Laptop slows when loading Tests | Read only the columns you need (pd.read_parquet(path, columns=[...])); the men's Test deliveries table takes about 2 GB in memory |
The best general fix is a sanity check against a known number. Every lab should begin with one line that reproduces a figure from the book (for example, Kohli's IPL 9,336 runs off 6,926 balls with 231 outs) before doing anything new.
7. Name collisions and registry ids
What it looks like. A "career" that merges two people. Three different "Rashid Khan"s appear in men's T20Is. "SR Taylor" is both Steven Taylor (USA, men's) and Stafanie Taylor (West Indies women). Seventy names are shared by two or more people within single competitions.
Fixes.
- Group by batter_id / bowler_id for any cross-competition work: batting_summary(balls, "batter_id")
matches outs and innings by id as well.
- Pin a famous name to one person with cricdata.only_player(balls, name), which blanks out other people
who share the spelling.
- Know the women's quirks: "NR Sciver" and "NR Sciver-Brunt" are the same player and should be merged;
"KH Sciver-Brunt" is a different player (Katherine). Chamari Athapaththu appears as "AC Jayangani". When
joining the styles table, match on gender as well as name.
- Remember the withheld data. Afghanistan's men's internationals are not in Cricsheet, so Afghan players
appear only through franchise leagues. Never let a student call a franchise total a "career".
Part by part
Part I — Foundations (Chapters 1–7)
- "Why do I need Python for cricket?" (Ch 2–3). Students new to code panic at the first traceback.
Chapter 3's
05_errors_and_tracebacks.pytreats errors as information; teach reading the last line first. Pair non-coders with coders for the first three labs. - Accepting the four lies, then reusing the lie (Ch 4). Students learn that average ignores pace and then rank batters by average in their next lab. Fix: every leaderboard they submit must include runs above par or SR+ alongside the traditional number.
- Selection on the outcome (Ch 4, 6). "Rohit averages 58.46 in wins and 36.01 in losses, so he's a match-winner." Show that 102 of 103 ODI batters on Chapter 4's filter average more in wins and Rohit's ratio (1.62) is below the median (1.74). Then flip the question: given Rohit's score band, how often did India win?
- Simpson's paradox feels like a trick (Ch 4, 6). Use the weighted-average arithmetic, not the paradox's name: Bumrah's 7.34 is his phase economies weighted by his phase mix (39.2% of his balls at the death), Ashwin's 7.20 by his (60.7% in the middle overs).
- Different filters, different numbers (Ch 4, 6, 8). Students think the book contradicts itself when Chapter 6 says 93.9% of ODI batters average more in wins and Chapter 4 says 102 of 103; or when season-to-season repeatability of IPL batting average is 0.23 in Chapter 6 and 0.209 in Chapter 8. Each uses a different filter. Teach "cite every number with its filter" as a professional habit.
- Choosing the wrong chart (Ch 7). After 15 overs at Newlands the worm shows Sri Lanka level with South Africa; the run-rate chart shows them scoring at 7.73 and needing 10.80. Both are right; they answer different questions. Ask "what question does this chart answer?" before "is it pretty?"
Part II — Batting Analytics (Chapters 8–13)
- Boundary share as a quality measure (Ch 8). The "elite batters score 55–65% in boundaries" claim describes 80 of 140 regular IPL batters. Boundary share is style, not quality.
- Value as change in win probability (Ch 9, threshold concept). Students resist crediting Imran Tahir's 2-run, 2-wicket over (+0.525 WPA, the largest on the field at Newlands) above Dickwella's 68, the player-of-the-match innings (+0.157). Walk through the state before and after the over, ball by ball.
- Survival curves (Ch 10). Students read a Kaplan–Meier curve as a career average. Ask "what fraction of innings last 100 balls?" (Williamson 37.1%, Kohli 30.0%) and let the curve answer.
- Shrinkage constants feel arbitrary (Ch 11). Two k values (men's strike-rate k 303 balls, dismissal-rate k 1,956) look like magic numbers. Show the out-of-sample error curve; k is chosen by what predicts best.
- Chemistry (Ch 12). Fans believe in it. Abhishek Sharma and Travis Head's raw +20.4 SR+ points of chemistry shrinks to about +5.5, and chemistry's split-half reliability in the IPL is 0.154. Let the class argue it, then show the reliability.
- Anchor B overreach (Ch 13). Students conclude "Pant was a bad buy". Insist on the caveats: one season, one phase, did not persist, and Pant the better death-overs batter in both seasons.
Part III — Bowling and Fielding (Chapters 14–18)
- Economy as the whole story (Ch 14). At the IPL death, economy correlates 0.94 with boundary % and −0.51 with dot %. Thirty percent dots is ordinary (57.4% of 68 regular death bowlers clear it).
- "Due" wickets (Ch 14). Bumrah's 4 wickets in IPL 2026 against 14.78 expected tempt students to say he is "due". Year-to-year correlation in wickets above expected is 0.06; the shortfall predicts little.
- The pressure myth (Ch 16). Wendell's belief that dots build wicket pressure is widely shared. The odds ratio per ten extra striker dots is 0.848 (slightly lower wicket odds). Frame it as a debate, not a gotcha: dots matter because they cost runs.
- Fielding numbers that don't exist (Ch 17). Students want drops and misfields. Cricsheet records neither. Use it to teach what a dataset can and cannot support.
- Styles-table coverage (Ch 15, 18). Pace/spin splits depend on
player_styles.csv; coverage is high but not complete (IPL 2026 legal-ball coverage 96.6%). Students should report coverage alongside any split.
Part IV — Match and Team Analytics (Chapters 19–23)
- The state space (Ch 19, threshold concept). Students think in scores, not states. Have them describe a moment as (runs needed, balls left, wickets in hand) before any modelling.
- Era shifts (Ch 19–22). IPL par rose from 163.4 (2008–22) to 190.3 (2023–26) in Chapter 19's tables. A model trained on the old game misprices the new one. Make students check performance by era.
- Toss and venue folklore (Ch 22). Students expect large toss effects. Toss winners won 51.1% of 11,050 decided limited-overs matches; only the PSL survives a correction for 18 comparisons. Teach multiple-comparisons thinking here.
- DLS tables (Ch 23). The Professional Edition is not public. Students must derive resource tables from data, not search for official ones.
Part V — Prediction and Forecasting (Chapters 24–29)
- True ability against observed performance (Ch 25, threshold concept). Students project last season forward. Marcel-style regression beats it: IPL SR+ RMSE 13.4 against 19.6 for last season's number. Bowling economy is projectable; wickets are barely projectable at all.
- Translation across leagues (Ch 26). Projecting IPL output from other leagues without translation was biased by +4.5 SR+ points in Chapter 25's test. Leagues are different scoring environments.
- Simulation spread (Ch 19, 27, 28). Simulators that use one scoring rate for every innings give distributions that are too narrow. Ask for the spread as well as the mean, and compare it with reality.
- Test forecasting (Ch 29). Day and session labels are "nominal" reconstructions; the data has no official session times or weather. Students must say so.
Part VI — Strategic Analytics (Chapters 30–34)
- Optimiser output treated as an order (Ch 30–32). An optimiser is a recommendation under the model's assumptions. Ask what the captain knows that the model doesn't (injury, conditions, the dressing room).
- A model that answers a different question (Ch 33). Chapter 33's direct outcome model says "bat on" for 93.8% of declarations, because a big lead correlates with dominance. It is used to price a declaration, not to time it. Use this to teach confounding in decision models.
- Simulated shot zones (Ch 32). Field placement uses simulated zones; the simulated-data rules apply in full.
Part VII — Betting, Fantasy and Media (Chapters 35–38)
- Backtest optimism (Ch 35). The top 10 of 115 IPL "systems" returned +57.0% in-sample and −16.1% out of sample. A 5% edge at evens needs about 1,533 bets to show. See the responsible gambling guide for how to teach this chapter.
- Kelly feels like a strategy, not a risk (Ch 35). Even with a real 5% edge, 98.45% of full-Kelly simulations suffered a 50% drawdown within 1,000 bets.
- As-of discipline (Ch 37). Every number in a preview must be dated before the match.
- Superlatives (Ch 37). "Record" without a pool and a date is a guess. "In the data" is the house rule.
Part VIII — Synthesis (Chapters 39–40)
- Integration debt. Modules written over a term rarely fit together first time. Schedule integration in week 12 of a 15-week course, not week 15. Require each module's checkpoint to run before assembly.
- Dashboards without honesty. A dashboard that shows a WP number without saying which model, or a pitch map without the simulated label, fails the capstone rubric whatever its polish.
- Environment problems on demo day. Pin library versions in the project's requirements file and rehearse the demo on a clean environment the week before.