How does time-series classification work?

So I have the multiple time series data in this format --

id  Week    X1    X2   X3   y

1   201901  10.   34.9 52.8 0

1   201902  20.   44.1 12.6 1

1   201903  30.   54.2 84.3 1

1   201904  40.   64.4 77.1 0

2   201901  10.   64.9 62.8 1

2   201902  20.   54.1 22.6 1

2   201903  30.   34.2 54.3 1

2   201904  40.   44.4 17.1 0



I want to predict y for the next two weeks. How can I approach this problem?

One way I thought is to train on the data set and then the test data would look like this -

id  Week   X1   X2    X3
1   201905 20.  45.2. 33.2
2   201905 10.  65.2. 23.2


Is this the correct way to do such a classification? Or should I train the model for each time series independently.

Thanks!

• What do your ids represent? Are these fixed? As in, you know will have 2? Or could they be more that you do not have in your training data? – Valentin Calomme May 14 at 8:58
• The ids represents each individual time series. They can 10 or they can be a million. – Slayer May 14 at 9:03

To be clear, here, time-series classification refers to forecasting discrete values. In another context, time-series classification could refer to predicting a single class for the entire time-series (i.e. heart disease vs healthy heart). Thanks @mloning for pointing this out.

When it comes to forecasting discrete outputs, models are trained to predict the next value based on the previous ones, which means that

• The input is the historical data up to timestamp t (in your scenario, the data up to week = 201904)
• The output is the value at timestamp t + 1 (y when week = 201905)

If you want to predict more than 1 value into the future, you should perform predictions in a recurrent way, i.e.:

• use data up to t to predict t + 1
• use data up to t + 1 (where t + 1 is your own prediction) to predict t + 2
• and so on

How far into the future you want to look is called the horizon. And you are free to use as big of a horizon as you like. Of course, since every new step into the future is based on guesses and not actual data, it is expected that the further you look, the worse your predictions will become. Which makes perfect sense. That's why it's easier to predict what the weather will be like tomorrow than in 7 days.

Splitting data into training and testing is not very different than for a normal classification problem. The only constraint is that your test data should only contain data "in the future" compared to the training data. Here is a good blog about it: https://towardsdatascience.com/time-based-cross-validation-d259b13d42b8

• should I train the model for each time series independently?

Short answer: try both approaches and see which one works best