how can i implement a number prediction algorithm?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have this procedure:
- I have 20 numbers, from 1 to 20.
- I choose 3 of these 20 numbers in the way that these number are not equal so i choose in a random way 3 not repeated numbers in this interval (A sort of extraction).
- I save these three numbers in a vector.
- I repeat the three previous point so after 50 times i have my origin number from 1 to 20 and a vector made of 50 rows and 3 column made of the three numbers extracted each times.
The question is: How could i implement an algorithm that give me a future number prediction?
0 Kommentare
Antworten (1)
Walter Roberson
am 4 Nov. 2016
Your steps 1 to 3 can be express in MATLAB without a loop, using
[~, idx] = sort( rand(50, 20), 2);
YourRandomData = idx(:,1:3);
On the matter of future number prediction:
What is to be the input? Is it to be a vector of 2 numbers and using the information learned from the 50 x 3 array it is to predict that the 3rd number is to be in 1 to 20 and not one of the first two numbers? That is, are you trying to create a neural network that will have deduced the rule of construction of the array, that the entries are integers in 1 to 20 and not repeated in any one row?
4 Kommentare
Walter Roberson
am 4 Nov. 2016
Let's simplify this for learning purposes.
- I have 2 numbers, from 1 to 2.
- I choose 1 of these 20 numbers in the way that these number are not equal so i choose in a random way 1 not repeated numbers in this interval (A sort of extraction).
- I save these one numbers in a vector.
- I repeat the three previous point so after 50 times i have my origin number from 1 to 2 and a vector made of 50 rows and 1 column made of the one numbers extracted each times.
number_of_states = 2;
number_at_a_time = 1;
[~, idx] = sort( rand(50, number_of_states), 2);
YourRandomData = idx(:,number_at_at_time);
Now just for fun,
state_names = 'HT' .';
named_states = state_names(YourRandomData, 1)
named_states =
H
T
T
T
H
H
H
H
H
H
T
[etc]
If i use the first column of 50 rows to predict the 51th value...
... then I would be predicting the 51'st flip of a coin based upon the first 50 flips of the coin.
If the coin flip is "fair" (uniformly distributed), then any correlation found would be accidental.
You can make predictions on such a system, but what you would e testing would be the "fairness" of the random assignment that created the data.
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!