# A simple way to predict the next value (Markov predictor, ant colony algorithm, Levinson-Darbin recursion)

## Question:

Hello!

There is a number row, programmatically some array of length `N` What is needed is the simplest algorithm for predicting the next `N+1` value based on all previous values. Please tell me this.

My series is represented by random positive fractional numbers. In general, I would like to consider any simple ideas.

UPD :: where do the numbers come from?

There are 50 equidistant transceivers (RTs), no matter how, but anyone can communicate with anyone ( fully meshed topology ). There is an abstract source and receiver (which can also communicate with any of the PPs). The connection between the source and the receiver is always established through 5 PPs (the source and the receiver are naturally not taken into account). At one point in time, for example, once a day, the connection (route / path) is re-formed according to some unknown to us, random (just random, since, for example, some PPs are unattainable at a given time for some reason) laws. It is necessary to predict which path (or 6-10 other path options) will be chosen next based only on knowledge of the previous system choices.

I have already tried many different algorithms. Since there is no statistical relationship between two different choices of paths (and if there is, then it is difficult to determine, I’m even afraid to say that the path change occurs according to, for example, the normal probability distribution , but I think that this can be assumed for this problem) , so I'm now trying to approximate based on the "weights" of the routes (the product of the "weights" of each pair of PPs extracted from the transition matrix (the weights are determined at the intersection of the row and column: the transition from the i-th PP to the j-th ), built according to a similar principle described by @northerner but more simplistic).

Since the weights of paths of the form | `1,2,3,4,5` | `1,3,2,4,5` | `5,4,3,2,1` |, are equal, simple calculations give a little more than 2 million. possible routes. For each of them, I calculate the weight (by the matrix). Similarly, we can calculate the weight of the route for each previous route already selected by the system (the interval is a year, for each day of the year). Predicting the behavior of the weight value, we will select 6-10 options out of two million that are most similar to our predicted value.

At the moment, I have only gotten to the point that by assuming a normal distribution, we can select the most rare pairs in the transition matrix. For example, there are pairs that have never been met in a year (for which in the transition matrix at the intersection – zero, they have to be replaced as they spoil the picture, in my opinion). Nevertheless, these pairs do not begin to appear more often than others.

If there are alternative ideas / methods for predicting routes, I will be glad. If you have any ideas on how to establish the relationship between route changes, distribution and other characteristics, I will also be glad.

That is, split the set of possible values `[0; 1]` on `n` intervals (say, 10), calculate how many values ​​fall into each and create a random variable that has the same probability distribution.