
Learn three guidelines to succeed: ask questions in the Q&A, meet prerequisites, and engage hands-on with handwritten notes for conceptual lectures and coding by doing.
Explore the Markov property, where each symbol depends only on the previous one, and see how the chain rule and Bayes rule model sequences in practice.
Analyze Markov chains by computing future state distributions using a row-vector transition matrix. Learn about limiting and stationary distributions and their link to page rank.
Learn a two-state hidden Markov model in Python to model healthy and sick states, estimate transitions with maximum likelihood, and compute predictions and long-run healthy durations.
Compute the expected number of days you stay in the same state in hidden Markov models in Python, using infinite sums and the sick days example.
Build a 2nd-order language model in Python using Robert Frost poems, tokenize and clean the text, and compute initial and second-word distributions to generate phrases by sampling.
Explore how Google's PageRank uses Markov chains to rank web pages by modeling visits as states, with a transition matrix and smoothing to guarantee a unique stationary distribution.
Learn how a structured suggestion box solicits targeted feedback on course content, difficulty, and missing explanations to improve your learning in this Python-based unsupervised machine learning course.
Discover how to compute the probability of an observation sequence for a hidden Markov model using the forward algorithm, including initialization, induction, and termination steps.
Explore the forward algorithm from mathematical, algorithmic, and graphical perspectives, using alpha, initial pi, and observation probability B to compute sequence probabilities with Bayes rule.
Explore the backward algorithm for hidden Markov models in Python, introducing beta, backward recursion, and how it complements the forward algorithm to support later training.
Train hidden Markov models in Python when states are observed, using simple counts to estimate transition, emission, and initial probabilities, with examples from part-of-speech tagging and speech recognition.
Learn to train hidden Markov models in Python using the EM (expectation maximization) method, estimating pi, A, and B from observations, via the E-step and M-step.
Explore how the expectation maximization algorithm trains hidden Markov models in python by using a lower bound, deriving the E-step and M-step updates for pi, A, and B, and iterating.
Learn to choose the number of hidden states in hidden Markov models, using known counts or treating unknown counts as hyperparameters evaluated via cross-validation and AIC/BIC.
Apply scaling and log probabilities to prevent underflow in hidden Markov models, reworking the forward, backward, and training updates with a scale factor and alpha prime concepts.
Code a discrete hidden Markov model in Theano to learn pi, A, and B with a fit loop that maximizes log-likelihood using shared variables and the scan recurrence.
Code the continuous hidden Markov model in Python, implementing a Gaussian mixture emission, initializing pi, mu, and sigma, and iterating EM-like updates with alphas, betas, and gammas across sequences.
Compute the continuous-observation hmm likelihood using alpha and emission probabilities. Test with a two states and two gaussians model on fake signals and evaluate log-likelihood.
build a continuous scaled hidden Markov model in Vienna for audio signals, with five states and three gaussians, using normalization and the forward algorithm to train mu and sigma.
The lecture situates hidden Markov models within unsupervised learning, showing they model sequences and can perform classification by training separate models for each class using Bayes rule.
Note:
Data is from: http://www.cnts.ua.ac.be/conll2000/chunking/
Code is in the same repo as this course, but in the folder nlp_class2
Explore gaussian mixture models as density estimators for multi-modal data with weighted gaussians. Use a latent z variable and an em-like procedure to update means, covariances, and pi.
The Hidden Markov Model or HMM is all about learning sequences.
A lot of the data that would be very useful for us to model is in sequences. Stock prices are sequences of prices. Language is a sequence of words. Credit scoring involves sequences of borrowing and repaying money, and we can use those sequences to predict whether or not you’re going to default. In short, sequences are everywhere, and being able to analyze them is an important skill in your data science toolbox.
The easiest way to appreciate the kind of information you get from a sequence is to consider what you are reading right now. If I had written the previous sentence backwards, it wouldn’t make much sense to you, even though it contained all the same words. So order is important.
While the current fad in deep learning is to use recurrent neural networks to model sequences, I want to first introduce you guys to a machine learning algorithm that has been around for several decades now - the Hidden Markov Model.
This course follows directly from my first course in Unsupervised Machine Learning for Cluster Analysis, where you learned how to measure the probability distribution of a random variable. In this course, you’ll learn to measure the probability distribution of a sequence of random variables.
You guys know how much I love deep learning, so there is a little twist in this course. We’ve already covered gradient descent and you know how central it is for solving deep learning problems. I claimed that gradient descent could be used to optimize any objective function. In this course I will show you how you can use gradient descent to solve for the optimal parameters of an HMM, as an alternative to the popular expectation-maximization algorithm.
We’re going to do it in Theano and Tensorflow, which are popular libraries for deep learning. This is also going to teach you how to work with sequences in Theano and Tensorflow, which will be very useful when we cover recurrent neural networks and LSTMs.
This course is also going to go through the many practical applications of Markov models and hidden Markov models. We’re going to look at a model of sickness and health, and calculate how to predict how long you’ll stay sick, if you get sick. We’re going to talk about how Markov models can be used to analyze how people interact with your website, and fix problem areas like high bounce rate, which could be affecting your SEO. We’ll build language models that can be used to identify a writer and even generate text - imagine a machine doing your writing for you. HMMs have been very successful in natural language processing or NLP.
We’ll look at what is possibly the most recent and prolific application of Markov models - Google’s PageRank algorithm. And finally we’ll discuss even more practical applications of Markov models, including generating images, smartphone autosuggestions, and using HMMs to answer one of the most fundamental questions in biology - how is DNA, the code of life, translated into physical or behavioral attributes of an organism?
All of the materials of this course can be downloaded and installed for FREE. We will do most of our work in Numpy and Matplotlib, along with a little bit of Theano. I am always available to answer your questions and help you along your data science journey.
This course focuses on "how to build and understand", not just "how to use". Anyone can learn to use an API in 15 minutes after reading some documentation. It's not about "remembering facts", it's about "seeing for yourself" via experimentation. It will teach you how to visualize what's happening in the model internally. If you want more than just a superficial look at machine learning models, this course is for you.
See you in class!
"If you can't implement it, you don't understand it"
Or as the great physicist Richard Feynman said: "What I cannot create, I do not understand".
My courses are the ONLY courses where you will learn how to implement machine learning algorithms from scratch
Other courses will teach you how to plug in your data into a library, but do you really need help with 3 lines of code?
After doing the same thing with 10 datasets, you realize you didn't learn 10 things. You learned 1 thing, and just repeated the same 3 lines of code 10 times...
Suggested Prerequisites:
calculus
linear algebra
probability
Be comfortable with the multivariate Gaussian distribution
Python coding: if/else, loops, lists, dicts, sets
Numpy coding: matrix and vector operations, loading a CSV file
WHAT ORDER SHOULD I TAKE YOUR COURSES IN?:
Check out the lecture "Machine Learning and AI Prerequisite Roadmap" (available in the FAQ of any of my courses, including the free Numpy course)