Hacker News new | ask | show | jobs
by creed0r 3746 days ago
Am I right in taking from this that markov chains don't necessarily adjust to history?

So in the example, if a "sunny day" state has a chance of 0.9 to stay in that state and a 0.1 chance of transitioning to rainy day and I already had 5 sunny days, the 6th day would still have a 0.1 chance to be a rainy day?

4 comments

Yes that's right. The reason they're "Markov" chains is that they make the "Markov assumption" which is usually stated as "the future is independent of the past given the present". This just means that the probability of the next timestep depends only on what happened in the current one; it has no memory as such.

As detaro says:

"A Markov chain with memory for the last m steps is sometimes called a "Markov chain of order m""

So if you wanted it to depend on the last 5 timesteps, you'd create a 5th order Markov chain, and so on.

Probability doesn't adjust to history either: if you flip coins, and if you already have 5 heads in a row, your chance for a head the next time you flip is still exactly one half.

But weather is not driven by probability so history might matter.

Yes, the classical Markov chain has no memory. A Markov chain with memory for the last m steps is sometimes called a "Markov chain of order m"
You could count sunny days by encoding the count as different states in a more complicated markov chain:

sunny1 -> sunny2 -> sunny3 -> sunny4 -> sunny5.

But as with regular expressions, you can't go to arbitrary depth.