# The next element can be obtained using Predict or SequencePredict?

I want to estimate the next number with the data of the sequence listed as elements 0 and 1.

For example,

when data = {0,0,1,1,0,0,1,0,0,1,1,0,0,1}

(actually, the data length is about 800)

Can the next element be obtained as a probability value using Predict or SequencePredict?

Try with:

FindSequenceFunction@data


For example:

FindSequenceFunction[data] /@ Range[30]


{0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0}

And for estimating just the next number:

FindSequenceFunction[data]@(Length[data] + 1)


0

While if you want the probabilities:

sp = SequencePredict[{#} & /@ data];
sp[{0}, "Probabilities"]
sp[{1}, "Probabilities"]


<|0 -> 0.575472, 1 -> 0.424528|> <|0 -> 0.575472, 1 -> 0.424528|>

And you can play with all the options of SequencePredict you can find in the documentation.

• Thank you. Your consultation has been a great help. ^^
– Milk
Jun 28, 2018 at 8:31
• You are welcome :) Jun 28, 2018 at 8:33