I want to use the result of my PCA as an input for my LSTM model.

I began by Applying the MinMaxScaler and then did the PCA, (then I reshaped my data of course) :

sc = MinMaxScaler(feature_range=(0, 1))
data = sc.fit_transform(data)
pca = PCA()
data = pca.fit_transform(data)

The problem is, this give me a data between -1,23 and 1,33. I know that the input of an LSTM must be between range 0 and 1.

So what can I do ? Should I apply one more time a MinMaxScaler on "data" ?

  • $\begingroup$ The input to the LSTM doesn't have to be between 0 and 1, it could be negative. In fact, the negative inputs constantly occur in the inputs of deeper layers of LSTM. That's because tanh and sigmoid accept all of those ranges, - to say, their slope only starts to significantly change beyond -1 and 1. Unless you are using a one-hot encoded vector, your inputs can be negative and positive. $\endgroup$ – Kari Jan 6 '18 at 19:03

Your Answer

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

Browse other questions tagged or ask your own question.