5
$\begingroup$

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?

$\endgroup$
7
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thank you. Your consultation has been a great help. ^^ $\endgroup$ – user21427 Jun 28 '18 at 8:31
  • $\begingroup$ You are welcome :) $\endgroup$ – Fraccalo Jun 28 '18 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.