# Use LSTM to predict large number instead of poboabilities

I want to predict datasets like this

I'm using Keras' LSTM:

Not like a classification problem which returns probabilities, this model needs to output the exact value depending on input giving to it. It means that the output might be a very large positive/negative number.

I noticed that the output of my model was very small, I think the reason is that the default LSTM activation is Tanh which output in range(-1,1), so I changed the activation from Tanh to linear. Besides, the model predictions were poor when using "Tanh" activation on LSTM in this case.

Am I doing this right? Or there's some other best activation I could use?

## Q2. Do I need to Standardize the data?

Do I need to standardize input? But if I scale the input how can the model return the exact value?

## Q3. Single target and shift target

### single target

• dataset: [1,2,3,4,5,6]
• input: [1,2,3],[2,3,4],[3,4,5]
• target:[ 4 ],[ 5 ],[ 6 ]

### shift target

• dataset: [1,2,3,4,5,6]
• input: [1,2,3],[2,3,4],[3,4,5]
• target:[2,3,4],[3,4,5],[4,5,6]

In my case, I got better results on using single target, but some of the examples are using the shifting target like this tutorial.

What is the difference between using the shifting target and the single target?

I would stick with the tahn. After all that is why you have the dense layer at the end. The activation function of the dense layer should be linear simply to do a projection of the output of the lstm cell in the desired range.

Q2. Do I need to Standardize the data?

Two options I think:

1. Standardize the input not the output. The correct outputs are the true numbers, but the inputs are the normalized ones. Then, when you perform inference you would need to directly use the outputs of the networks as inputs, so before providing the input just normalize it.
2. Normalize both, and then do inverse transform with the normalizer you are using on the output to get the true labels. However, this should be a tougher problem for the network since the difference between the outputs will be smaller.

Q3. Single target and shift target

The single target is kind of like the standard approach. The only problem being is that the gradients need to be propagated from the end of the network all the way to the start in order to adjust the weighs accordingly. Now, if you use a shift target, you are measuring the performance of the network at each time step, hence shorter gradient propagation. Usually it improves performance (read a couple of papers where they stated that it did, but for your case it might be different).