Does the score predict the match?
A capstone project for data science and statistics courses. Students rebuild the textbook model that turns points into games, sets and matches. Then they test its chances against real results from a free public sample of professional tennis. There are four milestones, a rubric and a starter repository with MIT-licensed code.
Open the starter on GitHubSee the data on Zenodo
What is the research question?
From any score in a match, the model gives each player a chance of winning. If it says 70%, do those players win about 70% of the time? Students measure that on real matches and explain the gaps.
The model is the one behind our win probability calculator. Every point is independent, and each player wins a point on their own serve with one fixed chance. On the calculator, a player who wins 64% of points on serve holds 81.3% of the time. The opponent, on 62%, holds 77.6% of the time. The first player wins a set 56.7% of the time and a best of three match 59.9% of the time. Over best of five it is 62.4%.
What data do students use?
The public sample of our point-by-point dataset, on Zenodo under DOI 10.5281/zenodo.22048730. The starter uses version 1.0.3, published 28 October 2026. It has three data files:
| File | Rows | A row is |
|---|---|---|
matches.csv.gz | 173,571 | One match: tournament, surface, round, best of three or five, scheduled time and the two players. The record gives the range as 1 January 2023 to 13 August 2026. |
players.csv.gz | 32,678 | One player or doubles team, with country, birth date and playing hand where known. |
points_sample_2026-06.csv.gz | 951,064 | One score state, in the order it was seen, for 5,380 matches of June 2026. |
The data is under CC BY-NC 4.0, the Creative Commons Attribution NonCommercial 4.0 licence. Students may use it for coursework and research with credit to Live Tennis API, but not for commercial work. The starter downloads it from Zenodo and never copies it into the repository.
What will students run into?
Real data, with the problems that come with it. We counted these in the June file before writing the brief.
- Of the 5,380 matches, 460 are doubles and 119 were best of five. 152 ended in a retirement, one in a walkover and one was cancelled.
- Only 216 tapes start at 0-0. Most begin after the first point, so a prediction often starts mid-match.
- The match file has no winner column. Students read it from the games in the last row, because the sets columns there do not always count the final set yet. Some tapes stop before the last point, so their winner cannot be read and the match is dropped.
- Some changes from one row to the next skip a point. Students have to find them before they count points won on serve.
- Eight matches in the match file are scheduled on 31 December 2022 in UTC, just before the range the record gives.
What are the four milestones?
About 30 hours of work in all. The hours are our estimate for a student who knows pandas and basic probability. Each milestone has its own notebook in the starter.
| Milestone | Students hand in | Hours |
|---|---|---|
| 1. Load and clean the sample | A table of the matches they keep with each winner, and a count of every match they drop and why. | 6 |
| 2. Rebuild the model | The five functions in the starter's model.py, passing its checks, and three estimates of each player's share of points won on serve. | 10 |
| 3. Measure calibration | A reliability diagram, the Brier score and the log loss for each estimate, with intervals and a baseline. | 8 |
| 4. Write up where the model breaks | Up to 2,000 words on where the chances come true and where they do not, with a number behind every claim. | 6 |
- Load and clean. The starter's loader downloads the three files by DOI and checks each one against its published checksum. Students join points to matches and players, keep singles and decide what to do with retirements.
- Rebuild the model. Students write hold, tie-break, set and match chances, then the chance from any score. The starter's tests check the result against the calculator's figures. Then they estimate each player's share of points won on serve in three ways. One uses the whole match, one only the points played so far, and one the player's earlier matches. The calculator's model is also a spreadsheet with every formula visible, so students can follow a figure cell by cell.
- Measure calibration. Students predict the winner at fixed points in each match and compare the chances with the results. Many predictions come from one match, so intervals come from a bootstrap that resamples whole matches.
- Write up where it breaks. Independence, break points, tie-breaks, the serve estimate and gaps in the tape are all fair game.
Where should students look for the model to break?
The first set is a good place to start. In the model, once each player's serve share is fixed, the first set's score says nothing about the sets still to play. Our comeback study counted 116,382 completed best of three singles matches from January 2023 to September 2026. A first set lost 7-6 was turned around 21.92% of the time. One lost 6-0 was turned around 7.18% of the time.
Does the model, with serve shares estimated from the first set, explain that gap? The same study found that player one won 58.7% of the matches, because player one is usually the stronger player. So a fair baseline for calibration knows which side is player one.
How do I grade it?
Out of 100 points. Change the weights to suit your course.
| Part | Points | Full marks when |
|---|---|---|
| Data and cleaning | 20 | Every dropped match is counted with its reason, and the winner rule is checked against the sets columns. |
| The model | 25 | Every check in tests/test_model.py passes. The report explains each serve estimate and says which one uses the future. |
| Calibration | 25 | Each estimate has a reliability diagram, a Brier score and a log loss. Intervals resample whole matches, and a baseline is beaten or the report says it is not. |
| Where the model breaks | 20 | At least three failures, each tested on the sample with a number. |
| Reproducibility | 10 | A fresh clone downloads the data, passes the tests and runs every notebook with no hand steps. |
The repository has no worked solutions, so it is fine for graded work. The model checks skip until a student writes each function, then pass or fail.
What do students learn?
- Load and clean a real point-by-point dataset, and count every exclusion.
- Build a probability model from the point up: game, tie-break, set and match.
- Estimate a model input without using information from the future.
- Measure calibration with a reliability diagram, the Brier score and the log loss.
- Put an interval on a score with a bootstrap that respects clustered data.
- Explain where a model fails, with evidence.
How do students get started?
They need Python 3.11 or newer. No API key and no account: the data comes from Zenodo. From a terminal:
git clone https://github.com/livetennisapi/tennis-capstone-starter.git
cd tennis-capstone-starter
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev,notebook]"
python -m capstone.data
pytest
The code is under the MIT licence, so you can change it for your class. Problems and suggestions are welcome as issues on the GitHub project.
Can students use the full dataset?
Yes, for a thesis or a research project. The full dataset is free for non-commercial academic research and teaching, on application to research@livetennisapi.com from an institutional address. Students should name a supervisor or give an ORCID. The academic dataset page has the details and how to cite it.
For shorter work, try the coding exercises for teachers. Running a hackathon? See what other teams built with tennis.
Teaching with the brief? Tell us how it went at hello@livetennisapi.com. We never publish anything about a class without the teacher's consent.
The record, the sample and the pages cited here were checked on 20 November 2026.