Encoding Categorical Variables

70 min
Block 6 — Transforming the data
Objective
separate nominal, ordinal and binary variables rigorously; master one-hot encoding, ordinal encoding and label encoding, and know the exact domain of validity of each; identify and quantify the distortion an artificial order injects into a model; handle high cardinality with methods whose dimensional cost and leakage risk are both known; implement the whole thing correctly in a ColumnTransformer fitted on the training set alone.
Estimated duration
60 minutes
Prerequisites
chapters 005 (dataset structure), 006 (features and target), 013 (exploratory data analysis) and 014 (descriptive statistics); the notion of a train/test split (chapter 026)
Associated quizzes
022.1-quiz-why-encoding.md to 022.7-quiz-columntransformer.md

Preview — the rest of the lesson is for enrolled readers.

Already enrolled with a code?

Your access is tied to your account, not to this link. Sign in with the same email you used in class: your course is waiting, no need to enter the code again.

Sign inNo account yet? Create one
This lesson is part of the “Transforming the Data” module

The first modules of the course are open to everyone. For the rest you have three options: buy this course once and for all, subscribe, or enter the code handed out in class.

Are you a student on this course?

The code is tied to your account: sign in or create an account and it will be applied automatically when you come back.

No account yet? Create one