Does MATLAB have any toolboxes or commands for predicting the next number in a series?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a data series x as a function of time y:
x=[14,14,3,4,8,3,2,5,11,2,1,5,10,2,4,1,8,11,5,1,3,1,2;]
y=1:1:23
How do I predict the next number (x,y=24)? Does MATLAB have any toolboxes for that type of problem or will I need to code something like a neural network solution from scratch?
Cheers
1 comentario
Greg Heath
el 2 de Abr. de 2017
Why in the world are you using x(y) instead of the worldwide timetested standard y(x)?
Dizzily,
Greg
Respuestas (3)
Jan
el 27 de Mzo. de 2017
Editada: Jan
el 27 de Mzo. de 2017
19.
Carl E. Linderholm showed, that any sequence of numbers can be continued by 19. It is easy to construct a corresponding Lagrange polynomial p(x) such that p(1), p(2), ... p(n) yields the given numbers and p(n+1) is 19. This rule is much easier than all other rules and is applies in general.
Of course you could use your favorite number also. But then this gives psychologists the chance to interpret your subconsciousness. So better choose 19 (and do not tell anybody if this is your favorite number).
See http://www.whydomath.org/Reading_Room_Material/ian_stewart/9505.html (they claim it was a Laplace interpolation - fortunately the law is such universal, that this detail does not matter.)
1 comentario
Image Analyst
el 1 de Abr. de 2017
I totally agree with Jan. In fact there was a controversy some years ago about using such "predict the next number" questions on college entrance exams because virtually any number (any one of their choices) could be an answer using some formula. You can't really say any of the numbers is right and all the rest are wrong.
John D'Errico
el 18 de Mzo. de 2017
Editada: John D'Errico
el 18 de Mzo. de 2017
There is no reason to suppose that the next INTEGER in that series will be easily predicted. Neural nets are not a magical tool that will do here. For example, consider this vector?
[3 5 4 5 6 8 9 8 12 11 10 12 9 11 11 11 10 9 11 11 13 12 12 11]
What is the next term in that series?
Will any neural net be able to predict intelligently that the next term is 12? You might guess what the number is. But KNOWING with any confidence what the next number is will never be something a statistical tool can do, merely by looking at the numbers.
Worse, any numerical tool that would try to extrapolate a series would not understand that the result would be an integer. Any simple extrapolant would probably predict some floating point number.
Ok, I'll even be nice and tell you the next 5 numbers in that sequence. They are [12 15 17 17 16]. What is the next number? Feel free to postulate what is the mechanism behind that sequence. A little creative thinking should suffice. Statistics won't help though.
Unless you actually see the pattern, you will not be able to predict this sequence easily. In fact, I was wondering if oeis would be able to solve it.
https://oeis.org
oeis is a great source to solve such problem sequences. But I'm not at all surprised that it did not find a match for either the sequence you gave, or the one I posed.
4 comentarios
John D'Errico
el 28 de Mzo. de 2017
Actually, in the series I posed, the next term would have been 20. And the one after that? 24.
the cyclist
el 18 de Mzo. de 2017
Editada: the cyclist
el 18 de Mzo. de 2017
The Statistics and Machine Learning Toolbox has many, many tools for making inferences from data.
You could also try the Neural Network Toolbox, but I don't think you need that.
But if you just plot your data
x=[14,14,3,4,8,3,2,5,11,2,1,5,10,2,4,1,8,11,5,1,3,1,2;] y=1:1:23 figure; plot(y,x,'o')
you'll see that y is certainly not very predictive of x. (But maybe even a little predictive power is OK for your application.)
![](/matlabcentral/answers/uploaded_files/72678/test.png)
3 comentarios
the cyclist
el 18 de Mzo. de 2017
Editada: the cyclist
el 18 de Mzo. de 2017
Ah, fair enough!
Also, I don't have much experience in this area, but this might be more of a signal processing problem. There is a separate toolbox for that, too. Or maybe you could use the fft function in base MATLAB.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!