Machine learning with football · Chapter 5 · Numerical data

First steps

Plot it, then summarise it. Five percentiles say a lot about where the odd values hide.

Estimated time: 10 minutes · page 3 of 9

Look first

Before transforming anything, get to know the data in two ways. Plot it, the way the board's histogram does, and do it again at every step of your pipeline, because transformations can go wrong. Then compute a few numbers: the mean, the standard deviation, and the 0th, 25th, 50th, 75th and 100th percentiles. The 50th percentile is the median, and the 0th and 100th are the minimum and maximum.

The board shows all of them for the feature you pick. Goals make a good first case. The median is 0, three quarters of the players have at most one goal, and the maximum sits far above that.

Outliers

An outlier is a value far from most of the others, and outliers often cause trouble in training. A rough test: compare the gap between the 0th and 25th percentiles with the gap between the 75th and 100th. If one is far bigger, that end probably has outliers. Don't lean on it too hard, a histogram tells you more.

Once you find outliers, ask where they come from.

  • Mistakes, such as a typed extra zero or a broken feed. Delete or fix them.
  • Legitimate values, such as a striker on nine goals in eleven games. Keep them if the model has to predict well for players like that, otherwise drop them or soften them with clipping.

Check yourself

For goals the gap from the 0th to the 25th percentile is 0, from the 75th to the 100th it is several goals. What does the rule of thumb say?
A player is listed with 9,000 minutes after eleven matches. What do you do?

Leagues