フィルターのクリア

Does MATLAB have any toolboxes or commands for predicting the next number in a series?

8 ビュー (過去 30 日間)
Alex
Alex 2017 年 3 月 18 日
コメント済み: Greg Heath 2017 年 4 月 2 日
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 件のコメント
Greg Heath
Greg Heath 2017 年 4 月 2 日
Why in the world are you using x(y) instead of the worldwide timetested standard y(x)?
Dizzily,
Greg

サインインしてコメントする。

回答 (3 件)

Jan
Jan 2017 年 3 月 27 日
編集済み: Jan 2017 年 3 月 27 日
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 件のコメント
Image Analyst
Image Analyst 2017 年 4 月 1 日
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
John D'Errico 2017 年 3 月 18 日
編集済み: John D'Errico 2017 年 3 月 18 日
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 件のコメント
John D'Errico
John D'Errico 2017 年 3 月 28 日
Actually, in the series I posed, the next term would have been 20. And the one after that? 24.
Alex
Alex 2017 年 3 月 29 日
編集済み: Alex 2017 年 4 月 1 日
Great idea, I will look into the auto-correlation function more: https://www.mathworks.com/help/signal/ref/finddelay.html
16, then 1 are the next number for my series. I wasn't taking a guess at the new one you posed. I am not sure whether to treat the vector X as my signal or to pad it up to the value of the largest integer to treat each integer as a separate sensor to compute the time delay between when the same number is repeated.

サインインしてコメントする。


the cyclist
the cyclist 2017 年 3 月 18 日
編集済み: the cyclist 2017 年 3 月 18 日

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.)

  3 件のコメント
the cyclist
the cyclist 2017 年 3 月 18 日
編集済み: the cyclist 2017 年 3 月 18 日
Ah, fair enough!
Do you have some underlying theoretical model? nlinfit from the Stats toolbox is one possible tool.
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.
Alex
Alex 2017 年 3 月 25 日
Thank you, I am interpreting the data as voltages from a sensor so tried using FFT (I tried using all three examples in the FFT documentation: 'noisy signal', 'gaussian pulse' and 'cosine') to see if I could compute the amplitude and frequency spectrum(s), but do not see to have a central frequency. I believe I need more data.
I do not have a model to use nlinfit, but have noted this as something to try in the future. Thank you for your helpful suggestions!
Cheers,
Alex

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by