Machine learning with football · Chapter 5 · Numerical data

Scrubbing

Missing values, duplicates, out-of-range numbers and bad labels: finding them and deciding what to do.

Estimated time: 10 minutes · page 6 of 9

Bad apples

Some rows are simply wrong, and they need finding before training. Google sorts the problems into four kinds, and the player stats have examples of most of them.

ProblemFootball example
Omitted values23 players here have no rating, usually because they only came on for a few minutes
Duplicate examples5 players appear twice. Check before deleting: Enzo Fernández, Iliman Ndiaye, Daniel Muñoz changed clubs, so both rows are real
Out-of-range values9,000 minutes after eleven matches, or a rating of 14 on a scale to 10
Bad labelsa goal credited to the wrong player, or one scout who rates everyone harder than the others

Small scripts catch most of these: count the missing values, look for repeated keys, flag values outside the possible range. Then remove the bad rows or fill in the gaps, which is called imputing.

The board shows a subtler case. Look at the ratings with no filter. The extremes, 5.1 and 8.4 in the Premier League, come from players with a handful of minutes, so one good or bad cameo makes their whole season. Set the minimum to 90 minutes and watch the tails shrink. Those numbers aren't wrong, they're just based on too little.

Check yourself

Five players appear twice in the Premier League list. What do you do?
A rating of 8.4 from a player who played 12 minutes. Out of range, mistake or noise?

Leagues