Every machine learning algorithm works on the same intuition: predict, measure the error, then train by adjusting weights to shrink it. Also covers models, features and online learning through a house price example, plus supervised, unsupervised and reinforcement learning. Links Notes and resources at ocdevel.com/mlg/4 Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners How machine learning algorithms learn: predict, error, train Every machine learning algorithm repeats three steps, and textbooks use two names for each. Predict (infer): make a guess, like a chess move or a house price. Error (loss): an error function scores how far off the guess was. Train (learn): change the model's numbers, called weights, a lot after a big miss and a little after a small one. How to train a model: the house price example Training runs those steps over examples whose answers are known. The example here is house prices in Portland, Oregon, a stock teaching dataset like the Iris flower dataset. Load a spreadsheet of sold houses, say a million rows, into an algorithm such as linear regression. Row by row, it predicts a price, measures the error against the real price and updates its weights. The trained model prices houses it has never seen. When one sells for $30,000 under the prediction, the model retrains on that sale. Retraining on each new example is online learning. Algorithm vs model An algorithm is the code, say a hundred lines of Python, usually with PyTorch (MLG 010 covers languages and frameworks). A model is the algorithm plus the pattern it learned, saved as weights. Features, targets and weights Each spreadsheet row is one house. Each column is a feature: bedrooms, bathrooms, square footage, distance to downtown. The last column, the price, is the target. The algorithm sets it aside and learns to predict it. A feature is numerical (square footage) or categorical, also called nominal (downtown or not; pets allowed: cats, dogs, birds). A weight, a coefficient in math terms, is the number a feature is multiplied by. Training finds the weights, which gives an equation: price = 0.3 × bedrooms + 0.7 × bathrooms + 0.5 × square feet Each row is one such equation and the spreadsheet is a matrix, so solving them together is linear algebra (MLG 008). Types of machine learning algorithms: supervised, unsupervised and reinforcement learning Supervised learning trains on examples that come with the answer, like the houses. It predicts a number (linear regression) or a class such as cat, dog or tree (logistic regression). Unsupervised learning gets no answers. It groups examples by what they have in common without naming the groups, which is clustering. Advertisers use it to segment users by their clicks. Reinforcement learning learns from its own actions toward a goal. A mouse in a maze gets 100 points for the cheese, loses 100 for a pit and loses 1 per step, so it hurries. The episode calls that step cost the floor is lava. From the score alone the algorithm works out the best course of action, called a policy. A common algorithm is the deep Q-network (DQN). MLG 029 covers it. Recommended reading: A Tour of Machine Learning Algorithms and The Master Algorithm A Tour of Machine Learning Algorithms by Jason Brownlee at Machine Learning Mastery lists the main algorithms by learning style and by family. The Master Algorithm by Pedro Domingos is an introductory book on the fundamental algorithms. It comes as an audiobook, for learning while you run, clean or commute. The resources list has the rest of the series' picks. Next: MLG 005, on linear regression.