Skip to content

Who plays most like him? Measuring player similarity with distance

Two players' stats are two vectors, and the distance between them measures how alike they are. It's how recruitment teams shortlist replacements, and it only works once every stat is put on the same scale.

Beginner Part 3 of Linear Algebra Through Football

Contents

The football question

Your best midfielder is leaving. Which player out there plays most like him?

Scouts answer that with eyes and experience. Recruitment teams also answer it with numbers, by measuring how far apart two players' statistics are.

The concept

In part 1, a player's match became a vector. Two players are two vectors, and two vectors are two points in space. The straight-line gap between those points is the Euclidean distance:

  • Small distance: similar profiles.
  • Large distance: different profiles.

It's Pythagoras. With two stats, passes and tackles, each player is a point on an ordinary graph and the distance is the diagonal between them. With four stats the picture is harder to draw, but the sum is the same.

A football example

Two midfielders, with passes, tackles, shots and chances created:

  • Player A: (68, 7, 3, 5)
  • Player B: (64, 6, 2, 6)

$$d(A, B) = \sqrt{\sum_i (A_i - B_i)^2}$$

$$\begin{aligned} &(68 - 64)^2 + (7 - 6)^2 \\ &\quad + (3 - 2)^2 + (5 - 6)^2 = 19 \end{aligned}$$

$$d(A, B) = \sqrt{19} \approx 4.36$$

In plain football

  • Subtract each stat: 4 more passes, 1 more tackle, 1 more shot, 1 fewer chance.
  • Square each gap, so a gap counts the same whichever player is higher: 16, 1, 1 and 1.
  • Add them and take the square root: √19 ≈ 4.36. On its own the number means little; it's for comparing. The smaller it is, the more alike they are.

Shortlisting a replacement

Player A is Player 1 from the midfield in part 2. Now measure him against Player B and the other three:

Candidate Distance from Player A
Player B (64, 6, 2, 6) 4.36
Player 2 (61, 6, 2, 4) 7.21
Player 4 (49, 3, 5, 7) 19.62
Player 3 (43, 2, 4, 6) 25.53

Player B is the closest match, then Player 2. Players 3 and 4, the attacking midfielders, are a long way off. That's the whole idea behind "similar player" tools: measure the distance from your player to every player in the database, and shortlist the nearest.

The scale trap

Look at what drove those distances: mostly passes. A gap of 25 passes squared is 625; a gap of 5 tackles squared is only 25. Passes run into dozens and tackles into single figures, so raw distance is dominated by whichever stat has the biggest numbers.

That can pick the wrong player. Imagine two candidates to replace Player A:

  • Candidate X is identical, except for 10 fewer passes: (58, 7, 3, 5).
  • Candidate Y is identical, except for 5 fewer tackles: (68, 2, 3, 5).

Raw distance says Y is twice as similar: 5 against 10. But Y has lost more than two-thirds of Player A's tackling. X has lost about a seventh of his passing. As a like-for-like replacement, X is obviously closer.

The fix is to standardise each stat first: divide every gap by how much that stat usually varies (its standard deviation), so each one is measured in "typical gaps" rather than raw counts. Using the spread across this midfield:

Raw distance Standardised distance
Candidate X (10 fewer passes) 10.0 1.02
Candidate Y (5 fewer tackles) 5.0 2.43

In plain football

  • Across these midfielders, passes vary by about 10 a match and tackles by about 2.
  • So 10 fewer passes is about one typical gap. 5 fewer tackles is about two and a half.
  • After standardising, X is the closer match, which is what a scout would say.

Standardising also reshuffles the shortlist. Players 3 and 4 were 25.5 and 19.6 away; standardised, they're level at 3.7, because the tackling and shooting differences now count as much as the passing.

Show the mathsThe general formula, standardising, and why squares. Optional.

For two vectors of length n:

$$d(\mathbf{a}, \mathbf{b}) = \sqrt{\sum_{j=1}^{n} (a_j - b_j)^2}$$

This is the length of the difference vector from part 1, written \(\lVert \mathbf{a} - \mathbf{b} \rVert\).

Standardising divides each coordinate by its standard deviation \(s_j\) across the group (often after subtracting the mean, which cancels out in a difference):

$$d_{\text{std}}(\mathbf{a}, \mathbf{b}) = \sqrt{\sum_{j=1}^{n} \left(\frac{a_j - b_j}{s_j}\right)^2}$$

Here \(s = (9.81, 2.06, 1.12, 1.12)\) for passes, tackles, shots and chances across the four midfielders of part 2. In real recruitment the spread would come from every player in the league, not four.

Squaring makes every gap positive and punishes one big difference more than several small ones. Other distances exist: the Manhattan distance adds the absolute gaps without squaring.

Why it matters

Distance turns "who's like him?" into a calculation, which makes it useful for:

  • Recruitment: shortlisting replacements from thousands of players.
  • Succession planning: spotting a young player whose profile resembles an established one.
  • Scouting: telling scouts which players to go and watch.
  • Comparison: putting numbers on "he's the new so-and-so".

The example uses four statistics. Real systems use 20, 50 or over 100, and the formula doesn't change: a longer sum under the same square root.

Limitations

  • Scale matters. Always standardise, or the stat with the biggest numbers decides everything.
  • Busier isn't different. A player who does everything twice as often as Player A has the same style but sits 68.6 away. Distance measures size as well as shape; comparing direction instead is the next idea in this series.
  • The stats decide the answer. Leave out defending and every midfielder who creates chances looks alike. The features you choose are a judgement, not a fact.
  • Similar numbers aren't similar players. Two midfielders can match statistically and differ completely in pace, positioning or temperament.

Try it yourself

Take three midfielders you know and write down their passes, tackles, shots and chances per 90 from any stats site. Work out the distance from one to each of the others, raw and then standardised. Does the closest match surprise you?

Further reading

  • Distance formula, Khan Academy. Pythagoras on a graph, the two-stat version of this article.
  • Euclidean distance, Wikipedia. The general formula, and how it relates to other distances.
  • Preprocessing data, scikit-learn. How standardising is done in practice, in Python's most used machine learning library.

Get new pieces by email

An email when something new is published, and the occasional update. Unsubscribe in one click. How your email is used.