I learnt (from below links) that to effectively do target encoding without overfitting, we have to do cross validation for each fold (so kind of double validation) and compute the encoding values of categories based on the mean values of the remaining folds.

  1. IS this double cross validation already included in the 'TargetEncoder' class in categorical_encoders library ?
  2. If I use the targetencoder directly in a pipeline without any extra cross validation, will it be valid (like the double cross validation) or will it lead to overfitting?

From the below implementation on github of the class, I don't see any CV being done in fit and transform. https://github.com/scikit-learn-contrib/category_encoders/blob/master/category_encoders/target_encoder.py

Encoding categorical variables using likelihood estimation

Target encoding with cross validation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.