I am working on a project for predicting the number of DNS queries from the site: DNS queries statistics. The data I use is minutely data, which means the number of DNS queries of every minute.

If you look at the number of DNS queries from South Korea or any other countries, it has the seasonality and trend characteristics: increase then decrease day by day.

The requirement for me is: given the number of DNS queries of every minute, then for the given data of 20 previous minutes, predict the number of DNS queries in the next 20 minutes.

My problem is: my trained LSTM could not detect these factors, it always predicts my data to decrease everytime.

I have employed some hand-defined features like the minute of the day, period of the day like morning/afternoon... But it still keeps the same problem.

So I want to ask if there is any possible improvement to make my LSTM to understand when it should decrease and when it should increase with the seasonal data?

  • $\begingroup$ What about using Prophet? $\endgroup$
    – Aditya
    Aug 18, 2018 at 9:53
  • $\begingroup$ I think you might get more specific suggestions if you described how much data you have (number of days) and what platform you are using (Keras?, other?) I ask about number of days because I noticed that hte linked site that their plots were labeled as smoothed even with durations as short as a week. $\endgroup$
    – 42-
    Nov 20, 2018 at 16:14

2 Answers 2


I don’t know if the seasonality will be achievable in your predictions, due simply to the timeframes you we using. If you see a daily up—down movement, but only provide 20 minutes for a prediction, how will the Model know whether or not it is at a turning point? You would perhaps need to include other features that contain that information - perhaps even the time stamp would suffice.

It is odd, that the model always predicts a downward movement — I would have expected it to simply continue on the current path (up or down), assuming you have both directoins in your training data...?

Perhaps you could look into some ideas used in common timeseries analysis methods, like separating the seasonality, trend and noise and feeding them separately to the model. Search for terms SARIMA, ARIMA, seasonality and cycles. (S)ARIMA stands for “seasonal autoregressive integrated moving average”, and represents a common way to look at data over time using previous values (autoregressivej, the differences of current value to previous values (integrated) and a moving average of past time steps (moving average).

The terms generated would of course catch the phases where the value changes direction and so be able to model seasonality fairly well.

  • $\begingroup$ Thank you for your reply, I have tried to define the turning point by my hand for training and testing the data, which i define the increasing period and decreasing period based on my observation. But the result seems to be still like before :( Our aim at this time is trying if LSTM is suitable for our job or not. Maybe I shouldtry other model as well :) $\endgroup$ Aug 20, 2018 at 19:19

Sound to me as a perfect candidate for a Holt-Winters model with a 24 hours seasonality. The trend should not be really sensitive on the time scale you use.

An other way to go would be to compute the seasonality by averaging a great number of 24-hours cycle. Then study the de-seasonlized data.

Once you understand what is happening, you have a chance to teach it to your LSTM.


Your Answer

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

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