Learn AI: A Hands-On AI Course

Learn AI: A Hands-On AI Course

By OCDevelTechnology
Download on the App Store

All Learn AI: A Hands-On AI Course episodes

  • 12. Trees That Fix Each Other's Mistakes

    A hand-worked introduction to gradient boosting using four houses, then a plan for running scikit-learn's histogram boosting classifier on MNIST and comparing it with the earlier forest. It closes with library news on PyTorch 2.15 and XGBoost 3.3.0.

    This episode is narrated by AI-generated synthetic voices.

    Episode page & show notes

    Visit website

    Boosting by hand on four houses

    Gradient boosting builds small trees in sequence. Each tree is fitted to what the model so far still gets wrong, and its output is added with a small weight. A random forest instead averages many deep trees grown side by side. The lesson works a four-house example on paper. It starts from the mean price, fits a one-question stump to the residuals, and adds half of that correction. The squared error falls from 40 to 13 to 6.25. Two stumps on the same cut leave the first two houses tied, and a stump learns only one cut per round, which is why real boosting uses trees with several leaves. A small learning rate means more trees but usually generalizes better, and the number of trees is set by watching a validation score.

    Why it is called gradient boosting

    With squared error, the residual is the negative gradient of the loss, so each tree is a downhill step in the space of prediction functions. That is the framing in Friedman's 2001 Annals of Statistics paper. For classification, the loss is log loss, and each class's tree is fitted to the true indicator minus the predicted probability.

    Boosting on MNIST

    The tool is HistGradientBoostingClassifier, run on the same 50,000 training and 10,000 validation images as the forest. Features are binned into at most 255 bins, so split search adds up gradients per bin instead of sorting values. The defaults give shallow trees of up to 31 leaves. Early stopping switches on automatically at this data size and holds out 5,000 training images. After fitting, n_iter_, validation_score_ and train_score_ show what happened.

    Each iteration grows ten trees, one per digit. That may shrink the speed edge over the forest, but this is reasoning, not a measurement. Published comparisons on raw MNIST pixels are thin. One informal report on unknown hardware put the histogram version near 97.1 percent in about 29 seconds, against the older GradientBoostingClassifier at about 96.3 percent in nearly twenty minutes. Raw pixels are not boosting's home ground. It does best on tables with mixed columns. XGBoost and LightGBM use the same core method.

    The exercise is six runs, at learning rates 0.05, 0.1 and 0.3 with max_iter of 100 and 300. Record n_iter_, validation accuracy, fit time and predict time, then compare with the forest.

    Library news

    No new release of PyTorch, scikit-learn, XGBoost or LightGBM was confirmed in the past two weeks. Two earlier changes matter:

    • PyTorch 2.15 makes a rewritten NCCL backend the default for multi-GPU training, with a rollback option. It drops Python 3.10 and macOS 14 for MPS. PyTorch is not yet in the lock file, so check the pinned Python and macOS version, try it in a copy of the project, and only then commit.
    • XGBoost 3.3.0 deprecates gblinear, the booster that adds linear models instead of trees. Treat tutorials that use it with caution and stay with the default tree booster.
    • 18 min
    • 11. A Crowd of Unstable Trees

      Explains how a random forest fixes a single decision tree's weaknesses on MNIST, through bootstrap sampling, random feature subsets, and averaging. Covers scikit-learn defaults, out-of-bag scoring, feature and permutation importance, and a sweep exercise.

      This episode is narrated by AI-generated synthetic voices.

      Episode page & show notes

      Visit website

      Why one tree falls short

      Last time a single decision tree on MNIST reached about 87–88 percent on validation images, and its shape changed when a random five percent of rows was dropped. A random forest grows many trees on slightly different versions of the data and averages them. RandomForestClassifier on raw pixels gets close to 97 percent, level with nearest neighbors and above logistic regression's 92.

      Bagging and out-of-bag rows

      Each tree trains on a bootstrap sample, drawn with replacement. A worked ten-row example shows some rows repeated and others missing. About 63 percent of distinct rows land in a sample, and about 37 percent are left out. Those out-of-bag rows serve as a check on that tree.

      Why averaging helps, and why it stops

      Averaging M trees leaves variance of rho times sigma squared plus (1 minus rho) times sigma squared over M. With sigma squared of 1, 100 trees and rho of 0.5, variance only falls to about 0.505. Shared mistakes cannot be averaged away. So each split also looks at a random subset of features, the square root of 784, which is 28 pixels. Trees get slightly weaker but disagree more. Breiman's 2001 paper bounds forest error by tree strength and correlation, and shows adding trees does not cause overfitting.

      Building one and reading the defaults

      Fit on 50,000 images, validate on 10,000, keep the last 10,000 sealed, no scaling needed. Defaults covered: n_estimators 100 (10 before version 0.22), max_features "sqrt" (earlier "auto"), bootstrap True, min_samples_leaf 1, oob_score False, n_jobs and random_state. Fully grown trees use lots of memory; min_samples_leaf or max_depth shrinks them. One published benchmark reports 97.20 percent test accuracy on raw MNIST, with an unstated tree count. A forest predicts much faster than nearest neighbors, so time both.

      Out-of-bag score

      With oob_score on, each training image is scored only by trees that missed it. Expect a slightly pessimistic number, optimism if you tune on it, and NaN rows in oob_decision_function_ with very few trees.

      Importances and probabilities

      feature_importances_ is computed on training data and can favor features with many distinct values. Permutation importance uses held-out data, but correlated neighboring pixels can hide each other. predict_proba averages leaf fractions, giving smoother scores that are not necessarily calibrated. ExtraTreesClassifier draws random thresholds and defaults to no bootstrap.

      Exercise

      Sweep n_estimators (10, 50, 100, 300) against max_features ("sqrt", 0.5) on validation only, with oob_score on and a fixed seed. Guess first, then record out-of-bag score, validation accuracy, fit time and prediction time. Gradient boosting, which adds trees one after another to fix earlier errors, comes next.

      15 min
    • 10. Twenty Questions About Pixels

      A decision tree picks yes-or-no pixel questions by measuring how much each cut reduces Gini impurity or entropy, shown with a hand-worked example. The chapter then covers how greedy splitting limits it, how tree depth drives overfitting on MNIST, and why tree probabilities and structure need caution. It closes with a Gemini 4 Carbon announcement and a fraud-detection paper on calibration.

      This episode is narrated by AI-generated synthetic voices.

      Episode page & show notes

      Visit website

      How a tree picks its questions

      A decision tree reduces the training images to a short series of yes-or-no questions about pixels, then discards the images. This is the opposite of k-nearest neighbors, which keeps every image and works when a new one arrives. The chapter asks how a tree chooses its first question and how it knows when to stop.

      Gini impurity and entropy

      Two numbers measure how mixed a group is. Gini impurity is one minus the sum of squared class shares. Entropy, in bits, is the negative sum of each share times the base-two log of that share. For six sevens and four ones, Gini is 0.48 and entropy is about 0.97 bits. A pure group scores zero on both. The two usually choose the same split.

      Choosing a cut by hand

      Candidate thresholds are midpoints between neighboring sorted values, and a hand calculation needs only those where the label changes. In the worked ten-image example, cut A lowers weighted impurity by about 0.31, cut B by about 0.16 and cut C by 0.32, so C wins. The tree then repeats the process on each side.

      The limit of greedy splitting

      Each split is chosen for its immediate gain. An XOR pattern across two pixels shows no gain from either pixel alone, so a greedy tree can miss it. Finding the truly best tree is NP-complete, so trees are built one step at a time.

      Growing a tree on MNIST

      The chapter uses DecisionTreeClassifier with criterion, max_depth, min_samples_leaf and random_state, fitting on the first fifty thousand training images and validating on the next ten thousand. Scaling changes nothing for a tree. An unlimited tree grows thousands of leaves and reaches about 100 percent training accuracy, while validation typically lands near 87 to 88 percent, below logistic regression's 92 and nearest neighbors' 97. A typical depth sweep runs from about 20 percent at depth 1 to the mid-80s at depth 10, then flattens. min_samples_leaf forbids tiny leaves and shrinks the tree, and ccp_alpha pruning is named as a third option.

      Reading and trusting the tree

      export_text and plot_tree print the top questions of a tree, and a pixel number divided by 28 gives its row and column. feature_importances_ reshaped to 28 by 28 shows bright pixels near the center and near zero at the border. predict_proba on a tree is just leaf class counts, so deep trees give mostly zero or one and are poorly calibrated. Trees are also unstable: refitting after dropping a random five percent of the data can change the top split and everything below it. That instability motivates random forests, which come next. The exercise is a twenty-fit sweep of max_depth against min_samples_leaf on validation only, with two built-in checks.

      News

      Google DeepMind announced Gemini 4 Carbon on October 28, 2026, aimed at cybersecurity and engineering.

      A paper on fraud detection under operating limits, arXiv 2610.39556, uses chronological holdouts with XGBoost and LightGBM. On PaySim data, Platt calibration cut the Brier score from 0.1141 to 0.0245. Alerting on only the top one percent of scores cut false-positive investigations from 192 to 117, while recall fell from 0.4236 to 0.2122. These results hold for that dataset and setup only.

      11 min
    • 9. Classifying by the Closest Examples

      How k-nearest neighbors labels a handwritten digit by letting the closest stored training images vote, why the choice of k and of distance decides its behavior, and why it beats logistic regression on MNIST accuracy while costing far more at prediction time. Also covers TorchTPU and PyTorch 2.15.

      This episode is narrated by AI-generated synthetic voices.

      Episode page & show notes

      Visit website

      A model that stores instead of learning

      k-nearest neighbors keeps every labeled training image. It does its work only when a new image arrives: it measures the distance to each stored example, takes the k closest, and lets them vote. A hand-worked example uses two classes on a flat page with one stray point near the wrong cluster. The same new point is labeled B at k of one, A at k of three, and B at k of seven. Small k chases oddities. Large k lets the bigger class win. Good values are found on held-out data.

      What "close" means for pixels

      On MNIST, each image becomes a point with 784 coordinates, and Euclidean distance rewards ink in the same pixels. A seven shifted by one pixel can look farther away than a different digit drawn in the same spot. Dividing pixels by 255 shrinks every distance equally, so accuracy does not change. StandardScaler inflates near-empty border pixels, and reported results show it costs accuracy. Logistic regression could give those pixels small weights. kNN has no weights, so the scale it receives sets how much each pixel counts.

      Results, cost and diagnostics

      Using scikit-learn's KNeighborsClassifier on the existing validation split, the scikit-learn KNeighborsClassifier reference explains the defaults: n_neighbors, weights, Minkowski metric with p, algorithm, and n_jobs. Tree searches save almost nothing in 784 dimensions. Reported accuracy on raw pixels is roughly 96.8 to 97.2 percent, as in this MNIST classifier at about 97 percent, against about 92 percent for logistic regression.

      Fitting is instant. Prediction takes minutes because it compares every validation image with every stored one, and memory grows with the training set. The chapter suggests comparing confusion matrices against logistic regression. It warns that predict_proba values come in steps of 1/k, so ROC curves turn coarse and the scores are not calibrated.

      A sixteen-run experiment varies k, weighting and scaling on a 2,000-image subset. It includes:

      • a written guess before each run
      • a noise estimate of about four tenths of a point
      • an identity check at k of one
      • the expectation that timing stays flat across settings
      • Decision trees come next.

        PyTorch on TPUs, and version 2.15

        Google and Meta announced the open-source TorchTPU, which brings eager-mode PyTorch to TPUs. It covers about 450 core operations and connects to torch.compile, vLLM, SGLang and TorchTitan. The chapter cautions that this coverage does not guarantee support for every model, and that speed depends on the workload. PyTorch 2.15 brings FSDP2 upgrades and newer AMD and Intel support. On an M3 Ultra, mixture-of-experts decoding ran about a third faster through Metal, a result measured only for that setup. Nothing needs to change yet. Once PyTorch is added, pin the version and rerun a saved experiment around each upgrade.

        24 min
      • 8. Ranking Every Threshold at Once

        How ROC curves and AUC measure a model's ranking rather than a single threshold, worked by hand and then on MNIST in scikit-learn. It also covers when precision-recall and average precision reveal what ROC hides, plus notes on pandas 3.1.0 and a seed-related change in scikit-learn's development branch.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        From a single cut to a whole ranking

        Precision, recall and F1 describe one threshold, but a logistic-regression model on MNIST hands back scores. Sort the validation images by how seven-like the model thinks they are and you get a ranking. Any threshold is one cut through that ranking. The ROC curve and its area, AUC, grade the ranking itself. To get a yes-or-no question, the ten digits are reduced to one-vs-rest: sevens against everything else, roughly one positive for every nine negatives.

        Eight images, fourteen pairs out of fifteen

        A worked example with three sevens and five non-sevens sweeps the cut from high to low. Each positive let in is a step up and each negative is a step right. The one ranking mistake, a non-seven at 0.70 above a seven at 0.60, gives an area of fourteen fifteenths. Counting positive-negative pairs gives the same figure: AUC is the chance that a random positive outscores a random negative. It ignores thresholds and exact score values, so it says nothing about where to cut or whether a 0.8 means eighty percent. That second property is calibration, and it has to be checked separately.

        Running it on MNIST

        The chapter covers roc_curve on a single probability column, and roc_auc_score with multi_class="ovr", labels set to classes_, and average=None for per-digit values. Plotting uses RocCurveDisplay.from_predictions. Macro AUC near 0.99 alongside roughly 92% accuracy has two causes. Ranking is easier than picking the single right digit, and the many easy negatives dilute the false positive rate.

        When precision-recall tells more

        At one-in-a-thousand rarity, the same one percent false positive rate buries real hits under false alarms, while the ROC curve looks unchanged. precision_recall_curve ignores true negatives. average_precision_score sums precision weighted by each rise in recall. Its random floor is the positive rate, which PrecisionRecallDisplay can draw with plot_chance_level=True. The exercise asks you to predict, then rank, all ten digits by AUC, AP and F1 on validation only, and to explain where the rankings disagree.

        pandas 3.1.0 and the scikit-learn development branch

        pandas 3.1.0 shipped on October 22. It changes nothing in this workflow. Check your pinned version with uv tree and upgrade between experiments, not during one.

        scikit-learn's unreleased 1.10 dev branch changes feature subsampling in histogram gradient boosting. As a result, the same random_state can now produce different trees. The suggested check is to rerun one saved experiment on the old and new lock files and compare validation metrics. A large shift from the upgrade alone suggests the result leaned on luck.

        27 min
      • 7. Where the Ninety-Two Percent Goes Wrong

        How a confusion matrix, precision, recall and F1 expose which mistakes a handwritten-digit classifier makes, why accuracy alone can mislead, and how moving a decision threshold trades precision against recall. Also covers the final release of Python 3.15 and how to check a project against it.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        What accuracy hides

        A logistic-regression model that gets about nine digits in ten right still tells you nothing about the tenth. Which images does it miss, and what does it call them instead? Everything here is computed on a validation split: fit on the first fifty thousand training images, predict on the last ten thousand. The test set stays shut, so that looking hard at mistakes doesn't shape the final score.

        Reading a confusion matrix

        A worked example uses a tiny three-digit classifier (one, seven, nine) on twelve images. Its accuracy is 75%, but that figure hides that every one was found, sevens were the weak spot, and sevens and nines were confused in both directions. A confusion matrix keeps all of this. Rows are truth, columns are predictions. The diagonal holds the correct answers, and each off-diagonal cell is a specific mistake. Mirror cells show whether a confusion runs one way or both.

        Precision, recall and F1

        Precision looks down a column: of everything called a seven, how many were sevens? Recall looks along a row: of the real sevens, how many were found? F1 is their harmonic mean. It is pulled down hard by the weaker number, so a model that is excellent on one and hopeless on the other can't score well. A model that says seven only once, correctly, out of fifty real sevens averages 51 but gets an F1 of about 0.04.

        The ten-by-ten grid on MNIST

        scikit-learn's confusion matrix function and ConfusionMatrixDisplay draw the grid as a heat map. ConfusionMatrixDisplay replaces the removed plot confusion matrix function. Normalising by row makes each diagonal cell that digit's recall, and normalising by column makes it precision. For this model, five and eight usually have the lowest recall, in the high eighties, while zero and one sit near 97 to 98 percent. Pairs worth checking include 4/9, 3/5, 7/9 and 2/8.

        The classification report

        The report lists per-digit precision, recall, F1 and support, plus accuracy, a macro average and a weighted average. On near-balanced MNIST the two averages sit close together. On imbalanced data they split, and a good weighted average can hide a rare class the model has nearly given up on.

        When accuracy misleads, and moving the threshold

        A detector that always says "negative" on data with 1% positives scores 99% accuracy and finds nothing. Using predict proba with a one-versus-rest cutoff for eight, lowering the threshold raises recall and lowers precision, and raising it does the reverse. Where to set it depends on what each kind of mistake costs. That choice is made on validation data and written down.

        Exercise

        Guess the worst-recall digit, check it against the report, plot ten to twenty of its errors, and write one sentence on what they share.

        Python 3.15 ships

        After a third release candidate, the final release is out. It adds opt-in lazy imports (PEP 810), UTF-8 as the default file encoding, a built-in frozendict, and the Tachyon sampling profiler. The suggested check is to rerun the project on 3.15 in a copy and compare classification reports with the 3.14 run.

        24 min
      • 6. The First Model That Actually Learns

        Linear regression is fitted by hand to show least squares, then logistic regression with softmax and log loss is trained on MNIST, reaching about 92 percent. A short news segment covers the one-week delay of Python 3.15 and the release of Polars 2.0.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        Least squares on four points

        A model of this kind is a weighted sum of features plus a rule for choosing the weights. Four invented points (hours studied against quiz score) are fitted by hand. Each error is squared so misses can't cancel and big misses cost more. The line that minimises the sum of squared errors comes out as prediction = 1.4x + 0.5, with squared errors totalling two tenths. scikit-learn's LinearRegression returns the same coef_ and intercept_. It needs x as a four-by-one column, because the library always expects a two-dimensional feature table. Squaring is flagged as a choice that suits symmetric noise with rare large misses. A later chapter gives that assumption a precise form.

        From a line to class probabilities

        A line can't name a digit. An output of 4.6 is no class, and nothing keeps predictions in range. Logistic regression keeps the weighted sum but changes what is done with it. A sigmoid squashes the sum into a yes-or-no probability. Softmax turns ten per-digit scores into ten probabilities that add to one. Scoring switches to log loss. It charges about a tenth for giving the right digit 0.9, about 0.7 for 0.5, and about 4.6 for 0.01. Log loss has no closed-form solution, so the solver improves the weights step by step.

        Ninety-two percent on MNIST

        LogisticRegression goes inside a pipeline after StandardScaler. That way the scaler learns averages from training images only. Scaling evens out the loss surface so the lbfgs solver converges faster. The default max_iter of 100 triggers a ConvergenceWarning on MNIST, so the chapter uses 1,000. The multi_class parameter, deprecated in scikit-learn 1.5 and scheduled for removal, should be left out. The test score lands around 92–93 percent, against the 11.35 percent baseline.

        Per-digit accuracy is uneven, and listeners are told to read their own numbers. Reshaping the coefficient row for zero to 28×28 shows a rough ring of positive weight with a negative centre. That template shows both what the model learned and its limit with shifted strokes. The exercise compares scaling choices and iteration limits on a validation split, never on the test set.

        Python 3.15 delayed a week

        Blocking bugs in the lazy-import feature (PEP 810) pushed the final release from October 1 to October 9. Release manager Hugo van Kemenade issued a third release candidate on October 2. pandas 3.0.6 and scikit-learn 1.9.1 already ship prebuilt packages for 3.15, in standard and free-threaded builds. Once 3.15 final is out, the suggested check is to pin a copy of the project to it with uv, confirm the library versions, and rerun the notebook. Polars 2.0.0 makes streaming the default for lazy queries. Its joins and group-bys no longer preserve row order unless maintain_order is set, which can silently misalign positional splits.

        18 min
      • 5. The Number Every Model Must Beat

        Using the MNIST arrays, this chapter inspects the data with NumPy and pandas, seals off the test set, and measures an honest floor of about 11.35 percent with a model that ignores the pixels. It closes with what Python 3.15's release candidate means for a project pinned to 3.14.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        Reading the arrays before any model

        X.shape prints (70000, 784): seventy thousand images, one per row, and one pixel position per column. y.shape prints (70000,), a flat list with one label per row of X. Checking dtype shows the pixels stored as float64, eight bytes each and about 440 MB for the whole array, even though the values are whole numbers from 0 to 255. The same values as uint8 would take an eighth of the space, but uint8 arithmetic wraps silently, so 200 plus 100 comes out as 44. The labels are text strings, the character "5" rather than the number five. Slicing at row sixty thousand gives a 60,000-image training set and a 10,000-image test set with no overlap. Reshaping one row to 28 by 28 shows the stroke of a handwritten five.

        pandas is used only for inspection. value_counts shows the classes are close to balanced. Ones are the most common class at about eleven percent. A small per-pixel table shows that corner pixels are almost always zero, so some features carry almost no information. The model still trains on the raw NumPy array, not on this table.

        Keeping the test set shut

        The test slice is set aside before any modeling choice and scored once, at the end. Checking it repeatedly while tuning means the final number measures fit to those ten thousand images, not to new handwriting. Slicing by position works for MNIST because the dataset was built with this split in mind. Most datasets have no such guarantee. The general tool is a shuffled, stratified split with a fixed random seed, as described in the train_test_split reference. A random split can still leak information through repeat writers, duplicate rows or repeated customers. The fix is to split by the unit that has to stay separate.

        A model that ignores the pixels

        DummyClassifier with most_frequent looks only at the labels and predicts "1" for every image. Its test accuracy is 1,135 correct out of 10,000, about 11.35 percent. Broken down by digit, it is perfect on ones and gets every other digit wrong, a pattern the single accuracy figure hides. An exercise compares this with the stratified and uniform strategies. Both should land near ten percent and spread their errors evenly across the digits. most_frequent wins on accuracy and is also the most lopsided. Linear and logistic regression come next, and their scores are to be read against this floor.

        Python 3.15 and a pinned project

        Python 3.15 reached its second release candidate, with the final release scheduled for 1 October 2026. The release notes list lazy imports, the Tachyon profiler and a built-in frozendict. UTF-8 also becomes the default encoding for open(), which could change how a CSV file reads on Windows. NumPy has prebuilt wheels for 3.15. pandas and scikit-learn wheels were still pending, so the advice is to stay on 3.14 for this course. Test 3.15 in a throwaway environment, and upgrade the lockfile only once those wheels exist. After upgrading, confirm the baseline still prints 11.35 percent.

        16 min
      • 4. A Workspace Someone Else Can Rerun

        This chapter builds a machine-learning workspace that someone else can rerun, using uv, a lock file, git and a documented MNIST download. It also covers what a random seed can and cannot guarantee, and how uv 0.12 changes the project that uv init creates.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        Why "it worked on my machine" happens

        A notebook that runs on one laptop and fails on another usually has one of four ordinary causes: a different Python version, library versions that drift, hidden notebook state left in the kernel, or data fetched from somewhere nobody wrote down. From this point the course starts making claims about models, and each claim assumes someone else could rerun the work and get the same answer.

        A workspace that another person can rebuild

        Each cause gets its own fix. uv, from Astral, manages the Python version, an isolated environment and pinned dependencies. It installs with brew install uv on a Mac, winget install --id=astral-sh.uv -e on Windows, or Astral's standalone installer on Linux. uv init creates the project, its pyproject file and a .python-version file naming the exact Python, and it also makes the folder a git repository with a starter .gitignore. uv add numpy matplotlib scikit-learn records the dependencies, builds the private .venv and writes uv.lock, which stores exact versions, hashes and sources. Jupyter tools are added as dev dependencies, and uv run jupyter lab opens a notebook inside the project environment. That setup follows uv's guide to using Jupyter. Git tracks everything that describes and rebuilds the project. uv's starter .gitignore already covers .venv and caches; data files, notebook checkpoints and any .env secrets are added by hand.

        First contact with MNIST

        The data loads through one documented route, scikit-learn's fetch_openml, as mnist_784 version 1 (ID 554). The arrays come back as 70,000 × 784 images and 70,000 labels. The labels are text, not numbers. The standard split keeps the first 60,000 images for training and the last 10,000 for testing. The first image is displayed next to its label, a five, as a check that the two agree. The class counts are uneven: ones are the most common at 6,742, and fives the least at 5,421. A text cell in the notebook records where the data came from.

        Proving it reruns

        "Restart and run all" catches hidden state. The stronger test is a clean clone followed by uv sync. A fixed random seed makes a single run repeatable. It does not guarantee the same results across library versions or hardware, and it does not show whether a result is typical. The milestone is a written learning-problem statement for MNIST. Its baseline always predicts "1" and scores about 11% on the test set. A useful result must clearly beat that baseline on the held-out test images, and training accuracy does not count. A repository that describes a clean clone is not proof that one happened, so the exercise is to actually do it and compare the outputs line by line.

        uv 0.12 changes the project uv init creates

        Since 0.12.0, uv init sets up a packaged project with a src layout by default. Adding --no-package skips that structure. The release also refuses MD5 digests and strictly enforces required hashes. Later patch releases added a check command and support for downloading Python 3.15 release candidates. Python 3.15 is still a release candidate, and the stable line is 3.14 (see Python's release versions).

        24 min
      • 3. What Signal the Machine Actually Gets

        The four learning settings sorted by what feedback a system gets and tied to real tools, worked through MNIST, tic-tac-toe, next-word prediction and the chat-model training recipe, closing with the GLM-5.3 release read through its reward.

        This episode is narrated by AI-generated synthetic voices.

        Episode page & show notes

        Visit website

        Four settings, one question

        Supervised, unsupervised, reinforcement and self-supervised learning are four answers to what a system gets told, and when. Each is tied to tools already named: gradient-boosted trees and fine-tuned image networks are supervised, k-means is unsupervised, game-playing agents and the last stage of chat-model training use reinforcement, and language models are pretrained self-supervised.

        Answers, structure, rewards, hidden targets

        MNIST shows supervised learning and its labelling cost, with labels that can also come free from records such as billing histories. Stripping the labels leaves clustering, compression and anomaly detection (KMeans, PCA, IsolationForest), judged by usefulness because there is no answer key. Tic-tac-toe, as Sutton and Barto set it up in Reinforcement Learning: An Introduction, shows a single end-of-game reward, credit assignment, temporal-difference learning and exploration. Next-word prediction turns every page of text into hundreds of free examples.

        How a chat model uses three of them

        The InstructGPT recipe stacks self-supervised pretraining, supervised fine-tuning on written answers, and reinforcement learning from ranked answers, and BERT shows the masked-word target. Three cases (loan records, uncategorised transcripts, a home-screen recommender) show that the setting is chosen by the feedback that exists, not by which word sounds more advanced.

        GLM-5.3, read through its reward

        Z.ai's GLM-5.3 release keeps GLM-5.2's 743-billion-parameter base and scales reinforcement learning in verified multi-step environments. Reported jumps on Terminal-Bench 3.0 and DeepSWE are evidence about those benchmarks only, and the open weights were held back about two weeks after cyber capability scaled faster than expected.

        25 min