Machine learning in Python

I explore the vast landscape of machine learning in Python, covering everything from deep neural networks and natural language processing to reinforcement learning and production deployment.

Categories:AIPython

A topic page: a summary of what my posts say, with each claim quoted from the post it came from. The posts are the authority. Last checked 2026-11-06.

Summary. I explore the vast landscape of machine learning in Python, covering everything from deep neural networks and natural language processing to reinforcement learning and production deployment. I demonstrate how specific architectures, optimization techniques, and data pipelines allow models to solve complex problems like image recognition and sequence forecasting.

What the posts say

The SELU activation function allowed a 100-layer network to reach 82.0% accuracy.

β€œIn my run, a bend called SELU (scaled exponential linear unit), with matching starting numbers, took the 100-layer network from 69.9% with ReLU to 82.0%.” β€” Scikit-Learn (Part 11)

The Huber loss is less affected by a few very wrong answers than standard regression.

β€œThe Huber loss squares small errors but only counts large ones in proportion, so a few odd houses do not pull the whole model towards them.” β€” Scikit-Learn (Part 12)

The prefetch function allows the model to work on one batch while the next is prepared.

β€œA: It prepares the next batch while the model works on the current one.” β€” Scikit-Learn (Part 13)

The Xception model achieved 91.8% accuracy after a two-step transfer learning process.

β€œThen it unfreezes the network from layer 56 on, and continues for 10 epochs with a step size ten times smaller (0.01): that gave 91.8% by the end.” β€” Scikit-Learn (Part 14)

A simple forecast provides a necessary baseline to determine if a complex model is worth the effort.

β€œThe lesson: work out what a simple guess scores before building a model, because it is hard to beat by much, and it tells me whether a clever model is worth having.” β€” Scikit-Learn (Part 15)

The Transformer uses positional encodings to maintain word order since it lacks a recurrent memory.

β€œThe notebook adds a pattern of sine and cosine waves to each word, different for each position, so that word order is in the numbers.” β€” Scikit-Learn (Part 16)

Diffusion models are more stable than GANs because they learn a simple, fixed task.

β€œA diffusion model avoids that.” β€” Scikit-Learn (Part 17)

The replay buffer prevents the network from forgetting earlier lessons by providing a variety of past steps.

β€œThe DQN trains on random batches from it, instead of on the most recent steps, because steps in a row are too alike, and training on them makes the network forget what it learned earlier.” β€” Scikit-Learn (Part 18)

The TensorFlow Lite conversion reduced the model size by about 3.6 times.

β€œConverting for a phone with TensorFlow Lite made the same model about 3.6 times smaller, 171,748 bytes to 47,928.” β€” Scikit-Learn (Part 19)

A model must be judged on data it has not seen to avoid memorization.

β€œJudge a model on data it has not seen. A model can memorise what it learned from and look perfect.” β€” Scikit-Learn (Part 20)

The posts behind this page

  • Scikit-Learn (Part 11) β€” Training deep neural networks: why deep networks are hard to train, and the starting numbers, activation functions, batch normalization, optimizers, and dropout that make it work
  • Scikit-Learn (Part 12) β€” Custom models and training with TensorFlow: tensors, automatic slopes with GradientTape, and a training loop written by hand instead of calling fit()
  • Scikit-Learn (Part 13) β€” Loading and preprocessing data with TensorFlow: a tf.data pipeline that reads many files, shuffles, and batches, the TFRecord format, and Keras layers that turn raw values into numbers
  • Scikit-Learn (Part 14) β€” Deep computer vision with convolutional neural networks (CNNs): filters that slide across an image, pooling, a CNN for clothing, a pretrained ResNet, and transfer learning for flowers
  • Scikit-Learn (Part 15) β€” Processing sequences with recurrent neural networks (RNNs) and CNNs: forecasting daily train ridership, comparing a naive guess, a statistical model, and RNNs, and forecasting several days ahead
  • Scikit-Learn (Part 16) β€” Natural language processing with recurrent networks and attention: a Shakespeare character model, movie review sentiment, translation, the Transformer, and pretrained models from Hugging Face
  • Scikit-Learn (Part 17) β€” Autoencoders, GANs, and diffusion models: networks that squeeze data and rebuild it, and networks that invent new clothing pictures
  • Scikit-Learn (Part 18) β€” Reinforcement learning: an agent that learns to balance a pole by trial and error, with policy gradients and deep Q-networks
  • Scikit-Learn (Part 19) β€” Training and deploying models at scale: serving a TensorFlow model with Docker over REST and gRPC, updating it live, shrinking it for a phone, and spreading training over several devices
  • Scikit-Learn (Part 20) β€” Looking back over nineteen chapters of Hands-On Machine Learning: how models learn, which parts are still current, and what I would do differently