LSTM-Neural-Network-for-Time-Series-Prediction icon indicating copy to clipboard operation
LSTM-Neural-Network-for-Time-Series-Prediction copied to clipboard

Code for De-Normalization

Open Emuly opened this issue 6 years ago • 9 comments

Can someone write code for De-Normalization so I can plot predictions on real data values

Emuly avatar May 22 '19 14:05 Emuly

Same request here.

marmartintsang avatar Jun 03 '19 16:06 marmartintsang

Same request here.

RickPang avatar Jun 25 '19 07:06 RickPang

Same request here.

ZionYuan avatar Sep 15 '19 10:09 ZionYuan

@alexbrillant We here have the demonstration of a good use-case for a NormalizationWrapper MetaStep object.

We should code a NormalizationWrapper (MetaStep) in Neuraxle that normalizes the data before sending it to a wrapped pipeline step, and that then denormalizes it before returning the results.

Inside that, the same normalization could be applied to y from the normalization values learned from x such that the wrapped neural network just sees normalized data and also predicts normalized data.

The same concept could go with a LogWrapper that would take the LogPlusOne of the values and also undo the transformation after.

Even further into this thinking, we could have a step that instead has a principal wrapped step, and also a list (or pipeline) of other steps to "apply" as preprocessing and then "unapply" as a reverse transformation after the processing is done to properly wrap the neural network. Let's call this a ReversiblePreprocessingWrapper.

Actually, I opened an issue here to do that, as we'll need it anyways: https://github.com/Neuraxio/Neuraxle/issues/59

guillaume-chevalier avatar Sep 16 '19 03:09 guillaume-chevalier

Can someone write code for De-Normalization so I can plot predictions on real data values

the denormalization formula is given onthe altumingelligence article.... i could post the code here to do it in place where the normalization is done if you like, but it it very straightforward

kitt-th avatar Sep 26 '19 09:09 kitt-th

@kitt-th Can you write the code here? I really need it, thank you.

hao940953596 avatar Sep 28 '19 02:09 hao940953596

sure to do a reverse check - ie denormalisation, inside the normalisation function, do this

denormalized_col = [ ( float(window[0, col_i]) * (float(n) + 1 ) ) for n in normalised_col ]

(denormalisation func - Pi = Po*(Ni + 1) (from the article text)

kitt-th avatar Sep 28 '19 10:09 kitt-th

I don't think it is possible to denormalise the predicted data with that formula. It will results in some values very close to 0. I suggest to change the normalisation to use MinMaxScaler from sklearn instead. You can denormalise using the invert function.

jimfoo88 avatar Oct 28 '19 16:10 jimfoo88

I don't think it is possible to denormalise the predicted data with that formula. It will results in some values very close to 0. I suggest to change the normalisation to use MinMaxScaler from sklearn instead. You can denormalise using the invert function.

could you write this MinMaxScaler code here?thank you!!

zhangzhang-vvv avatar Mar 28 '20 10:03 zhangzhang-vvv