KatInterview

Predicting Goal Probability for Individual Soccer Shots

Machine LearningModel answer
HardModel answerMachine Learningprobability-estimationfeature-engineeringcalibration

Last updated

Design a calibrated probability model that estimates how likely each soccer shot is to score, covering feature design, sparse regions, proper loss functions and calibration.

Context

You are building a shot-quality model for a soccer analytics team. For every shot, the model should output the probability that it ends in a goal. This is often called an "expected goals" score.

Data

You have about 500,000 historical shots from professional leagues. Each row contains:

  • shot_coordinates: the (x, y) position of the shot on a 105 m by 68 m pitch
  • angle_to_goal: the shooting angle measured relative to the goal's center
  • distance_to_goal: straight-line distance to the goal's center
  • defender_proximity: distance to the closest defender
  • is_header: whether the shot was a header
  • game_minute: the minute of the match
  • goal_scored: the binary label (1 = goal)

Questions

  1. Modeling and features. Describe the model you would use to estimate P(goal = 1 | features). Explain how you would turn the raw coordinates into features that capture the non-linear link between shot location and scoring chance.
  2. Sparse regions. Some locations (very wide angles, very long range) have only a handful of past shots. How do you keep the model from producing unreliable estimates there?
  3. Loss and metrics. Which training loss would you choose? Explain why plain accuracy, and possibly mean squared error, are inadequate for this task.
  4. Calibration. How would you make sure that, among 1,000 shots predicted at roughly 0.20, about 200 actually result in goals? Describe the procedure and how you would verify it.

Answer as you would in a technical discussion: give a clear strategy, justify the trade-offs, and mention pitfalls you would guard against.

Hints

Hint 1

Think geometrically: what a shooter actually sees is the portion of the goal mouth between the two posts, not the line to the goal's center. Also, the pitch is left-right symmetric around the goal.

Hint 2

Scoring chance changes quickly close to goal and levels off far away, so consider log-transformed distance, interactions (e.g. header with distance), and shape constraints such as monotonicity to stay sensible where data is thin.

Hint 3

Goals are rare (~10%), so a threshold-based metric hides everything interesting. Use a proper scoring rule for training, then fit a separate calibrator on held-out data split by time, and check calibration overall and within subgroups.