Final Examination — Comprehensive, weighted to Parts IV–VIII (Chapters 19–40)
Coverage: the whole book, with about four-fifths of the marks on Part IV (Chapters 19–23), Part V (Chapters 24–29), Part VI (Chapters 30–34), Part VII (Chapters 35–38) and Chapter 40. Several questions deliberately reach back to Parts I–III: shrinkage (Chapter 6), Anchor B (Chapter 13) and the women's win-probability table (Chapter 9).
Time: 3 hours. Total: 100 points.
| Section | Content | Points |
|---|---|---|
| A | Multiple choice: 12 questions × 2 points | 24 |
| B | Short answer: 4 questions × 4 points | 16 |
| C | Two data-interpretation questions, using real numbers from the book | 20 |
| D | Modelling critique | 12 |
| E | Strategy case: the declaration | 12 |
| F | Coding task with Crease | 16 |
Instructions for students. Calculators are allowed. Every number in this paper comes from the book's data snapshot (Cricsheet, downloaded 18 November 2026) and is quoted from the chapter named beside it. Section F can be done on a lab machine with the book's data, or on paper: write the code you would run and the output you expect. Whenever you make a comparison, state the format, the competition and the sample size. An answer that gives a number without its uncertainty or its sample is incomplete.
Instructor notes. Answer keys and marking guides are in collapsible blocks. For a no-code version (coaching, journalism or management courses), drop Section F and add 8 points each to Sections D and E; both work entirely from the printed tables. Section F's reference solution runs in under a minute once the data is built.
Section A — Multiple choice (24 points)
Choose one answer for each question.
A1 (Chapter 19). The IPL's par first-innings score is 163.4 for 2008–22 and 190.3 for 2023–26. As a share of par, though, the two eras' Expected Runs tables differ by only about 1.2 percentage points on average. What does that let an analyst do?
a) Ignore the era change, since the two tables are the same b) Keep one resource shape and rescale it to each era's scoring level c) Conclude that the Impact Player rule did not change scoring d) Abandon the pooled shape and fit the 2023–26 IPL table on its own innings only
A2 (Chapter 20). The same flexible model scored a test Brier of 0.0185 on a random split of balls and 0.1933 on a split by match. The best explanation is:
a) the by-match test set was smaller b) balls from the same chase sat in both training and test, and match-level features let the model recognise the match and look up its result c) gradient boosting is unstable on large data sets d) the by-match split accidentally included women's matches
A3 (Chapter 20). A logistic recalibration of a win-probability model's test forecasts gives a slope of 0.80 and an intercept near 0. The model's forecasts are:
a) too timid: they should be pushed away from 50% b) too extreme (over-confident): they should be pulled toward 50% c) biased toward the chasing side d) worse than a coin flip
A4 (Chapter 21). Within a team-season, Chapter 21 estimates the effect of one extra bowling option on IPL win percentage as −0.0 points (90% CI −3.5 to +3.5). The correct reading is:
a) an extra bowling option costs matches b) the effect is proven to be exactly zero c) no measurable effect; an effect larger than about 3.5 points either way is unlikely, but a smaller one cannot be ruled out d) all-rounders have no value in T20
A5 (Chapter 22). IPL chasers won 54.7% when they chose to chase and 54.7% when they were sent in to chase. What follows?
a) Toss winners should always bat first b) There is a chasing advantage, but the captain's choice adds no information about which matches suit the chaser c) The toss decides IPL matches d) Dew explains the whole chasing advantage
A6 (Chapter 25). Across 36 different weightings of past seasons, the Marcel projection's out-of-time error for IPL SR+ ranged only from 13.35 to 13.52. The lesson is:
a) the weights on past seasons are the most important modelling choice b) how far you regress toward the mean matters; the exact season weights barely do c) last season alone is the best predictor d) no projection can beat the league par
A7 (Chapter 27). A popular claim says that after the powerplay a good model predicts a T20 total "within ±15 runs, typically". Chapter 27 found that:
a) it is true: about 80% of innings land within ±15 after six overs b) it is false: the best method lands within ±15 in about 41% of innings after six overs, and an 80% band needs about ±37 runs c) it is true for the IPL only d) it is false because nothing beats run rate × 20
A8 (Chapter 28). In the IPL format, at IPL-sized gaps in true team strength, how often does the truly best team win the title?
a) 52.6% b) 38.7% c) 19.3% d) 9.1%
A9 (Chapter 30). For RCB's 2026 final XI the best of 5,040 top-seven orders beats the usual order by +4.95 runs (+3.2 points of win probability). Across ten IPL 2026 sides, the median gain from moving the power hitter to his best slot is 0.38 runs. The best summary is:
a) batting order is the biggest strategic lever in T20 b) order matters, but in single runs; for most sides promoting the hitter gains little c) power hitters should always bat at No. 3 d) simulation cannot evaluate batting orders
A10 (Chapter 31). A run saved in over 20 of a chase carries a leverage weight of 2.29, against 0.72 in over 1. Defending with Mumbai Indians' 2026 attack, the leverage-weighted optimiser gives Bumrah overs 14, 16, 18 and 20. Why?
a) Bumrah is a death-overs specialist with little powerplay skill b) late runs move win probability most, so the best bowler should take the highest-leverage overs the Laws allow him c) the playing conditions require the strike bowler to bowl the last over d) pace is always cheaper than spin at the death
A11 (Chapters 6 and 35). A 5% edge at even money needs about 1,533 bets before it shows itself. An IPL season has roughly 70–74 matches. How many seasons of betting one side of every match is that?
a) about 2 b) about 7 c) about 21 d) about 60
A12 (Chapter 40). A straight line fitted to IPL first-innings averages for 2008–22 was used to forecast 2023–26. What happened?
a) All four seasons fell inside the line's 90% intervals b) All four fell outside their 90% intervals, by 12.6 rising to 22.6 runs, because the Impact Player rule changed the game the line was fitted on c) The line missed because it was overfitted to fifteen seasons d) The line forecast too high every year
Answer key — Section A
| Q | Answer | Explanation |
|---|---|---|
| A1 | b | About 11 runs a state apart but almost the same shape, so the IPL 2023–26 tables rescale the men's T20 pool shape (the IPL's own sample is only 281 innings). The bridge to Chapter 23's resource tables. |
| A2 | b | Leakage. The logistic model barely notices (0.1274 v 0.1301) because it is too simple to memorise matches. |
| A3 | b | Slope < 1 means the forecasts move further from 50% than the outcomes justify. WP v1's slope on 2023–26 men's T20 chases is 1.022. |
| A4 | c | An interval that includes zero is not proof of zero. (a) and (d) overread a null result. |
| A5 | b | The "nine-point verdict" for fielding first is the chase advantage seen from both sides. |
| A6 | b | Marcel RMSE 13.4 beat par (14.1) and last season alone (19.6): regression does the work. |
| A7 | b | Within ±15 in 41% after 6 overs, 51% after 10, 71% after 15. Run rate × 20 was the worst method, so (d) is false. |
| A8 | c | 19.3% in the IPL; 38.7% at men's international gaps; 52.6% at women's. |
| A9 | b | RCB's 5,040 orders span about 12 runs from worst to best. |
| A10 | b | Chapter 31 found phase skill is mostly general skill (noise-corrected powerplay–death r 0.58), so (a) is the wrong reason. The plan comes from leverage, not specialism. |
| A11 | c | 1,533 ÷ 72 ≈ 21 seasons. This is Chapter 6's small-sample problem at its most extreme. |
| A12 | b | An honest-looking interval cannot cover a rule change it has never seen. |
Section B — Short answer (16 points)
Answer each in 4–8 sentences.
B1. Shrinkage, from Chapter 6 to Chapter 25 (4 points). Vaibhav Suryavanshi's IPL 2026 SR+ was 151.8. Chapter 25's projection card for 2027 gives a weighted history of SR+ 149.0 on an effective 425 balls, a prior of 99.8 and k = 383, and projects SR+ 125.7 (80% interval 113.2–138.1 for 400 balls). (a) Show how the projection follows from reliability r = n / (n + k). (b) A fan says, "So the model thinks his 2026 was a fluke." Respond.
Model answer and marking
(a) r = 425 ÷ (425 + 383) ≈ 0.53. Projection = prior + r × (history − prior) = 99.8 + 0.53 × (149.0 − 99.8) ≈ 99.8 + 25.9 ≈ 125.7.
(b) The projection measures evidence, not talent. Two seasons and 449 balls can't tell "true SR+ 150" apart from "true SR+ 125 having a wonderful year", so it moves about half of the way from par to his record (observed performance = true ability + luck). Even so, 125.7 is the highest projection in the league by a distance (a strike rate of about 196 at 2026 par for his overs). If he repeats 2026, the projection will move a long way toward him. In Chapter 25's out-of-time test, these 80% intervals covered 80% of outcomes.
Marking: 2 for the calculation; 1 for "evidence, not verdict" with the sample size; 1 for a supporting point (still the league's highest projection, coverage 80%, or what new evidence would do).
B2. Two currencies (4 points). A classmate writes: "In Chapter 13 Pant's 2025 middle overs were −28.5 runs above replacement. Chapter 34 says his ₹27 crore price needed 21.4 runs above replacement per match. So he fell about 50 runs short." What is wrong with this, and what did Chapter 34 conclude about Anchor B?
Model answer and marking
The sentence mixes two scales. Chapter 13's RAR is a batting-only measure with its own replacement level. Chapter 34 uses Chapter 21's all-skills currency with a lower replacement level. On that scale Pant's 2025 middle overs are 0.0, not −28.5. One figure is also a phase total for a season and the other a rate per match. The two can't be subtracted.
Chapter 34's conclusion: 21.4 RAR per match would have been Pant's career best, a level reached in 7 of 466 regular IPL seasons. By phase he was above par only at the death (SR+ 116.6), yet about 80% of his 2025–26 balls came earlier. Verma could not be projected from his small sample. The edge was the portfolio of ₹30-lakh buys, not the skill to pick Verma in particular. Chapter 34 also admits its limit: its value measure ranked outcomes about as well as the prices did (Spearman 0.306 v 0.325).
Marking: 2 for identifying the two scales (1 for replacement level, 1 for season total against per match); 2 for Chapter 34's conclusion (the career-best bar and the portfolio point).
B3. Women's chases (4 points). A WPL broadcaster wants to show the men's WP v1 on screen, fed the women's scoring environment. Using Chapters 9 and 20, advise them.
Model answer and marking
Don't use it. Women's chases unfold differently, and knowing the scoring level doesn't fix that. Chapter 9's tables give "54 off 30 with eight wickets in hand" 0.652 for men and 0.256 for women. Chapter 20 tested the broadcaster's exact idea on women's T20 chases from 2023 to 2026: with women's environment and Elo, the men's WP v1 (Brier 0.1111) still overrated the chasing side by 9.4 points. A women's own WP v1 was best (Brier 0.0916, slope 0.95). Fit and validate a women's model on women's data, and check it on the WPL itself, which supplies only 88 chases in the data.
Marking: 1 for the Chapter 9 contrast; 2 for the Chapter 20 evidence (the 9.4-point overrating and the women's own model being better); 1 for practical advice that includes validation or sample size.
B4. Dew: eye test against data (4 points). A commentator says: "Evening game, dew's coming, field first." In the IPL, toss winners chose to field 69.5% of the time in the evening half of a double-header and 55.2% in the afternoon. Evening chasers won 51.2%, afternoon chasers 55.6% (difference −4.3 points, 95% interval −13.1 to +4.4). Respond, and name one thing the data cannot see.
Model answer and marking
Captains clearly act as though evening chases are easier: the 14.4-point jump in choosing to field is very unlikely to be chance (p = 0.0013). But the results give no support to a large dew advantage. Evening chasers won less often, and the interval rules out an evening edge much bigger than about four points. The data can't see dew: Cricsheet has no weather and no start time (the slot is inferred), so a particular dewy night could still favour the chaser. Integrated answer: on average dew doesn't help chasers enough to show in IPL results, but on a night when the ball is visibly wet, the commentator's information is worth more than the average.
Marking: 1 for reading the decision split; 1 for the result split with the interval; 1 for what the data can't see; 1 for integrating the two rather than dismissing either (Theme 5).
Section C — Data interpretation (20 points)
C1. How accurate can a pre-match model be? (10 points)
Chapter 24 prints this table for team-seasons with at least eight decided games. "Luck share" is the share of the spread in team-season win records that luck alone would produce. The oracle knows each side's true strength, so its numbers are a ceiling. Elo columns are walk-forward, out of time, 2023–26. A coin flip has a log loss of 0.693.
| Competition | Luck share | Oracle accuracy | Oracle log loss | Elo accuracy 2023–26 | Elo log loss 2023–26 |
|---|---|---|---|---|---|
| IPL | 0.916 | 54.3% | 0.687 | 47.6% | 0.708 |
| BBL | 0.795 | 58.6% | 0.670 | 58.1% | 0.676 |
| Men's T20Is (full members) | 0.589 | 63.1% | 0.639 | 64.1% | 0.637 |
| Men's ODIs (full members) | 0.407 | 66.8% | 0.603 | 61.2% | 0.645 |
| Women's T20Is (full members) | 0.363 | 70.6% | 0.558 | 71.9% | 0.555 |
| Women's ODIs (full members) | 0.333 | 72.3% | 0.534 | 72.9% | 0.516 |
C1a (3 points). The folklore says a good pre-match model is "60–65% accurate". For which rows is that roughly true, and in which direction is it wrong for the others? What property of a competition decides the answer?
C1b (3 points). Compute the largest possible improvement in log loss over a coin flip in the IPL and in women's ODIs (use the oracle). How many times larger is the women's ODI figure? What does the IPL Elo row mean?
C1c (2 points). In both women's rows, Elo beats the oracle. That can't happen against a true ceiling. Explain why it happens here.
C1d (2 points). A franchise owner asks you to "build a model that calls 65% of IPL matches". Reply in two or three sentences.
Answer key — C1
C1a. Roughly true for men's internationals (T20Is 64.1%, ODIs 61.2%). Wrong upwards for women's internationals (71.9%, 72.9%) and downwards for the franchise leagues (BBL 58.1%), above all the IPL (47.6%). The deciding property is how unequal the teams are: luck share runs from 0.916 (IPL) to 0.333 (women's ODIs). Drafts, auctions and salary caps are built to equalise franchise teams. (1 for each direction with figures; 1 for parity or luck share as the cause.)
C1b. IPL: 0.693 − 0.687 = 0.006. Women's ODIs: 0.693 − 0.534 = 0.159, about 26 times larger. The IPL Elo log loss of 0.708 is worse than a coin: the model lost a tiny possible edge and then some, over 286 matches. (1 per calculation; 1 for interpreting the IPL row.)
C1c. International schedules are not balanced (Australia's women play Ireland as well as England), and mismatches produce confident, usually correct forecasts. The oracle assumes balanced pairings, so in internationals it is a lower bound on the real ceiling. (2 for unbalanced schedules.)
C1d. Even a model that knew every side's true strength would call only about 54% of IPL matches, so 65% is beyond what the competition allows. Offer calibrated probabilities judged by log loss or Brier over several seasons, and spend effort where there is signal: valuation, the auction, matchups. (1 for the ceiling; 1 for a constructive alternative.)
C2. Rain in the 2023 IPL final (10 points)
From Chapter 23: Gujarat Titans made 214/4 in 20 overs. Chennai Super Kings were 4/0 after three balls when rain stopped play, and the chase was cut to 15 overs. Gujarat used their full innings (R1 = 100%). On the book's T20 resource table, CSK's resources for the shortened chase were R2 = 82.5%. The official target, set by the DLS software, was 171. CSK reached 171 off the last ball.
The Standard Edition rule when R2 < R1 is par = S × R2 / R1, target = ⌊par⌋ + 1.
C2a (3 points). Compute the par score and target on the book's T20 table.
C2b (2 points). Compute the target under the average-run-rate rule (Gujarat's run rate × 15 overs, plus one; ignore the three balls already bowled). Why is this rule generous to the chasing side?
C2c (3 points). Chapter 23's case study shows that if CSK had been one or two wickets down when the rain came, the book's target would have risen, from 177 to 186 and then 191. Explain why losing the same 30 balls costs less when wickets are down.
C2d (2 points). Across 70 clean shortened chases, the book's own-format table set a higher target than the official one in 95.7%, never a lower one, with a median of +6 runs (+4.6% of Team 1's score). What can you conclude, and what can't you?
Answer key — C2
C2a. par = 214 × 82.5 / 100 = 176.55 → par 176, target 177. That's six runs above the official 171. Under the book's table CSK would have finished six short. (1 for the formula, 1 for par, 1 for target.)
C2b. 214 × 15 / 20 = 160.5 → 161. The rule assumes runs scale with overs alone. CSK had all ten wickets for 15 overs, a much richer resource per over than Gujarat's ten wickets spread over 20, so a shorter chase with every wicket in hand can attack from the first ball. (1 for 161; 1 for the wickets-in-hand reason.)
C2c. Resources depend on balls and wickets. With wickets down, the side couldn't have used those 30 balls fully, because part of its run-scoring potential had already gone with the wickets. So the stoppage removes less resource, R2 stays higher, and the target is cut by less. (2 for the mechanism; 1 for linking it to a higher R2 and target.)
C2d. Can: the difference is systematic, not noise (never lower in 70 matches); the book's tables credit a shortened chase with more resource than the official method (the official 171 implies roughly 79–80%; the book's T20 table says 82.5%). Can't: that the official method is wrong. Deciding which is right needs outcomes, such as Chapter 23's check that pre-start-shortened T20 innings scored 1.003× the T20 table; the Professional Edition is not public. (1 each.)
Section D — Modelling critique (12 points)
Read this extract from a student's project report.
My IPL win-probability model. I trained a gradient-boosted model on every ball of every men's T20 chase in the data and held out a random 20% of balls as the test set. Test Brier score: 0.0185, about six times better than the book's WP v1. On those test balls, forecasts in the 20–30% bin won 25% of the time, so the model is perfectly calibrated. To show it works on today's game, I checked the 2026 IPL final: from over 10 onward it always made RCB favourites, and RCB won. I also backtested a betting rule on IPL 2023–26, using each team's season win share as a feature and betting whenever my model beat an Elo-based book by five points: +37.0% ROI. Finally, the model says a side needing 4 off the last ball wins only about 8% of the time, so a batter who hits that boundary deserves nearly a whole win of credit.
D1 (8 points). Identify four distinct problems. For each, name the problem (leakage, calibration or small samples), quote the book's evidence, and say what it does to the claim.
D2 (4 points). Describe a validation design that would make the report's headline number believable.
Answer key and marking — Section D
D1 (2 points per problem, any four):
- Random-ball split → leakage (Chapter 20). Balls from one chase land in both training and test; target, environment and Elo act as a fingerprint. The same model scored 0.0185 on a random-ball split and 0.1933 split by match, worse than WP v1 (0.1143 out of time). The headline is an artefact.
- Calibration checked on leaked data, in one bin. Calibration needs a reliability table across all bins, a slope and intercept, and calibration-in-the-large by league, on an honest split. Chapter 20's pre-2023 models under-rated IPL chasers in 2023–26 by 13.4 points; WP v1 cut that to 7.7.
- One match proves nothing (small samples; Theme 6). Forecasts are judged over many matches by Brier or log loss. Chapter 24's IPL favourites won only 47.6% of 286 matches.
- Season win share including the match → lookahead leakage (Chapter 35). The hindsight version made +37.0% ROI; the honest one (record before the match) +10.1%, 95% interval −3.2% to +24.0%, against an illustrative Elo book that was itself worse than a coin. The snapshot holds no real odds.
- The last ball is a small-sample, badly calibrated tail (Chapter 20). Needing 4 off the final ball, WP v1 says 7.8% but batters got there 34% of the time (47 cases), so the honest credit is nearer two-thirds of a win.
D2 (4 points): fit only on matches before a cut-off and test on later seasons, so no match is in both sets (2). Score with Brier and log loss against the base rate and WP v0, with a reliability table, slope/intercept, calibration-in-the-large by league and intervals from resampling matches (1). For any betting claim, use only pre-match information and report the number of bets with an interval (1).
Section E — Strategy case: the declaration (12 points)
At Adelaide in 2012, Australia declared their third innings to set South Africa 430 with 148.2 nominal overs left. South Africa batted 148.0 overs for 248/8 and drew. Chapter 33 prices the declaration, and the alternatives of declaring earlier or batting on at the push rate of 5.04 runs an over, with two models: a direct model of fourth-innings outcomes and Chapter 29's ball-by-ball simulator. Points use the World Test Championship scale (win 12, draw 4, loss 0), applied here as a pricing tool. Probabilities are from the chasing side's point of view.
| Overs earlier (−) / later (+) | Target | Overs left | Direct P(chasers lose) | Direct P(draw) | Direct points | Simulator P(chasers lose) | Simulator P(draw) | Simulator points |
|---|---|---|---|---|---|---|---|---|
| −20 | 348 | 168.2 | 0.607 | 0.369 | 8.764 | 0.673 | 0.059 | 8.315 |
| −10 | 376 | 158.2 | 0.641 | 0.341 | 9.060 | 0.751 | 0.067 | 9.283 |
| 0 (actual) | 430 | 148.2 | 0.725 | 0.263 | 9.755 | 0.808 | 0.138 | 10.248 |
| +10 | 480 | 138.2 | 0.787 | 0.204 | 10.260 | 0.729 | 0.271 | 9.835 |
| +20 | 531 | 128.2 | 0.835 | 0.157 | 10.651 | 0.662 | 0.338 | 9.296 |
| +40 | 632 | 108.2 | 0.898 | 0.093 | 11.144 | 0.419 | 0.581 | 7.349 |
The direct model's best is +40 overs (11.14 points). The simulator's is +2 overs, a target of 440 (10.42 points against 10.25). Across all third-innings declarations the direct model says "bat on" 93.8% of the time.
E1 (2 points). Verify the direct model's 9.755 points for the actual declaration.
E2 (3 points). Why should a captain not believe the direct model's advice to bat on for 40 more overs? What is that model good for?
E3 (3 points). Explain the simulator's interior optimum using the table. Name one known weakness of the simulator.
E4 (2 points). Suppose Australia had been 1–0 down and needed a win, so a draw was worth nothing to them (λ = 0). Which row maximises their value on the simulator, and why does the direct model give a different answer?
E5 (2 points). South Africa saved the match. Was the declaration a mistake? Answer as an analyst advising the captain.
Answer key — Section E
E1. 12 × 0.725 + 4 × 0.263 + 0 × P(chasers win) = 8.700 + 1.052 = 9.752, which is 9.755 before the probabilities are rounded. (1 for the formula, 1 for the arithmetic.)
E2. The direct model is confounded. Big leads happen when the declaring side is already dominant (a stronger attack, a worn pitch, a weaker opponent), so the model credits the lead with what dominance does. It has no interior optimum: its P(draw) at +40 overs is only 0.093. It is the best forecaster (out-of-time Brier 0.2741, against 0.3178 for the simulator), so use it to price a declaration as it stands, not to time one. (2 for confounding; 1 for "price, not time".)
E3. The simulator plays the fourth innings over by over, so the clock shows up directly. As the side bats on, P(draw) rises (0.138 → 0.271 → 0.338 → 0.581) while P(chasers lose) peaks at the actual declaration (0.808) and then falls: extra runs stop buying anything once the chasers only need to survive. Known weaknesses (any one): simulated chasers "block" at high required rates; it is less accurate overall than the direct model; it finds captains about right on average but too slow when 100 or fewer overs remain. (2 for the mechanism with figures; 1 for a weakness.)
E4. With λ = 0, value = P(chasers lose). On the simulator that peaks at the actual declaration (0.808, against 0.751 ten overs earlier and 0.729 ten overs later). The direct model's P(chasers lose) keeps rising (0.835 at +20, 0.898 at +40). That's the same confounding again: it never believes time runs out. (1 each.)
E5. Not on this evidence. Judge a declaration by its price, not its result (Theme 6). The simulator puts it within two overs of its best (10.25 against 10.42), and declaring 10–20 overs earlier was worse on both models. A draw is one outcome of a decision that usually wins. The analyst should add what the captain can see and the models can't (the pitch, the bowlers' workloads, the forecast, how the chasers are playing) and say how each would shift the call. (1 for "price, not result"; 1 for the eye test.)
Section F — Coding task with Crease (16 points)
Use the book's toolkit and your Crease package (project/crease/). You may consult
Appendix A,
Appendix B and the docstrings of crease.winprob.
F1 — Find the problems (6 points). A classmate evaluates a win-probability model like this:
from sklearn.model_selection import train_test_split
from crease import winprob as wp
data = wp.build_states(wp.MEN_T20)
chases = data.s2
train, test = train_test_split(chases, test_size=0.2, random_state=1)
model = wp.fit_wp(train, kind="gbm")
p = wp.predict_wp(model, train)
print("Brier", wp.brier(p, train["bat_won"]))
ipl26 = chases[(chases["competition"] == "ipl") & (chases["year"] == 2026)]
acc = ((wp.predict_wp(model, ipl26) > 0.5) == ipl26["bat_won"]).mean()
print("IPL 2026 accuracy", acc)
Identify three problems and say what each does to the result.
F2 — Write it properly (10 points). Write a script that:
- builds men's T20 chase states with
wp.build_states, splits them by time at 1 January 2023 withwp.split_by_time, and prints the number of chases in each part; - fits WP v1 (
wp.fit_wpwith its defaults) and a state-only model (extras=()) on the training part; - for each model, prints the test Brier score (
wp.brier), log loss (wp.log_loss), recalibration slope and intercept (wp.calibration_fit), and the IPL calibration-in-the-large (observed minus forecast win rate on IPL test chases); - prints WP v1's forecast for "54 off 30, 8 wickets in hand, target 170, Elo gap 0" with
env_par160 and 190.
Then answer in two or three sentences: which features made WP v1 better, is it calibrated, and why is its forecast lower in the 190 environment?
Answer key — Section F
F1 (2 points per problem, any three):
- Random split of balls (
train_test_spliton rows): balls from the same chase end up on both sides, so the test is leaked. Usewp.split_by_matchor, better,wp.split_by_time. - Scored on the training data:
predict_wp(model, train)measures memory, not forecasting. A flexible model's training Brier can be far below its honest test Brier (Chapter 20: 0.0117 in training against 0.1933 by match). - IPL 2026 is in the training set: about 80% of its balls were used to fit the model, so the "IPL 2026 accuracy" is in-sample.
- (Also acceptable) Accuracy on ball states counts each match about a hundred times, and ties
(
bat_won= 0.5) can never be "correct"; use Brier or log loss.kind="gbm": trees can't extrapolate into new scoring environments, which is why the logistic WP v1 won out of time.
F2 (reference solution):
import sys
from pathlib import Path
BOOK = Path(__file__).resolve().parents[3] # adjust to where you save the script
sys.path.insert(0, str(BOOK / "toolkit"))
sys.path.insert(0, str(BOOK / "project"))
from crease import winprob as wp
data = wp.build_states(wp.MEN_T20)
train, test = wp.split_by_time(data.s2, "2023-01-01")
print(f"train {train['match_id'].nunique():,} chases, test {test['match_id'].nunique():,} chases")
models = {"state only": wp.fit_wp(train, extras=()), "WP v1": wp.fit_wp(train)}
ipl = test["competition"] == "ipl"
for name, m in models.items():
p = wp.predict_wp(m, test)
y = test["bat_won"]
cal = wp.calibration_fit(p, y)
gap = y[ipl].mean() - p[ipl.to_numpy()].mean()
print(f"{name:10s} Brier {wp.brier(p, y):.4f} log loss {wp.log_loss(p, y):.4f} "
f"slope {cal['slope']:.3f} intercept {cal['intercept']:.3f} IPL gap {gap:+.3f}")
for env in (160, 190):
wpv = models["WP v1"].predict(54, 30, 8, target=170, env_par=env, elo_diff=0)[0]
print(f"54 off 30, 8 in hand, target 170, env_par {env}: {wpv:.3f}")
Output (book's snapshot):
train 5,272 chases, test 3,667 chases
state only Brier 0.1249 log loss 0.3874 slope 0.949 intercept 0.197 IPL gap +0.133
WP v1 Brier 0.1143 log loss 0.3591 slope 1.022 intercept 0.158 IPL gap +0.077
54 off 30, 8 in hand, target 170, env_par 160: 0.551
54 off 30, 8 in hand, target 170, env_par 190: 0.528
Interpretation: the gain comes from the context features (target, scoring environment, Elo gap); the state-only logistic (0.1249) is no better than Chapter 9's WP v0 (0.1252). WP v1's slope (1.022) is close to 1, so its spread is calibrated, but chasers still beat it in the IPL (+7.7 points, down from +13.3), so it is not calibrated in the large for the post-2023 IPL. In the 190 environment the forecast is lower because, with the target fixed at 170, a side needing 54 off 30 in a high-scoring world has been slow to get there, which hints at a hard pitch or a weak line-up.
Marking F2: time split and counts (2); both models fitted correctly (2); the four metrics, including the IPL gap computed on IPL test chases only (3); the two forecasts (1); interpretation (2). Accept equivalent code and small differences in formatting. Award full marks for paper answers whose code would produce this output.
After the exam
Use the results diagnostically. Weak scores on A2, A3, D1 and F1 point to Chapter 20's two lessons, leakage and calibration; re-teach them before capstone presentations. Weak scores on B1, A11 and C1 point back to Chapter 6: a student who can't say how much evidence a number rests on will overclaim from every model in Parts V–VII. Weak scores on E2 and B4 usually mean students are treating a model's output as a decision. See Common Struggles and the midterm.