How to Force pip to Reinstall a Package

Posted 2020-12-26 • Last updated 2021-10-15

Once in a while, a Python package gets corrupted on your machine and you need to force pip to reinstall it. As of pip 10.0, you can run the following…

The Keras Custom Layer Explained

Posted 2020-12-26 • Last updated 2021-03-24

Sometimes you need to define your own Keras custom layer. This tutorial explains how custom layers work for tensorflow>=1.7.0 (up to at least 2.4.0) which includes a fairly stable version of the Keras API.

How to Use the Pandas Melt Command

Posted 2020-12-22 • Last updated 2021-10-15

The Pandas melt command unpivots tabular data, transforming it from wide to long format. To understand this operation, you have to know…

Cross Entropy Loss in PyTorch

Posted 2020-07-24 • Last updated 2021-10-14

Cross entropy loss in PyTorch can be a little confusing. Here is a simple explanation of how it works for people who get stuck.

Pairwise Distance in NumPy

Posted 2020-06-01 • Last updated 2021-10-15

You can do vectorized pairwise distance calculations in NumPy (without using SciPy). This lets you extend pairwise computations to other kinds of functions.

Everything is a Pipeline

Posted 2020-05-21 • Last updated 2021-03-24

DAGs are everywhere in scientific computing and understanding them is key to running large computations efficiently.

Use Informative Names

Posted 2020-05-18 • Last updated 2021-03-24

Informative names make programming easier. Here are a few suggestions you can use to write better names in your code.



ben [at] sparrow [dot] dev

Email List