AI engineering glossary · Feature engineering data prep

What is k-fold target encoding?

K-fold target encoding: Computing target encoding values for each fold using only the other folds' data, so a row's encoding never uses its own label. This out-of-fold approach makes the encoded feature safer and gives a more honest estimate on validation data.

Level: advancedTopic: Feature engineering data prep

K-fold target encoding: an example

With 5 folds, rows in fold 1 get city means calculated from folds 2 to 5 only, and the same is done for every other fold.

Related terms

More Feature engineering data prep terms

Where you learn it

K-fold target encoding is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.