What is target encoding and what are its risks?

Updated May 16, 2026

Short answer

Target encoding replaces categorical values with the mean of the target variable for each category.

Deep explanation

Target encoding is powerful for high-cardinality categorical variables. However, it can cause target leakage if not done properly. It should always be applied using cross-validation to avoid overfitting.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Feature Engineering interview questions

View all →