I just started to study time-series forecasting using RNN.

I have a few months of time series data that was an hour unit. The data is a kind of percentage value of my little experiment and no other correlated information this. It is simple 1-D array info. I would like to forecast the future condition of this. Many tutorials and web info introduced direct training and forecasting the time series data without any data pre-processing.

But for the RNN (or ML and DL), I think we should consider the data's condition that is stationary or not.

My data is totally random condition which is stationary data (no seasonality, no trend).

For example, the US stock prediction tutorial showed super great accuracy forecasting performance according to many LSTM tutorials. [If this really works and is true, then all ML developers will be rich.]

And, Some of them didn't emphasize and note a kind of the data pre-processing such as non-stationary to stationary something like that.

According to my short knowledge, I think the non-stationary data such as stock price (will have trend) should be converted as a stationary format through differencing or some other steps. and I think this is a correct prediction as a view of theoretical sense even if the accuracy is not high.

So my point is, I'm a bit confused about whether that really is no need for any preprocessing to treat stationary or not.

For my case, I applied differencing step ($t_n - t_{n-1}$)to my time-series data in order to remove the trend or some periodic situation.

Is my understanding not correct?

Why do time-series forecasting tutorials not introduced data stationarity?


1 Answer 1


Models based on the stock markets are often unreliable because there is a lot of noise and even if it seems to predict well for the validation data, the result is very different in practice.

What you call stationary means depending on previous values in a relative way, and predicting stock markets should follow this rule.

However, RNN and LSTM have been built to memorize low-noise patterns, so you will want to apply some noise reduction like smoothing for better results.

In addition, I recommend converting data to have fluctuations (=derivates) rather than raw values, so that the neural network learns data dynamics.

For a good model, you must simulate prediction vs real-world results for each day. It means evaluating the model prediction for day 1, checking if the result is correct or not, then feeding the neural network with this information, and applying the same logic for day 2 and so on.

Generally speaking, stock markets are so difficult that you will want to use multi-variate and seasonality models. Maybe Prophet is a better option.


  • $\begingroup$ Thank you for your very clear answer. I have a new question then. 1. Does 'data to have fluctuations' mean that I need to take care of differencing, Moving average, or other methods? 2. In my case (My data : Memory usage status as a percentage unit), I trained the LSTM model using 2-month data and build a forecasting structure that will return 6 hours of memory usage results. according to your suggestion, 6 hours of results should calculate and use for the training again one by one based on the comparison between the predicted value and new data, not a 6 hours return at one time. Am I correct? $\endgroup$
    – orde.r
    Commented Jun 8, 2023 at 23:55
  • 1
    $\begingroup$ You're welcome. Stock exchange is already complex enough to add more prediction conditions. Basically, you should focus on simple decision making, which is 6 hours sampling and one prediction every 6 hours in your case. In addition to that, LSTM has a limited memory of around 100 to 200 values, 300 max, depending on data complexity. That's why you should select your model according to its constraints, its dependency to noise, and compare it to other ones. Stock exchange is a difficult but very interesting area that requires a lot of trials. $\endgroup$ Commented Jun 9, 2023 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.