Time series analysis algorithm with probabilistic finite automata