Skip to content Skip to sidebar Skip to footer

Inverse Transform Predicted Results

I have a training data CSV with three columns (two for data and a third for targets) and I successfully predicted the target column for my test CSV. The problem is I need to invers

Solution 1:

You need to use the same label object which you used for transforming your targets to get them back. Each time you use the Label Enocder you instantiated a new object. Use the same object.

Change the following line

y_train_encoded = y_train.apply(le().fit_transform)
y_test_encoded = y_test.apply(le().fit_transform)

Then use the same object to reverse the transformation. You can check the first example here in the documentation for reference as well.

Post a Comment for "Inverse Transform Predicted Results"