0
$\begingroup$

I have a regression model that is trained on a bunch of features and normalized targets so naturally when I use the model to predict on a new input, the output is also normalized (well not normalized per se but not what I expect to see). How should I deal with this? I tried using the inverse_transform function in sklearn that is in most scalers but it's not giving me correct results. This is probably because it wasn't already fitted on this data and therefore doesn't know how to inverse it. What can I do?

$\endgroup$
1
$\begingroup$

In linear regression, you don't have to normalize the output variable. This is actually why, for example, StandardScaler ignores y input even if you had entered. Also, inverse_transform is for the input variable. The prediction you get should be in your actual output domain.

$\endgroup$
  • $\begingroup$ Okay that makes sense. What if I'm normalizing the features, how would I normalize a new (testing) sample? Or do I not need to do that? $\endgroup$ – ninesalt Jan 15 at 15:07
  • $\begingroup$ Yes, you need. You first call fit method with training data and transform method with any data you want to transform. $\endgroup$ – gunes Jan 15 at 15:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.