Sklearn inverse_transformation does not work as expected, any alternatives?

32 Views Asked by At
from sklearn.preprocessing import MinMaxScaler

values = df[['Close']] #values is floats ranging from 0.06 to 190.08

sc = MinMaxScaler()
scaled_values = sc.fit_transform(values)
descaled_values = sc.inverse_transform(scaled_values)

My problem is descaled values and original values does not match here. And since i cannot use inverse_transform, i can't convert my predicted value to an unscaled value.

I wrote the inversing function manually to understand:

def descale_prediction(predicted_value):

    return predicted_value * (maximum_value - minimum_value) + minimum_value

And realized that problem isn't the scaler but range of my values. Question is, what can i do alternatively to convert a scaled prediction value to unscaled one?

I'm sorry if this looks terrible, i don't really know how to use this website. :/

0

There are 0 best solutions below