5

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?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Milk
  • 1,688
  • 10
  • 9

1 Answers1

7

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.

Fraccalo
  • 6,057
  • 13
  • 28