Markov Models in JavaScript Part II: More Responsive UI With Hidden Markov Models

[Note: there is a companion web application and source code on GitHub for this article.]

When I first started dating my wife, one of the little things that impressed me about her was that she would always know when it was about to rain. We were living in Pittsburgh at the time, where sudden downpours and thunderstorms are common. This ability to predict the weather was a valuable skill to have. Finally, I asked her how she was so good at predicting a storm. “The leaves on trees,” she replied. “They turn upside down right before the storm hits. It’s something I learned in Girl Scouts.”

Humans excel at determining the probability of underlying events based on observation. In this article, we’ll examine how to introduce this type of behavior into our JavaScript web applications using Hidden Markov Models (HMMs).

In part one of my Markov Models in JavaScript series, I explained how to use Observable Markov Models (OMMs) to calculate the probability of a chain of observable events occurring in the future. But what do we do if the event chain we’re interested in isn’t directly observable?

…Read more: Markov Models in JavaScript Part II: More Responsive UI With Hidden Markov Models

Markov Models in JavaScript Part I: An Observable Markov Chain

This is the first in a multi-part examination of the theory and implementation of Markov probability models in JavaScript. In this post, we’ll examine the simplest type of Markov Model, the Observable Markov Chain.

Ideas have a funny way of spreading. Sometimes a concept that has become ubiquitous in a particular field of study can take years to be widely understood in another field that could have equal use for it.

Variations of Markov Models have found many uses in computer programming recently, from stock trading algorithms to speech recognition systems. However, there is a dearth of solid explanation for client-side JavaScript implementation. I’d imagine this has to do with the fact that JavaScript in web browsers was historically too slow and lacked the low-level access to audio/video input for many of the common uses of these probability models to be implemented. Fortunately, with massive cross-browser performance improvements, and new multimedia API’s such as WebRTC in the pipeline, these limitations are becoming problems of the past. …Read more: Markov Models in JavaScript Part I: An Observable Markov Chain