Recall & Review
beginner
What is target encoding in machine learning?
Target encoding is a technique that replaces categorical values with the average of the target variable for those categories. It helps models use categorical data effectively.
Click to reveal answer
intermediate
Why do we use target encoding instead of one-hot encoding for high-cardinality features?
Target encoding reduces the number of new features created, avoiding a large increase in data size and helping models learn better from categories with many unique values.
Click to reveal answer
intermediate
How does target encoding help prevent overfitting?
By using techniques like smoothing and cross-validation, target encoding avoids leaking target information from the training set to the model, which helps prevent overfitting.
Click to reveal answer
advanced
What is smoothing in target encoding?
Smoothing blends the category's target mean with the overall target mean to reduce noise from categories with few samples, making the encoding more stable.
Click to reveal answer
beginner
Give a simple example of target encoding for a categorical feature with three categories and their target means.
If a feature has categories A, B, C with target means 0.2, 0.5, and 0.8 respectively, target encoding replaces A with 0.2, B with 0.5, and C with 0.8 in the dataset.
Click to reveal answer
What does target encoding replace a categorical value with?
✗ Incorrect
Target encoding replaces each category with the average of the target variable for that category.
Why is smoothing used in target encoding?
✗ Incorrect
Smoothing helps reduce noise by blending category target means with the overall mean, especially for rare categories.
Which problem can target encoding help solve better than one-hot encoding?
✗ Incorrect
Target encoding is useful for high-cardinality categorical features where one-hot encoding would create too many new columns.
What is a risk of using target encoding without precautions?
✗ Incorrect
Without careful handling, target encoding can leak target information into features, causing overfitting.
Which method helps avoid overfitting when applying target encoding?
✗ Incorrect
Computing target encodings using cross-validation prevents the model from seeing the target values of the same data points during training.
Explain what target encoding is and why it is useful for categorical data.
Think about how categorical values can be turned into numbers that carry information about the target.
You got /3 concepts.
Describe how smoothing and cross-validation help make target encoding more reliable.
Consider how to avoid mistakes when using target information to encode features.
You got /3 concepts.