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$

1 Answer 1

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$
2
  • $\begingroup$ Thank you. Your consultation has been a great help. ^^ $\endgroup$
    – Milk
    Jun 28, 2018 at 8:31
  • $\begingroup$ You are welcome :) $\endgroup$
    – Fraccalo
    Jun 28, 2018 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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