MLG 014 Shallow Algos 3
Anomaly detection, recommender systems and Markov chains end the shallow learning series: anomaly detection flags outliers on a bell curve, recommenders predict ratings, and Markov chains model state transitions. Also covers content vs collaborative filtering, and Monte Carlo simulation vs MCMC. Links Notes and resources at ocdevel.com/mlg/14 Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners What is anomaly detection? Finding the rare example that doesn't fit, such as a fraudulent credit card charge or a misbehaving server: fit a bell curve to normal behavior and flag whatever lands far out in its tails. The normal distribution (bell curve) Also called the Gaussian distribution. Its mean sets the center and its standard deviation the width. Not all data is normal: house prices are right-skewed, so a log-normal fits them better. How the anomaly detection algorithm works Fit a Gaussian to training data that is almost all normal examples. Score a new example by its probability p(x) under that fit. Flag it as an anomaly when p(x) falls below a threshold ε. Tune ε on a validation set holding labeled anomalies; check it on a test set holding the rest. Content filtering vs collaborative filtering Both predict a user's rating of an item, as linear regression predicts a house price (MLG 005). Content filtering (similar items): items come with features, and each user gets regression weights learned from their ratings. Pandora's Music Genome Project tags songs by attributes like vocals and genre, and Pandora describes trained musicologists analyzing each song, new releases included. Collaborative filtering (users also liked): items have no features. It learns item features and user weights together from the ratings alone, two regressions in one cost function. Production recommenders blend both, now mostly with deep learning. Recommender systems vs market basket analysis A recommender suggests a substitute: you liked a Hershey bar, try a Kit Kat. Market basket analysis (Apriori, MLG 012) suggests a complement: marshmallows and graham crackers go with chocolate. What is a Markov chain? A probabilistic model of a process: states joined by arrows, each carrying a transition probability. Under the Markov property the next state depends only on the current one, because the current state (a player's level, position and velocity) sums up whatever in the past still matters. Arrows can loop back, so a chain is a graph, not a tree. It is stored as a transition matrix, with probabilities counted from observed transitions. A restaurant, from The Great Courses' Mathematical Decision Making (Lecture 21): enter → wait for a table (50% stay, 50% get seated) → decide → order → wait for food → … The likelier a state loops back to itself, the longer people wait there: a bottleneck. A Markov chain is a model, not a learning algorithm. Reinforcement learning (MLG 029) builds on Markov decision processes, which add actions and rewards. Monte Carlo simulation vs MCMC When a question about a chain, like a player's expected final score, is too complex for a formula, run the process many times, picking each next state at random by its probabilities, and average the outcomes. That is Monte Carlo simulation. Markov chain Monte Carlo (MCMC) samples from a distribution too hard to sample directly, by running a Markov chain whose long-run distribution is that target. Metropolis–Hastings is the classic algorithm. Where to learn anomaly detection and recommenders Course 3 of Andrew Ng's Machine Learning Specialization: anomaly detection in week 1, collaborative filtering and a deep learning version of content-based filtering in week 2. Next: MLG 015, on measuring and improving performance.
Embed this episode
No transcript yet.