Machine learning with football · Chapter 5

Working with numerical data

Minutes, goals, ratings. Before a model sees any of them, each number needs a look and usually a little work.

Estimated time: 5 minutes · page 1 of 9

Most of the work happens before training

The first four chapters handed the model tidy numbers. Real data isn't tidy, and people who build models spend more of their time looking at, cleaning and reshaping data than training anything. This chapter is about numbers. Chapter 6 deals with categories, and chapter 7 with whole datasets.

Numerical data means values that behave like numbers: you can add them, count them and put them in order. A player's minutes, goals and average rating all qualify. A shirt number doesn't. Number 10 isn't twice number 5, it's just a label written in digits, and the same goes for a club's ID or a postcode.

The board shows this season's player stats for Premier League, 467 players. Pick a feature and look at its shape. Minutes cover the whole range from 0 to the maximum, with piles at both ends: squad players near 0 and regulars who play every minute. Ratings bunch around the middle, and goals pile up at zero with a few strikers far out on the right. Each shape will need different treatment.

Check yourself

Which of these is numerical data in the sense of this chapter?

What's in this chapter

How a model takes in numbers, how to look at a feature before using it, the four common ways to normalize, binning, cleaning out bad rows, a few habits that keep features sane, and a trick for relationships that aren't straight lines. The board stays the same throughout, so you can test each idea on the same players.

Terms on this page: Numerical data

Leagues