Machine learning with football · Chapter 5 · Numerical data

Qualities of good features

Clear names, checked values and no magic numbers. Small habits that save hours.

Estimated time: 5 minutes · page 7 of 9

Three habits

Clear names

Anyone on the project should understand a feature from its name. time: 54000 could be anything. minutes_played: 900 can't be misread.

Checked values

Look at the data before training. A player_age_years of 224 means something upstream broke, and a model will happily learn from it if nobody looks.

No magic values

It's tempting to write −1 for "no rating". The model can't know that −1 is special. To it, −1 is a disastrous rating, far below the real worst of 5.1, and it learns from it like any other number. Put a neutral value in the rating instead and add a separate flag, has_rating, set to 1 or 0. The feature vector page does exactly that.

For a feature with a fixed set of values, such as a player's position, a missing value can simply become its own category: goalkeeper, defender, midfielder, forward, unknown.

Check yourself

Which feature name follows the advice?
Players without a rating get −1 in the rating column. Why is that a bad idea?

Leagues