# Series prediction for any given time

I have a time series of data points. Then I am given a future timestamp and I have to predict the value for the data point. For simplicity, you can assume that the timestamp is bounded i.e. for e.g. query can be of at most 1 hr in the future.

This is different from tradition train and predict models. Here you will be given the time as query input apart from past data.

Currently, I am training different models for each minute(yeah, 60 models: lots of waiting time ).

I am wondering if there is something available for this specific task?

EDIT: To get the view about the data, you can assume a simple time series of real numbers, and I have to use history to predict for any general time(within next 1 hr).

• Isn't this is the most basic time series forecasting problem? What's not traditional about it?
– Emre
Nov 2, 2016 at 7:11
• Could you explain a bit more about your data and why you opt for deep learning instead of time series models? Nov 2, 2016 at 11:52
• @Eme, yes it is. but my team is using deep learning for it. Please educate me how to tackle this.
– v78
Nov 6, 2016 at 15:08
• @Stereo, Its an half-done project given to me. Which time-series models are you talking? changed the statement.
– v78
Nov 6, 2016 at 15:08
• Can you add information on the environment restriction that you have? Nov 8, 2016 at 8:28

Considering ocam's razor I would recommend to use the simplest model first and increase the complexity if the simple models fail:

1. Exponentially Weighted Moving Average, allows only for auto correlation with lag one
2. ARIMAX, allows for several lagged autocorrelation, seasonal adjustments and external regressor.
3. Fourier transformation, allows to fit more shapes time series but they are often more complex to explain to users

All these models can predict one step ahead and you can repeat this up to 60. Of course the confidence intervals become much wider these many steps ahead. Base R has many time series available.

These two models work well for many time series data. I would only start to use neural nets when these are not working or if you are looking for say edge detection.

## Neural nets

If neural nets are the only option to go you can check this post or if you have matlab available this post.

I recently found this very interesting article on medium that explains how to fit a Neural Net to time series data. A more detailed implementation guide can be found here. I have not tried either approaches but I thought that the may be useful for future reference.

## Time series modus operandi

Note that in any case, before staring off modeling your time series it is highly recommended to take some preparatory steps:

1. Make your series stationary as explained here
2. Understand what elements you can decompose in your series as explained here

Hope this helps

• Do you have a solution for the deep-learning based implementation as well.
– v78
Nov 7, 2016 at 5:06
• I updated the answer. Hope this helps but note that time series are typically not the first approach as a result of ocam's razor. Nov 8, 2016 at 7:50

I would do it like this with a neural net. I would take a fixed interval (depending on your data). Then i feed it into the network and output the next timestep. Then you can remove the last datapoint in your initial input data and add the previous output to the input to predict the next step and so on. For training you can just stop at every point and take the last interval for x and the current point as y.

Maybe you could also take a look at recurrent networks: https://keras.io/layers/recurrent/.

Lastly I do not recommend using neural nets to solve this, because it is overkill in my opinion.

• But, That adding of new/missing values and training will introduce a lots of noise in it.
– v78
Nov 8, 2016 at 7:52
• This is only for testing. For training I would take a sequence of arbritrary length as X and the next point as y and train on this. Nov 9, 2016 at 8:51
• For example: abritrary lenght = 3. Your data is [1,2,3,4,5,6,7,8,9,10]. Then train on X=[1,2,3] & y=[4]; X=[2,3,4] & y=[5]; and so on and so forth. Nov 9, 2016 at 8:53