
Sign up to save your podcasts
Or


Support vector machines and naive Bayes are shallow learning algorithms for classification: an SVM draws the widest margin between classes, and naive Bayes applies Bayes' theorem to word counts. Also covers the kernel trick, conditional probability, choosing an algorithm and text classification.
LinksAn SVM draws a decision boundary like logistic regression (MLG 007), but as wide as it can. That width is the margin, and the training points on its edges are the support vectors. A wide margin generalizes better; a soft margin (the C parameter) lets an outlier sit inside it rather than tilt the boundary.
The kernel trickA plain SVM is linear. A kernel measures how similar two points are as if they had been mapped into more dimensions, where a flat boundary can separate them, without computing that mapping. Blue dots ringed by red dots can't be split by a line, but add each point's distance from the center as a dimension and a flat cut separates them. Common kernels are radial basis function (RBF, scikit-learn's default), polynomial and sigmoid.
With an SVM you choose the kernel; a neural network learns the nonlinearity itself, at more cost in data, time and memory.
Joint and conditional probabilityConditional probabilities don't reverse: clouds given rain is far likelier than rain given clouds. Bayes' theorem converts one into the other:
P(A | B) = P(B | A) × P(A) / P(B) Naive Bayes classifierFor spam, drop stop words (the, is), count how often each word appears in spam and in legitimate email, and note how much email is spam. Bayes' theorem then gives a new email's P(spam | its words).
The naive assumption treats the words as independent given the class, which keeps the math tractable but ignores grammar and word order: a bag of words. Naive Bayes is fast, light on memory, needs little data and tolerates missing values. Spam filtering is its classic use; weather forecasting runs on numerical models and, increasingly, machine learning ones such as Google DeepMind's GraphCast. MLG 019 applies naive Bayes to language.
Naive Bayes vs deep learning for text classificationText classification moved from recurrent neural networks (MLG 022), which read text in order, to transformers (MLG 033). BERT-style models label an email in well under a second, so speed no longer rules deep learning out for spam. Naive Bayes still fits where data or compute is scarce.
Where to learn SVMs and naive BayesNext: MLG 014, on anomaly detection, recommenders and Markov chains.
Shallow learning algorithms like k-nearest neighbors, k-means, Apriori, PCA and decision trees solve many problems with far less compute than deep learning. Also covers supervised, unsupervised and reinforcement learning, random forests, gradient boosting and where to learn them.
LinksShallow learning is every algorithm that isn't a layered neural network. Deep learning (MLG 009) isn't a silver bullet, and a shallow algorithm that fits saves time and compute.
Pedro Domingos's The Master Algorithm (MLG 004) follows the search for one algorithm to replace hundreds. This episode covers five; MLG 013 and MLG 014 cover more.
Supervised, unsupervised and reinforcement learningKNN is supervised but doesn't train (instance-based learning): a new point gets the majority label of its k nearest stored rows, or their average for regression. k is the number of neighbors that vote; the classes come from the labels. MLG 032 covers distance metrics.
K-means clusteringIn k-means you choose k, the number of clusters, and it learns where their centers (centroids) go:
The elbow method and silhouette scores help choose k (MLA 011).
Association rules and the Apriori algorithmMarket basket analysis (association rule learning) finds what goes together: marshmallows and graham crackers suggest chocolate. A rule needs support (the items often appear together) and confidence (those baskets usually include chocolate).
Apriori (Agrawal and Srikant, 1994) uses the fact that every subset of a frequent itemset is frequent: it grows itemsets one item at a time from frequent ones and prunes any candidate with an infrequent subset.
Principal component analysis (PCA)PCA reduces many features to a few, as a GPA stands in for grades and attendance. Its principal components are new axes, weighted combinations of the original features ordered by the variance they keep, and you keep the first few. They come from the covariance matrix's eigenvectors, and unlike regression there's no target.
Decision treesA learned flowchart of if-else questions. Training picks the best-splitting question, then repeats on each branch:
lives in the sea? → yes: fish; no: number of legs? → two: human, four: cat
Classification trees predict classes, regression trees numbers. The classic algorithms are CART, ID3, C4.5 and C5.0; scikit-learn uses an optimized CART.
A small tree can show why a loan was denied, and US law (Regulation B, under the Equal Credit Opportunity Act) requires lenders to give, or provide on request, the specific principal reasons for a denial.
Random forests and gradient boostingA single deep tree tends to overfit (MLG 015).
Tree ensembles still often beat deep learning on tabular data.
Shallow learning resourcesFor later, two theory textbooks that teach why the recipes in MLG 008's cooking analogy work:
More in the resources.
The best language and framework for machine learning are Python and PyTorch, because Python's libraries replace C++, R, MATLAB and the JVM. Also covers Hadoop vs Spark, TensorFlow, JAX and Keras, retired frameworks, and NVIDIA GPUs.
LinksPython and PyTorch. Python is the language of machine learning, and PyTorch is the default deep learning framework for research and most new work. TensorFlow still ships releases, but Google's own new research has largely moved to JAX.
Do you need C or C++ for machine learning?Only if you already know them or write low-level performance code. The heavy math runs on the GPU through NVIDIA's CUDA (a C++ dialect) or similar, and the frameworks' own C++ and CUDA code does that work while you write Python.
R vs MATLAB vs Octave vs JuliaData science spans data mining, data analytics and machine learning (MLG 002), and big-data mining runs on distributed pipelines on the JVM, in Java or Scala. Hadoop MapReduce is the older, disk-based batch system. Spark works in memory, on YARN, Kubernetes or a managed service like Databricks or EMR, with Java, Scala, Python and SQL APIs; most Spark work is now PySpark and SQL, and its machine learning library is MLlib. Spark or a cloud data warehouse is the choice for a new pipeline (MLA 021 covers Databricks). Data that fits on one machine needs no pipeline.
Why Python for machine learning?Python is slow, but its libraries cover every job:
You define the model in Python, and the framework runs each operation as precompiled C++ and CUDA kernels. Theano and TensorFlow 1.x first built a computational graph: Theano compiled the graph into C and CUDA code; TensorFlow 1.x handed it to a C++ runtime. PyTorch and TensorFlow 2 run eagerly, one operation at a time, and compile on request: torch.compile (PyTorch 2.0, 2023) generates Triton kernels, and the XLA compiler serves JAX and TensorFlow.
PyTorch vs TensorFlow vs JAXAll handle convolutional networks (MLG 025), recurrent networks and reinforcement learning (MLG 029).
What happened to Theano, Caffe, CNTK and MXNet?All retired. Theano, from Yoshua Bengio's lab in Montreal, stopped development in 2017. Caffe, a C++ framework with Python and MATLAB interfaces, had its last release in 2017, and Caffe2 merged into PyTorch. Microsoft's CNTK ended in 2019 and Apache MXNet in 2023.
Best GPU for deep learningNVIDIA, through CUDA (Compute Unified Device Architecture) and its cuDNN library for neural networks. PyTorch also supports AMD's ROCm and Apple Silicon. AWS rents NVIDIA's H100 and H200 as P5 instances and the B200 and B300 as P6. MLG 024 revisits the tech stack.
How to learn Python and PyTorchNext: MLG 012, on shallow learning algorithms.
Deep learning stacks simple units into artificial neural networks that learn which feature combinations matter and break data into a hierarchy. Also covers neurons, the multilayer perceptron, backpropagation, when not to use deep learning, and CNNs, RNNs and DQNs.
LinksDeep learning stacks simple learning units into layers. Shallow learning is every algorithm that doesn't, like linear and logistic regression. In practice, deep learning means artificial neural networks (ANNs).
Neural networks have taken over most of AI, including image recognition with convolutional neural networks (CNNs, MLG 025) and language with transformers (MLG 033).
What is a neuron in a neural network?A unit that takes inputs and computes one output. Here, each neuron is a logistic regression unit (MLG 007). Warren McCulloch, a neurophysiologist, and Walter Pitts proposed the artificial neuron in 1943 as a mathematical model of a biological one. Frank Rosenblatt's perceptron (1958) built on it, with a step function where logistic regression has a sigmoid.
Multilayer perceptron architectureThe basic neural network, also called a feedforward network. Each row of data flows left to right:
input layer (one feature per unit) → hidden layer (neurons, called activation functions) → output layer (the hypothesis function)
Every unit feeds every neuron in the next layer. Deep means many layers; wide means many neurons per layer.
Feature learning: the medical cost examplePredicting someone's yearly medical costs from age, smoking and obesity rules out linear regression. Cost grows with age more like age squared, and smoking plus obesity costs more than the two apart. You could hand-build features like age² and smoking × obesity, but usually you don't know which combinations matter. The hidden layer learns them. The output neuron is linear regression to predict a cost, or logistic regression to classify.
Hierarchical representation: the face recognition exampleA 5×5 grayscale image flattens into a row of 25 pixel features. With two hidden layers, each combines the last layer's features into bigger ones:
pixels → lines, edges and contours → eyes, ears, nose and mouth → face or not
The network finds these parts itself.
How neural networks learn: backpropagationGradient descent is one optimizer. Others, like AdaGrad and Adam, apply those gradients differently (MLG 028).
When not to use deep learningWhen the problem is linear or doesn't need feature combinations. Deep learning trains on rented cloud GPUs, while shallow algorithms like naive Bayes, decision trees, support vector machines, k-nearest neighbors and k-means run on a laptop (MLG 012 and MLG 013).
Neural network types and activation functionsHidden layers most often use ReLU (rectified linear unit) or a variant such as GELU. The output layer uses sigmoid, softmax or linear regression. MLG 027 covers choosing activation functions.
Deep learning resourcesMore in the resources. Next: MLG 010, on languages and frameworks.
The math for machine learning is linear algebra, statistics and calculus, and you can learn it through machine learning instead of before it. Also covers matrices, vectors and tensors, probability and inference, gradient descent, convex optimization, and where to learn each.
LinksLinear algebra, statistics and calculus, and you don't have to learn them first. Intro courses like Andrew Ng's open with a primer on the math they use. Go deeper afterward, or give math 20% of your learning time, one day a week. In cooking terms, linear algebra is chopping vegetables, statistics is the cookbook and calculus is the oven.
Linear algebra: matrices and vectorsLinear algebra is math on matrices and vectors, the easiest of the three. The house spreadsheet from MLG 004 is a matrix, capital X: rows are houses and columns are features. The learned weights, theta (θ), are a vector, a list of numbers. A prediction multiplies each feature by its weight and adds the results:
h(x) = θ₀ + θ₁x₁ + θ₂x₂ + θ₃x₃Nested Python for loops are too slow for a million rows. Linear algebra does it in one operation, run on a CPU or GPU with SIMD (single instruction, multiple data).
What is a tensor?A tensor is a list of numbers with any number of dimensions:
TensorFlow is named for it, and it's the core data type of PyTorch, now the most used framework. MLA 005 covers tensor shapes.
Statistics: probability and inferenceStatistics supplies the algorithms and is the hardest of the three. Hypothesis functions (linear and logistic regression) and error functions (mean squared error, log likelihood) are statistics formulas, like the logistic regression cost function:
cost = −(1/m) × Σ [ y × log(h(x)) + (1 − y) × log(1 − h(x)) ]Calculus does the training. The derivative of the loss function is the slope of the error graph at the current θ values, telling each θ which way is downhill and how big a step to take. Repeating that step is gradient descent (MLG 005). Derivatives mostly come from memorized rules, like the power rule and chain rule.
Convex optimizationOptimization is the branch of math that uses calculus to minimize a function. Convex means the error graph is shaped like a cup. It's often listed as a fourth prerequisite, but you learn it with calculus.
Math courses, textbooks and primersThe full math track is in the resources.
The Great Courses: Mathematical Decision MakingMathematical Decision Making: Predictive Models and Optimization is a 24-lecture video course by Scott P. Stevens on operations research: the math of scheduling employees, train departures and factory settings, very close to machine learning's. The Great Courses also has calculus, statistics and linear algebra courses, in the resources.
They're a supplement: the lecturers narrate what they draw, so the videos work as audio. Convert video files to mp3 has the bash script.
Next: MLG 009, on deep learning.
Logistic regression is a classifier: it passes linear regression through the sigmoid function to get a probability, then calls anything over 0.5 a yes. Also covers the decision boundary, log loss, gradient descent, argmax and softmax for more classes, and logistic regression as a neuron.
LinksA supervised learning algorithm for classification. It predicts a class, such as house, tree or dog, where linear regression (MLG 005) predicts a number. Despite its name, it's a classifier: it runs linear regression and passes the result through the logistic function.
The example: expensive or notThe Portland house spreadsheet from MLG 005: one row per house, with columns for square footage, bedrooms, bathrooms and distance to downtown. Replace each price label (y) with 1 if the house cost over $300,000 and 0 if not, and the problem becomes binary classification.
Logistic regression takes the same three steps as linear regression, with different functions:
The hypothesis computes linear regression's output, z = θᵀx (theta transpose x), called the logit. The sigmoid, or logistic function, turns it into a probability between 0 and 1:
h(x) = 1 / (1 + e^(−θᵀx))θ is the vector of learned weights and x is a row of features. θᵀx is the vectorized form of θ₀ + θ₁x₁ + θ₂x₂ + ... (the newer Specialization writes it w·x + b).
An output of 0.7 means the model is 70% confident the house is expensive. Over 0.5 is a yes, under 0.5 a no.
What does the sigmoid curve look like?A stretched-out S. Plotted against z, it approaches 0 as z goes to negative infinity, climbs steeply through 0.5 where it crosses the y-axis at z = 0, and levels off toward 1 as z goes to positive infinity.
The decision boundary is where θᵀx = 0 and the output is 0.5. Training moves it to separate the expensive houses from the rest.
Step 2: the log loss cost functionLinear regression's mean squared error, wrapped around the sigmoid, gives a bumpy cost with many local minima, so gradient descent can get stuck. Logistic regression instead uses log loss, also called the negative log-likelihood or binary cross-entropy. It's convex, with a single minimum, and it charges more the more confident a wrong guess was:
Guessing 0.2 for an expensive house costs less than guessing 0. One formula covers both cases, averaged over the m rows:
cost = −(1/m) × Σ [ y × log(h(x)) + (1 − y) × log(1 − h(x)) ]For each row one term drops out: y = 1 zeroes the second, y = 0 the first.
Step 3: gradient descentGradient descent takes the derivative of the cost, which says which direction and how far to move each θ, and repeats until the cost reaches its minimum (MLG 005). The update rule has the same form as linear regression's, with the sigmoid as h(x):
θⱼ := θⱼ − α × (1/m) × Σ (h(x) − y) × xⱼα (alpha) is the learning rate and xⱼ is the row's value for feature j. Once trained, a new house goes through h(x), and over 0.5 means expensive.
More than two classes: argmax and softmaxWith several classes, say house, tree, dog and cat, the model computes one logit per class, and argmax picks the class with the highest. A sigmoid on each class gives probabilities like 0.7 house, 0.5 tree and 0.3 dog, which don't sum to 1. When the architecture needs a proper probability distribution, softmax turns the logits into probabilities that do (MLG 027).
Classification and action: the lion exampleOn the savanna, recognizing a lion is classification, and deciding to run is a second learned step, choosing an action. In machine learning, a convolutional neural network (MLG 025) can do the seeing and a deep Q-network (MLG 029) the choosing. Both build on units like linear and logistic regression.
How is logistic regression a neuron?Machine learning models nest functions inside each other, as in functional programming. For logistic regression, gradient descent wraps the cost function, the cost wraps the sigmoid, and the sigmoid wraps linear regression.
Deep learning stacks these units: a neuron with a sigmoid activation is a logistic regression unit (MLG 009). Modern hidden layers mostly use ReLU and its variants, keeping sigmoid or softmax for the output layer.
Logistic regression resourcesAndrew Ng's Machine Learning Specialization on Coursera, which replaced the original course the episode assigns. Its first course, Supervised Machine Learning: Regression and Classification, teaches logistic regression in week 3. MLG 006 weighs courses against certificates and degrees.
More in the resources. Next: MLG 008, on the math for machine learning. MLG 010 covers languages and frameworks.
For a machine learning job, a project portfolio counts for more than a MOOC certificate, a cheap online master's like Georgia Tech's OMSCS adds an accredited edge, and a PhD is for research. Also covers Coursera and Udacity, what makes a strong portfolio, online master's costs, and PhD stipends against industry pay.
LinksThree kinds of people learn machine learning: hobbyists working on side projects, job-seekers who want to work in the industry, and scientists who want to research artificial intelligence itself.
Can you teach yourself machine learning?Yes, if it's a hobby. The resources at the end of each episode work as a syllabus, starting with Andrew Ng's Machine Learning Specialization on Coursera, assigned in MLG 005. It's three courses in Python, roughly 10 weeks at Coursera's suggested pace of five hours a week. Later come the textbooks Artificial Intelligence: A Modern Approach, now in its 4th edition (2020), and Deep Learning by Ian Goodfellow, Yoshua Bengio and Aaron Courville, free online.
Are MOOC certificates worth it?MOOCs (massive open online courses) sit between teaching yourself and a degree. Khan Academy teaches the math prerequisites, calculus, statistics and linear algebra, rather than machine learning itself (MLG 008). edX, owned by 2U since 2021, rarely came up in the Reddit and Hacker News debates the host read on MOOCs for machine learning, so he sets it aside. That leaves two:
In the posts by hiring managers and recruiters the host read, and in his talks with recruiters, a certificate doesn't count as a credential, because it isn't accredited. What they do respect is what a course leaves you with: a portfolio of projects, and proof you have the drive to finish an online course on your own.
What makes a strong machine learning portfolio?Projects that scale, not a little classifier that recognizes cats in images: something deployed to the cloud, such as AWS, scaled horizontally, that shows you can build machine learning at production size. Kaggle competitions count too (MLG 017). The host skips the Nanodegree himself and recommends the episodes' resources plus your own side projects, which cover the same ground.
Do you need a degree for a machine learning job?Not always. In web development, a bachelor's in computer science on a job listing works as a suggestion for an applicant with a strong portfolio, and a strong portfolio can likewise get you past a machine learning listing's master's requirement. The host has a bachelor's in computer science, and his interviews only ever asked about his past projects.
A master's is the extra edge: it's accredited, and it opens doors a certificate won't. MLA 001, the redo of this episode promised here, treats the master's as close to required. Entry-level hiring has also tightened since, with Indeed classing 4.5% of software postings as entry-level in early 2026 (MLA 030).
What does an online master's degree cost?A campus master's runs tens of thousands of dollars. Online degrees from strong computer science schools cost far less:
The host's plan was a portfolio first, then OMSCS if applications stalled. He had landed his own machine learning job without either, "grandfathered" into it, so he offers this episode as opinion drawn from recruiters and web discussions.
Do you need a PhD for machine learning?Not for industry. Machine learning engineer roles rarely call for one; research scientist roles at labs like Google DeepMind and Meta are where a PhD counts (MLG 017). Most people who do a PhD do it for the research. Industry projects are assigned to you and tend toward recommender systems, anomaly detection and data analysis, while a PhD gives you years on the open questions in AI, for the mad scientist who wants to solve them.
The trade is pay and hours. Median US computer science PhD stipends run $26,500 to $34,000 for the nine-month academic year, depending on whether you're a teaching assistant, research assistant or fellow (CRA Taulbee Survey, 2025–26), and the weeks can run to 80 hours. US machine learning engineers' median total compensation is about $285,000 (levels.fyi, November 2026). MLA 006 covers salaries.
After the master's, his plan was to weigh a PhD about three years on. The choice is yours.
Discussions on certificates and degreesMore in the resources. Next: MLG 007, on logistic regression.
Linear regression predicts a number, such as a house price, by fitting a line to data. Also covers the cost function, gradient descent, multivariate regression and the Andrew Ng course to take next.
LinksLinear regression is a supervised learning algorithm that predicts a number (regression) rather than a class (classification) by fitting a line to past examples. It is the first algorithm everyone learns in machine learning.
The hypothesis function makes the prediction. It multiplies each feature by a weight, written theta (θ) and also called a coefficient or parameter, and adds the results. Training means finding the θ values.
h(x) = θ₀ + θ₁x₁ + θ₂x₂ + ...The cost function scores how wrong the predictions are. For linear regression it is the mean squared error. The first pass uses random θ values, so the guesses start far off, like $20 for a $200,000 house.
cost = 1/(2m) × Σ (h(x) − y)²Gradient descent is the training step. It moves that point down the bowl to the bottom, where the cost is lowest. Each step takes the derivative of the cost function at the current point, which is the slope there, and moves each θ downhill, turning the line toward the center of the data. The steeper the slope, the bigger the step.
θ₀ := θ₀ − α × (1/m) × Σ (ŷ − y) θ₁ := θ₁ − α × (1/m) × Σ (ŷ − y) × xOne feature is univariate linear regression. Real problems use many, which is multivariate linear regression: the same three steps with one θ per feature. More features generally mean better predictions, up to a point.
Assigned course: Andrew Ng's Machine LearningThe episode assigns one resource before you go further: Andrew Ng's machine learning course on Coursera, now the Machine Learning Specialization. It is self-paced, with video visualizations, quizzes and programming exercises, and teaches the math as it goes. The host finished the original course in three weeks; 10 to 20 minutes a day is enough.
Next in the series: logistic regression, the classifier counterpart.
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.
LinksEvery machine learning algorithm repeats three steps, and textbooks use two names for each.
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.
An algorithm is the code, say a hundred lines of Python, usually with PyTorch. A model is the algorithm plus the pattern it learned, saved as weights.
Features, targets and weightsEach 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 learningNext: MLG 005, on linear regression.