0
$\begingroup$

During the data preprocessing stage, I decided to apply the Label Encoding on one of the columns because it contained data points in string format. Suppose the column contains the following distinct values : -

pandas_dataframe["types"].values = ["a", "b", "c", "d"]

So I fit label encoder on types column values and the label encoder assigned it values like ("a", 0), ("b", 1), ("c", 2), ("d", 3)

All the above is done with respect to the training dataset.

But while preprocessing the test dataset, when I use the previously trained label encoder I observe that a new value (suppose e) is introduced in the types column on which the label encoder was never trained. In this situation how should I handle this new value e?

$\endgroup$

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.