Machine Learning Guide

Machine Learning Guide

Download on the App Store

All Machine Learning Guide episodes

  • MLG 013 Shallow Algos 2

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/13
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    How to choose a machine learning algorithm
    1. Narrow by task: supervised or unsupervised, classification or regression.
    2. Narrow by data and limits: numeric or categorical features, missing values, number of examples, memory and time. scikit-learn's Choosing the right estimator flowchart asks these questions.
    3. Train the shortlist and keep whichever scores best on held-out data (MLG 015).
    Support vector machines (SVM)

    An 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 trick

    A 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 probability
    • Joint probability, P(A and B): how often both happen. For independent events, like two coin flips, multiply: 0.5 × 0.5 = 0.25. Cloudy and rainy days are dependent, so their joint probability is the measured overlap.
    • Conditional probability, P(B | A): the chance of B once you know A.
    P(rain | cloudy) = P(rain and cloudy) / P(cloudy) Bayes' theorem

    Conditional 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 classifier

    For 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 classification

    Text 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 Bayes
    1. Andrew Ng's Machine Learning Specialization covers neither. His Stanford CS229 lectures (Autumn 2018) do: Lecture 5 for naive Bayes, 6 and 7 for SVMs and kernels.
    2. Machine Learning with R by Brett Lantz (4th edition, 2023), a chapter on each.
    3. The Great Courses' Mathematical Decision Making, Lecture 20 on Bayesian analysis.
    4. Khan Academy Statistics for Bayes' theorem.

    Next: MLG 014, on anomaly detection, recommenders and Markov chains.

    56 min
  • 12.5. Podcast still alive, sorry for delay
    Podcast is still alive, working on next episode - sorry for the delay!
    Sorry guys, had an intense last 3 weeks. Mid-move to Portland OR my employer folded so I had to hunt, stat (new expenses & all). Luckily I found a job in NLP, my favorite branch of ML! Big-time silver lining. BTW, everyone these days does whiteboarding. Used to be the top-dogs, now it's everyone. If you're ever on the hunt, read CtCI first (http://amzn.to/2nu6ya1). Essential.
    1 min
  • MLG 012 Shallow Algos 1

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/12
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    Shallow learning vs deep learning

    Shallow 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 learning
    • Supervised: the data comes labeled, with the answer in the spreadsheet's last column. Classification predicts a class, regression a number.
    • Reinforcement: the model gets a goal, rewards and penalties, and learns the rules by acting (MLG 029).
    • Unsupervised: no labels. The model finds structure itself.
    K-nearest neighbors (KNN)

    KNN 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 clustering

    In k-means you choose k, the number of clusters, and it learns where their centers (centroids) go:

    1. Drop k centroids (team captains) at random.
    2. Each point joins its nearest centroid.
    3. Each centroid moves to the middle of its points.
    4. Repeat until no point switches.

    The elbow method and silhouette scores help choose k (MLA 011).

    Association rules and the Apriori algorithm

    Market 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 trees

    A 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 boosting

    A single deep tree tends to overfit (MLG 015).

    • Random forest: many trees, each trained on a bootstrap sample of rows with random feature subsets at each split, then averaged or voted.
    • Gradient boosting: shallow trees built in sequence, each fitting the previous trees' errors. XGBoost, LightGBM and CatBoost are the standard libraries.

    Tree ensembles still often beat deep learning on tabular data.

    Shallow learning resources
    1. Andrew Ng's Machine Learning Specialization on Coursera. Course 2 teaches decision trees and tree ensembles; Course 3, k-means and anomaly detection.
    2. Machine Learning with R by Brett Lantz (4th edition, 2023) covers what Ng skips: KNN, naive Bayes and Apriori, plus decision trees and k-means, in R.
    3. Jason Brownlee's A Tour of Machine Learning Algorithms.
    4. scikit-learn's Choosing the right estimator flowchart; scikit-learn is still the library for these algorithms.

    For later, two theory textbooks that teach why the recipes in MLG 008's cooking analogy work:

    • The Elements of Statistical Learning (2nd edition, 2009), a free PDF from the authors.
    • Christopher Bishop's Pattern Recognition and Machine Learning (2006), free from Microsoft Research.

    More in the resources.

    54 min
  • MLG 010 Languages & Frameworks

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/10
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    Best language and framework for machine learning

    Python 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 Julia
    • R: the host's pick of the four, strong in statistics, academia and data analytics. Python leads machine learning.
    • MATLAB: commercial, common in engineering and academia. Octave is its free counterpart. Andrew Ng's original Coursera course taught in Octave; its replacement, the Machine Learning Specialization (2022), teaches in Python.
    • Julia: used in scientific computing, still niche in machine learning.
    Hadoop vs Spark

    Data 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:

    • NumPy replaces MATLAB: arrays, slicing, linear algebra (MLA 005).
    • pandas replaces most of R for analytics (MLA 002); Polars is a faster alternative.
    • PySpark replaces the JVM for pipelines.
    • scikit-learn covers shallow learning: linear and logistic regression, support vector machines, naive Bayes.
    • Deep learning frameworks (MLG 009) replace C++ for GPU speed.
    How deep learning frameworks run Python on the GPU

    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 JAX
    • PyTorch: from Facebook (now Meta) in 2017, the Python successor to Lua Torch.
    • TensorFlow: Google's, from 2015.
    • JAX: Google's NumPy-style library with automatic differentiation, compiled for GPUs and TPUs.
    • Keras 3 (2023) is a high-level API over JAX, TensorFlow or PyTorch.

    All 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 learning

    NVIDIA, 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 PyTorch
    1. Python: Python Crash Course by Eric Matthes, or another Python pick in the resources.
    2. The framework: the free, regularly updated PyTorch Tutorials, or another PyTorch pick in the same section. For TensorFlow, its TensorFlow Tutorials.
    Language and framework comparisons, 2016–2017
    • Jason Brownlee's Best Programming Language for Machine Learning
    • Bob Muenchen's Data Science Job Report 2017
    • Madison May's (indico) An Overview of Python Deep Learning Frameworks
    • Kenneth Tran's Evaluation of Deep Learning Toolkits

    Next: MLG 012, on shallow learning algorithms.

    45 min
  • MLG 009 Deep Learning

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/9
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    Deep learning vs shallow learning

    Deep 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 architecture

    The 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 example

    Predicting 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 example

    A 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: backpropagation
    1. Feedforward pass: predict.
    2. Loss: how far off the prediction was. Cross entropy for a classifier, mean squared error for a regression like medical costs.
    3. Backpropagation: carry the error backward through every layer to get each θ parameter's gradient, then update each θ with gradient descent (MLG 005).

    Gradient descent is one optimizer. Others, like AdaGrad and Adam, apply those gradients differently (MLG 028).

    When not to use deep learning

    When 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 functions
    • Multilayer perceptron: the basic network taught here.
    • Convolutional neural network: images.
    • Recurrent neural network: sequences such as time series, and text before transformers. Its neurons feed back into themselves (MLG 022).
    • Deep Q-network (DQN): planning (MLG 029).

    Hidden 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 resources
    1. 3Blue1Brown's Neural networks videos, a short visual introduction.
    2. Andrew Ng's Machine Learning Specialization on Coursera. Its second course, Advanced Learning Algorithms, builds neural networks in TensorFlow.
    3. Deep Learning by Ian Goodfellow, Yoshua Bengio and Aaron Courville, a free online textbook. Start it after Ng's course.

    More in the resources. Next: MLG 010, on languages and frameworks.

    52 min
  • MLG 008 Math for Machine Learning

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/8
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    What math do you need for machine learning?

    Linear 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 vectors

    Linear 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:

    • 0D: a number
    • 1D: a vector
    • 2D: a matrix
    • 3D: a cube, like an image, whose pixels each hold red, green and blue values

    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 inference

    Statistics 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)) ]
    • Probability describes how data is distributed, like prices in a housing market.
    • Inference predicts a new example, like one house, from that distribution.
    Calculus: derivatives and gradient descent

    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 optimization

    Optimization 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 primers
    • Khan Academy, free: Linear algebra, Statistics and probability, plus Calculus 1, Calculus 2 and Multivariable calculus.
    • Textbooks: Introduction to Linear Algebra by Gilbert Strang, All of Statistics by Larry Wasserman and Calculus: Early Transcendentals by James Stewart.
    • Primers: Stanford's CS229 linear algebra and probability primers (26 and 12 pages).

    The full math track is in the resources.

    The Great Courses: Mathematical Decision Making

    Mathematical 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.

    28 min
  • MLG 007 Logistic Regression

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/7
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    What is logistic regression?

    A 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 not

    The 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:

    1. Predict with the hypothesis function, starting from random θ (theta) values.
    2. Measure the error with the cost function.
    3. Train θ with gradient descent to shrink that error.
    Step 1: the sigmoid hypothesis function

    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 function

    Linear 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:

    • Expensive house (y = 1): the cost is −log(h(x)), 0 when the guess is 1 and rising toward infinity as the guess nears 0.
    • Not expensive (y = 0): the cost is −log(1 − h(x)), 0 when the guess is 0 and rising toward infinity as the guess nears 1.

    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 descent

    Gradient 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 softmax

    With 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 example

    On 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 resources

    Andrew 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.

    35 min
  • MLG 006 Certificates & Degrees

    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.

    Links
    • Notes and resources at ocdevel.com/mlg/6
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    Which path into machine learning fits you?

    Three 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:

    • Coursera, co-founded by Andrew Ng and Daphne Koller, was the pick for one-off courses, like Ng's original. Its multi-course Specializations got recommended less in those debates. It also sells Professional Certificates from companies such as IBM and Google, and full degrees (below).
    • Udacity, co-founded by Sebastian Thrun, sells Nanodegrees: multi-month programs with mentors, programming projects and peer interaction. Accenture bought Udacity in 2024, and it now sells them through a monthly subscription. Google's free Deep Learning course on Udacity is gone; its page leads to the paid Deep Learning Nanodegree.

    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:

    • Georgia Tech's OMSCS: 30 credit hours at $227 each (fall 2026 rates) is about $6,800 in tuition, or roughly $8,900 to $9,500 with the online learning fee charged each term. It has a Machine Learning specialization. Georgia Tech faculty teach it, and graduates get the same Master of Science in Computer Science diploma as on-campus students.
    • Georgia Tech's Online Master of Science in Artificial Intelligence: announced in October 2026, with classes from August 2027, at about $12,000 in tuition.
    • UT Austin's online MSCS, MSAI and MSDS: $10,000 in tuition, $1,000 per course.
    • Degrees on Coursera: the University of Illinois's Master of Computer Science costs $19,840 to $25,376, and CU Boulder's MS in Artificial Intelligence $15,750.

    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 degrees
    • Is Udacity's AI Nanodegree Worth It? on Hacker News (2017)
    • Ask HN: Master vs. Udacity nanodegree (2016)
    • Ravin Kumar's My Guide on Data Science Programs (2016)
    • Cole MacLean's Self Taught AI (2014)

    More in the resources. Next: MLG 007, on logistic regression.

    16 min
  • MLG 005 Linear 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.

    Links
    • Notes and resources at ocdevel.com/mlg/5
    • Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
    What linear regression is

    Linear 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 example, carried over from MLG 004: estimate a Portland house's price from its square footage, bedrooms, bathrooms and distance to downtown.
    • The three steps of every algorithm in the series, each with several names: predict (hypothesis, objective, estimate), measure the error (cost, loss) and train (learn, fit).
    The hypothesis function

    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₂ + ...
    • With one feature, square footage, this is the slope-intercept line y = mx + b from algebra: h(x) = θ₀ + θ₁x, where θ₁ is the slope.
    • θ₀ is the bias, where the line crosses the y-axis: the prediction when you have no other information, like the average house price in Portland.
    • Plot square footage against each house's actual price (its label, y) and you get a cloud of dots running up and to the right. A good hypothesis is a line through the middle of it.
    The cost function: mean squared error

    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)²
    • m is the number of training examples, h(x) is the prediction (also written ŷ) and y is the actual price.
    • Squaring keeps positive and negative errors from canceling out. The square and the 2 in the denominator cancel when you take the derivative.
    • Picture a bowl: θ₀ and θ₁ are the floor axes and the cost is the height, so each pair of θ values is a point on the bowl.
    Gradient descent

    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) × x
    • α (alpha) is the learning rate, which the episode leaves to the course below.
    • The cost never reaches zero on real data, because the points don't all sit on one line.
    Univariate and multivariate linear regression

    One 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 Learning

    The 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.

    34 min
  • MLG 004 Algorithms - Intuition

    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.

    1. Predict (infer): make a guess, like a chess move or a house price.
    2. Error (loss): an error function scores how far off the guess was.
    3. 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.

    1. Load a spreadsheet of sold houses, say a million rows, into an algorithm such as linear regression.
    2. Row by row, it predicts a price, measures the error against the real price and updates its weights.
    3. The trained model prices houses it has never seen.
    4. 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. 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.

    23 min