Last answered:

14 Oct 2024

Posted on:

12 Oct 2024

0

Resolved: label encoder error

in label encoder how can you fix a value error when you try to transform the test data but the encoder comes accross a new valuein the test data that didn't exist in the training set
1 answers ( 1 marked as helpful)
Instructor
Posted on:

14 Oct 2024

0
Hi Doaa,
You can fix the value error by using LabelEncoder's counterpart OrdinalEncoder or OneHotEncoder with the parameter handle_unknown='ignore', or manually map new values to a default or unknown label in the test data.
Best,
Ned

Submit an answer