Most xG models know where a shot was taken from. Far fewer know what stood between the ball and the net. In 2023, Hassani Karim and Lotfi Marwane proposed a single number that captures exactly that: the Kos Angle, the slice of the goal a shooter can still see once the bodies in the way are subtracted. This article explains how the variable is computed, why it turned out to be the most important feature in their models, and what happened when I re-trained the same models on a different dataset for the simulator behind this site, as part of my 2024 undergraduate project at UFRJ.

The problem with the plain shot angle

The classic geometric feature in xG models is the shot angle: the angle formed at the ball by the two goalposts. Stand on the penalty spot and the goal spans a wide angle; drift towards the byline and that angle collapses towards zero. Angle plus distance to goal gets you surprisingly far. Several papers reviewed in my project reach a ROC-AUC around 0.79 with little more than those two variables.

But the shot angle treats the goal as if it were always empty. A shot from the penalty spot with a clear view and the same shot with three defenders and the goalkeeper lined up in front of it get the same angle. Anyone who has watched football knows those are not the same chance.

What the Kos Angle is

Karim and Marwane’s idea is to keep the shot angle but remove from it every part that is blocked. Draw the triangle formed by the shooter and the two posts. Every opponent, teammate or goalkeeper standing inside that triangle occupies a small angle of their own, as seen from the ball. The Kos Angle is:

Kos Angle = shot angle − (sum of the angles occupied by each player inside the shot triangle)

The result is the angular width of goal that is still open. A completely unobstructed shot has a Kos Angle equal to its shot angle. A shot taken straight into a wall of bodies has a Kos Angle near zero, no matter how close to goal it is.

Two practical details make the number computable from event data. First, players are not points: each one is given a fixed width, and the angle they block depends on that width and on their distance from the ball. Second, the orientation of each player matters in principle (a defender turned sideways covers less goal than one facing the ball), but orientation is not available in most datasets, so the authors assume every player inside the triangle is facing the ball. I kept both choices in my implementation.

How the simulator computes it

The simulator reports the Kos Angle in degrees and the number of players counted inside the shot. The rules follow the original paper:

  • Widths: 0.4 m for attackers and teammates, 0.5 m for defenders, 1.4 m for the goalkeeper, whose arms are the reason the figure is so much larger.
  • Who counts: a player is “inside the shot” if any point of their width segment falls inside the triangle formed by the shooter and the two posts. A defender with one shoulder in the lane still blocks part of the goal.
  • Orientation: every player is treated as facing the ball.

If you place a goalkeeper on the line and then slide a defender into the lane in the simulator, you can watch the Kos Angle shrink while the plain angle stays fixed. That is the whole point of the variable in one picture.

The rest of the model

The Kos Angle is one feature among several. The Karim & Marwane model also uses the plain shot angle, the distance to the centre of the goal, the shot location, whether the shooter was under pressure, a one-hot encoding of the body part and a one-hot encoding of the technique. The original paper also uses a flag for whether the shot followed a dribble; that is the one variable I could not reproduce from the Statsbomb open data, so it is absent from my version.

The authors trained three classifiers and so did I: a decision tree (DTC), a random forest (RFC) and gradient boosting (GBC). My implementation uses scikit-learn, with hyperparameters chosen by grid search and evaluation by 5-fold cross-validation. Because my training set was smaller than the authors’ 68,382 shots, I balanced the classes with imbalanced-learn before training. The original paper used a plain 80/20 split and no balancing. Those two differences matter for reading the numbers below.

What the Kos Angle changed in the original paper

The cleanest way to see the value of a feature is to train the same model with and without it. Karim and Marwane did exactly that. Their gradient boosting model moved as follows when the Kos Angle was added:

Metric (GBC, original paper)WithoutWith Kos Angle
Precision0.63500.6812
Recall0.09160.1125
RMSE0.28250.2806
Brier score0.07980.0787

Across the three classifiers, precision rose between 7% and 11% and recall between 8% and 33%, while RMSE and Brier score improved by about 1% to 2%. The pattern is consistent: the new feature helped most where the models were weakest, which in the original setup was identifying the rare goals among the many misses. SHAP importance plots in the paper rank the Kos Angle as the single most influential variable in all three models.

What it changed when I re-trained the models

My training set is the one used throughout this site: 23,098 open-play shots from seven Statsbomb open-data competitions, with penalties and free kicks removed. Here is the same before/after for the random forest, which was the best of my three classifiers on calibration:

Metric (RFC, this project)WithoutWith Kos Angle
Precision0.90490.9290
Recall0.90290.9118
RMSE0.30980.2809
Brier score0.07240.0613

The precision and recall figures look far higher than the original paper’s, and that is an artefact of balancing the classes: once goals and misses are equally represented, a classifier no longer gets rewarded for predicting “no goal” every time. The honest comparison is the direction of change, and here the Kos Angle shows a different face. Precision and recall moved by only 1% to 3%, but RMSE fell by 3% to 9% and the Brier score by 7% to 15% depending on the classifier. In other words, on a balanced dataset the feature did little for classification but a lot for calibration: the probabilities themselves became more accurate. Since xG is a probability, that is arguably the improvement that matters.

The SHAP plots for my models also keep the Kos Angle near the top, although it is not as dominant as in the original paper. A plausible explanation is that with the dribble flag missing and the data balanced, the distance and angle features absorb part of the signal.

Choosing the model for the simulator

Three trained classifiers cannot all run in the simulator under the same name, so I held out the last 20% of the dataset (about 4,600 shots, 474 of them goals) and compared each model’s xG with Statsbomb’s own xG for the same shots.

ModelTotal xGMAERMSEPearson r
Statsbomb (reference)438.5–––
Decision tree457.00.14840.27640.39
Random forest459.90.05690.09360.76
Gradient boosting448.70.04400.08220.80

Gradient boosting won on every metric, with a correlation of 0.80 against a commercial model that uses richer data, so it is the model labelled Karim & Marwane xG in the results table. The decision tree is a useful reminder that a single tree produces staircase probabilities that correlate poorly with anything smooth.

Where the Kos Angle shines in practice

Chapter 5 of my project runs a hypothetical shot from the goal line with nobody around. The Karim & Marwane model returns 98%, the most sensible answer of all the models in the simulator for a practically guaranteed goal. The combined model built from Anzer & Bauer, Hewitt & Karakuş and Narayanan & Pifer gives 78%, and the CNN model gives far less. The Kos Angle is a big part of why: an empty triangle in front of the ball is the strongest possible signal the feature can send.

The effect is just as visible from the penalty spot. With the keeper on the line and nobody else, the Kos Angle is 29.6° and the model gives 86%. Put three defenders in the lane and the shot angle has not changed, but the Kos Angle drops to 13.0° and the model to 70%.

Goal-line shot, empty net Penalty spot, clear view Penalty spot, three defenders in the lane

Its limits are the flip side of the same assumptions. Because orientation is unknown, a defender running away from the ball blocks as much as one squared up to it. Because widths are fixed, every goalkeeper is 1.4 m wide whether crouched or spread. And because only players inside the triangle count, a defender one step outside the lane, about to slide in, contributes nothing. None of these are flaws in the idea; they are the price of computing it from event data rather than tracking data.

Further reading

  • How xG models differ — the Kos Angle model next to Rathke, the CNN and the combined model.
  • xG from pixels — the convolutional model that handles the same defenders as an image instead of an angle.
  • The xG glossary — Brier score, RMSE, SHAP and friends in plain English.
  • Open the simulator, place a goalkeeper, then drag defenders into the lane and watch the Kos Angle row fall.

Primary source: Karim, H.; Marwane, L. (2023). The Kos Angle, an optimizing parameter for football expected goals (xG) models. International Journal of Computer Science in Sport, 22(2), 49–61. DOI 10.2478/ijcss-2023-0010. Re-training results from Schlaepfer, A. (2024). Modelos de expected goals no futebol: desenvolvimento de um simulador de chutes. Undergraduate project, UFRJ.