Poetry for Package Management in Machine Learning Projects

Ben Cook • Posted 2021-07-08 • Last updated 2021-10-20

When you’re building a production machine learning system, reproducibility is a proxy for the effectiveness of your development process. But without locking all your Python dependencies, your builds are not actually repeatable. If you work in a Python project without locking long enough, you will eventually get a broken build … Read more

Development containers in VS Code: a quick start guide

Ben Cook • Posted 2021-06-29 • Last updated 2022-09-07

If you’re building production ML systems, dev containers are the killer feature of VS Code. Dev containers give you full VS Code functionality inside a Docker container. This lets you unify your dev and production environments if production is a Docker container. But even if you’re not targeting a Docker … Read more

Basic Counting in Python

Ben Cook • Posted 2021-05-14 • Last updated 2021-10-15

I love fancy machine learning algorithms as much as anyone. But sometimes, you just need to count things. And Python’s built-in data structures make this really easy. Let’s say we have a list of strings: With a list like this, you might care about a few different counts. What’s the … Read more

How to Use the PyTorch Sigmoid Operation

Ben Cook • Posted 2021-05-13 • Last updated 2021-10-14
sigmoid function

The PyTorch sigmoid function is an element-wise operation that squishes any real number into a range between 0 and 1. This is a very common activation function to use as the last layer of binary classifiers (including logistic regression) because it lets you treat model predictions like probabilities that their … Read more

TorchVision Transforms: Image Preprocessing in PyTorch

Ben Cook • Posted 2021-03-19 • Last updated 2021-10-21

TorchVision, a PyTorch computer vision package, has a great API for image pre-processing in its torchvision.transforms module. This post gives some basic usage examples, describes the API and shows you how to create and use custom image transforms.

Binary Cross Entropy Explained

Ben Cook • Posted 2021-02-22 • Last updated 2021-10-21

A simple NumPy implementation of the binary cross entropy loss function and some intuition about why it works.