What is the consequence of using ‘handle_unknown=’ignore” in OneHotEncoder during transformation?
Data ScienceMedium
Data Science — Medium
What is the consequence of using ‘handle_unknown=’ignore” in OneHotEncoder during transformation?
Explanation
When 'handle_unknown' is set to 'ignore', the encoder will not raise an error if it encounters a category during transformation that was not present during fitting. Instead, it will represent that unknown category as a row of all zeros in the resulting one-hot encoded matrix, effectively ignoring the feature's contribution.