Inspiration

As a returner, I spend most points guessing. A top pro's serve can go over 130 miles per hour and reaches the returner in about half a second, so you have to pick a direction before the ball crosses the net. Only top pros have analysts who chart where every opponent serves. Junior players, college players and lower-ranked pros do not. In one review of the 2013 season, only 336 men and 253 women in the world earned more than they spent on tennis, and that was before paying a coach. I wanted to find out whether a serving habit can be measured from public data, whether it repeats from match to match, and whether it changes under pressure.

A few tennis terms

  • Server and returner. Every point starts with a serve. The server hits it into a box on the other side of the net, and the returner tries to hit it back.
  • First and second serve. A server gets two tries. If the first serve misses, the second is usually slower and safer, so this project focuses mainly on first serves.
  • Deuce side and ad side. Points alternate between the right half of the court (deuce side) and the left half (ad side). Servers often aim differently from each side, so every result here is split by side.
  • Out wide, at the body, down the middle. The three directions a serve can go: toward the outside edge of the service box, straight at the returner, or toward the center line.
  • Break point. A point where the server is one point from losing the game. It is the highest-pressure moment for a server.
  • Tiebreak. A special game played at 6 games all to decide a set. Its scoring and serving order are different, so tiebreak points are left out.
  • Charted serve. A serve that a person watched and wrote down, including where it went.

What it does

Serve IQ answers one question for returners and their coaches: where should I expect this player to serve, and how does that change on a break point?

  • Guess the serve. Pick a pro and a side of the court, then guess where the first serve goes. The court draws the real serves and shows how often that player went there, next to an average pro and a random guess.
  • Break points. One button switches to break points, using only that player's break-point serves.
  • Player card. Each player and side gets a card with their favorite direction, its 95% range, how uneven the habit is compared with other pros, any break-point change that passes its test, and how many charted serves it takes to see the habit.
  • Explorer. A chart of all 894 first-serve sides (447 players, 2 sides each) shows which habits are worth knowing: 202 have a clear edge over guessing like an average pro, and 40 show a clear break-point change.
  • Match model. For players nobody charts, a separate model watches a broadcast match video and takes notes on each point: who served, from which side, the score, the serve direction and who won.

For example, Nick Kyrgios serves down the middle on 50 of 100 first serves from the ad side (range 48 to 52, from 4,418 charted serves). On break points, out wide rises to 60 in 100.

How I built it

Data. The source is Jeff Sackmann's Match Charting Project, where volunteers watch professional matches and write down every shot in a shorthand code. I converted that code into a table with one row per serve, 2.56 million in total, and fixed common mistakes: the same point entered twice, a second serve logged after the first serve went in, and one player listed under two names. After removing tiebreak points (3%), serves with no recorded direction (0.2%) and a few points with missing or unusual details, 2,473,821 serves from 1,738 players remain. To check my work, I compared my counts with the dataset's own totals for each player in each match. They match exactly 99.0 to 99.6% of the time. Player cards cover the 447 pros (249 men, 198 women) with at least 300 charted first serves per side and 10 charted matches.

Statistics.

  • Compared with an average pro. Each player's mix of directions is compared with an average pro facing the same mix of left- and right-handed opponents, because the same serve goes to a right-hander's backhand but a left-hander's forehand. This uses a Wald test with errors clustered by match, since serves in one match are related.
  • Compared with themselves. Win rates by direction and break-point changes for each player use Cochran-Mantel-Haenszel tests stratified by match, so a player is only compared with themselves in the same match.
  • All players on break points. The tour-wide change comes from a linear model with fixed effects for each match, server and side, with errors clustered by server and returner.
  • Removing flukes. With 8,929 tests in three families, some results look real just by luck. A Benjamini-Hochberg correction removes likely flukes and holds the false discovery rate at 5% in each family.
  • Checking that results repeat. I split each player's matches into two random groups and measured how well the groups agree across players.

The number of charted serves needed to tell a player's top two directions apart, with shares $p_1$ and $p_2$, is

$$d = p_1 - p_2, \qquad n = \frac{z^2\,(p_1 + p_2 - d^2)}{d^2}, \qquad z = 1.96$$

This is a rule of thumb from the observed shares, not a power calculation. The median side needs about 375 serves, roughly 10 matches.

Site. Python prepares small data files. The site is hand-written HTML, CSS and JavaScript, with KaTeX for the 14 formulas on the Method page, hosted on Netlify with a Streamlit backup. A checker script recomputes the numbers on the site from the data files, and a browser test clicks through the page at desktop and phone sizes.

Match model. A separate Python program for macOS finds the main camera shots in a broadcast, reads the on-screen score with Apple Vision, rebuilds the score with a tennis rules engine, fits the court lines, tracks players with YOLO, follows the ball, and sorts each serve bounce into a direction.

I built the project with help from Claude Code, an AI coding assistant.

Challenges I ran into

My first version asked which serve direction wins the most points. The data did not support it. Only 24 of 447 players show a clear win-rate gap by direction on first serves, none do on second serves, and the gap barely repeats between two random groups of a player's matches (correlation of -0.02 to 0.17). This fits game theory: if one direction clearly won more, servers would use it until it stopped working (Walker and Wooders, 2001). The serving habit itself does repeat (correlation of 0.57 to 0.69, where 1 is a perfect match), so I rebuilt the tool around where a player serves.

The second challenge was running thousands of tests without fooling myself. With that many comparisons, some players look unusual by luck alone, so every test family is corrected for that and every range accounts for serves in one match being related.

For the match model, the hardest part was stopping it from guessing. When it cannot see the bounce clearly, it leaves the direction blank.

Accomplishments that I'm proud of

  • I kept the main result even though part of it is a negative finding: most players do not win more by serving in one direction.
  • On first serves, 604 of 894 sides (68%) serve differently from an average pro, and the typical gap is 4 serves in 100.
  • On break points, first serves go out wide 1.2 more times in 100 for women and 1.7 for men, compared with the same server in the same match. For some players the change is large: Rafael Nadal, from the deuce side, goes out wide 30 times in 100 on other points and 45 on break points.
  • On a 10-point demo clip of Sinner and Alcaraz, the match model named the direction on 8 of 10 serves, all 8 matched a chart made by eye, and it identified the point winner on all 10 points. The site shows its blanks next to its correct calls.

What I learned

A pattern in sports data only counts if it survives a fair test, and the first idea I was most excited about did not. I learned to split data in half to check whether a result repeats, to correct for running thousands of tests, and to report what the data cannot show as clearly as what it can. A smaller, verified claim is more useful to a coach than a large claim that falls apart.

What's next for Serve IQ

  • Test the match model on new matches, including college streams with break points, and compare its directions with volunteer charts of the same serves.
  • Let a coach load several matches of one opponent into the same player card.
  • Give the card to college coaches before real matches and log each call against where the serve went, so its value is measured.

Limits. Volunteers choose which matches to chart. The charts record where the serve went, not what the returner did, so I can say where a server tends to go, not whether knowing it wins points. Win rates by direction cannot prove that a direction causes wins. The match model was tuned on its demo clip, which contains no break points.

Sources. Earnings: ITF review of the 2013 season, via FiveThirtyEight. Serve speed: ATP Tour. The half-second figure is my own estimate from court length and ball speed.

Data and license. Match Charting Project by Jeff Sackmann and contributors (CC BY-NC-SA 4.0). Code: MIT, except the match model, which uses Ultralytics and is GNU AGPLv3. Player photos: Wikimedia Commons, credited on the Method page.

Built With

Share this project:

Updates

Submission history