Reputation: 2170
I am trying to predict the next value of a series. What the best machine learning / algorithm I need to use?
I have for example this matrix:
[114, 160, 60, 27]
[74, 97, 73, 14]
[119, 157, 112, 23]
and I want to predict this values:
[114, 160, 60, 27 , **80 , 90**]
[74, 97, 73, 14 , **10 , 15**]
[119, 157, 112, 23 , **50 , 48**]
What is the best way to do it?
Upvotes: 2
Views: 2177
Reputation: 927
If I understand well your question, in your case :
X = [114, 160, 60, 27] and Y = [80,90]
[74, 97, 73, 14] [10,15]
[119, 157, 112, 23] [50,48]
And you want to fit a machine learning algorithm on this data ?
You could use any supervied learning algo like regression or SVM using X as input and Y as output.
You could also use iterative learning : you learn a predictor f
a step ahead with :
X = [114, 160, 60, 27] and Y = [80]
[74, 97, 73, 14] [10]
[119, 157, 112, 23] [50]
You do the prediction one step ahead :
f(X) = [pred1]
[pred2]
[pred3]
After that you incorporate the prediction in the input, so now you have :
Xbis = [114, 160, 60, 27, pred1] and Yter = [90]
[74, 97, 73, 14,pred2] [15]
[119, 157, 112, 23,pred3] [48]
And you train another predictor fbis
on Xbis and Ybis.
So at the end, you have two predictors f
and fbis
, both of them predicting one step ahead. It enables you to do prediction two step ahead.
Of course, you will need more data to train a good predictor.
More generally, if you want to do time series prediction, you can use "the window method" which is a general method to create your input and output from the time series to then learn a predictor.
Note also that LSTM are quite use in time series prediction and seems to give pretty good results.
Hope this helps !!
Benoit
Upvotes: 6