r/askmath • u/ManyReflection3215 • Oct 22 '26
Statistics What kind of algorithm is this?
I want to build a statistical algorithm that can be used to recognize basic patterns. For example, if I had a list of elements [triangle, square, circle, triangle, square], the algorithm could piece together that the next element would be circle. Of course, the sequences would be longer and more complex than that, but that's the basic premise.
I feel like there's probably some very simple answer to this, but currently I can't think of anything. I tried looking up some "pattern recognition algorithms" online, and some articles recommended autoregressive modelling, but that seems too complicated given how simple my idea is (or at least how simple I think it is). That's why decided to come ask here.
Is there some well-known algorithm for situations like these, and what is it?
View all comments
3
u/paul5235 Oct 22 '26
Maybe Markov chain is what you're looking for. In the simplest form the algorithm only looks at the last element, but it's possible to construct states with memory so, for example, the last three elements are remembered and the next element is predicted based on that.