Chapter 1: Classical ML
Features: turning categories into numbers
A model only does arithmetic, so every column must become numbers. The danger is to invent signal: a fake order, or two songs that look the same. Interviewers ask how you encode a column, and why.
What you will learn
- Choose one-hot, ordinal or hashed encoding by cardinality
Key terms
- codes
- numbers that stand for categories, such as 0, 1, 2
- weight w
- the number a model multiplies a column by
- one-hot
- one 0/1 column per category, with 1 for the row's category
Prerequisites
Take Elastic net: when two features carry the same signal first. It comes right before this lesson in the course.
Where this lesson picks up: So far every column was already a number, such as a house area. Real columns also hold categories, such as a plan name or a song. How do they become numbers a model can use?
What comes next
Number columns need care too: they come in different units, and some cells are empty.
Next lesson: Features: scaling and missing values
More lessons in this part
- Overfitting and the bias-variance decomposition 21 min
- Learning curves: is it bias or variance, and which fix? 7 min
- Cross-validation and choosing settings 7 min
- Regularization: ridge vs lasso and soft-thresholding 16 min
- Tuning the penalty: cross-validation and the one-standard-error rule 14 min
- Elastic net: when two features carry the same signal 14 min
- Features: scaling and missing values 15 min
- Preprocessing leakage and train-serve skew 7 min
Take the lesson
Short cards, one idea at a time, with quick checks as you go.