I have no experience in statistics or machine learning. I have a True/False binary array describing occupation of open public spaces

|  index   |  Value   |
| 0        |  True    |
| 1        |  True    |
| 2        |  False   |
| 3        |  False   |
| 4        |  False   |
| 5        |  True    |
| 6        |  False   |
| 7        |  False   |
| 8        |  True    |
| ...      |  ...     |

Without getting into dependent variables and domain specific heuristics, is there (or maybe more than one) a simple method to do infer the next False in python?

Ideally in pure python or using packages written in pure python.

My question is somewhat similar to this one, but I have more of a time series (i think).

  • $\begingroup$ Do you have anything that could be used as features (i.e. potential clues)? For instance I could imagine that the occupation of some public spaces may depend on the time of day, day of the week, weather, etc. Also does your index represent regular points in time, i.e. every hour or day? $\endgroup$
    – Erwan
    Feb 1, 2020 at 13:22
  • $\begingroup$ Time of the day is mostly what i have, that is the index of my array (sampling is every 10 mins i think). Can this be features? There is lots of other information that is related like you say weather etc. but at this stage i'm only asked to use this dataset and not even between spaces (so look at each array in isolation) $\endgroup$
    – developer1
    Feb 1, 2020 at 14:34
  • $\begingroup$ Well it looks a bit like a sequence labeling problem (en.wikipedia.org/wiki/Sequence_labeling), but I'm not sure that's the best way to predict the next label. If you have only the sequence of labels themselves you could also consider language modeling. $\endgroup$
    – Erwan
    Feb 1, 2020 at 18:26
  • $\begingroup$ If you have time of day then that should be included in the question. As using just the index there is not much to be done. But if you include the time stamp for example, then more information can be extracted from the time stamp itself using time series. As using just the index can be misinterpretted i think $\endgroup$
    – timmy1691
    Mar 25 at 14:13

2 Answers 2


Do you have more features ? If not, you can try to find a filling pattern, for example, probably some places are filled first because, for example, are closer to the entrance, then another group etc. Try to plot as a time dependent problem. I cannot tell how much bigger the error will be. If you have at least the x, y of the place and the timestep of the value, then you have a pattern.


If that is all you have, I think you would end up with Bernoulli trials and the index is the index of the trial.

You can get the probability of the trials by finding the number of true versus the total number of trials.

It's like flipping a coin but you don't know if the coin is fair or what the probability of head is. From the data, you can estimate what the probability has been so far and use that to guess what the next outputs are. From your given situation without any context, I think that is the best I can offer. Maybe someone else has better insight.


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.