Step 1 of 6
Count the days
A table of what comes next
Why this matters. The next-word suggestions on a phone keyboard started as exactly this kind of table, and Google's original PageRank was a chain like this run over the whole web. It is also the direct ancestor of how a language model picks each next word. You build one from a weather diary first, then from words.
Here is three weeks of one town's weather. The question a Markov chain asks is small: given today, what are the chances for tomorrow? It deliberately forgets everything before today.
Those chances come from counting. Go through the diary in pairs of neighbouring days and count how often a sunny day was followed by a sunny one, by a rainy one, and the same after a rainy day.
The diagram turns your counts into chances as you go. The four numbers on its arrows are the whole model.
Three weeks of weather, day 1 to day 21:
How often was each kind of day followed by each kind of day?
after a sunny day: 0 sunny, 0 rainy of 0
after a rainy day: 0 sunny, 0 rainy of 0
Sign in to save your progress.