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?
1 Answer
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.
-
$\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$– ninesaltJan 15, 2019 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$– gunesJan 15, 2019 at 15:12