Combinations in Python

2020-12-28

There are lots of ways to generate combinations in Python. This post will show you all of them.

How to Force pip to Reinstall a Package

2020-12-26

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

2020-12-26

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

2020-12-22

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 • Updated 2021-01-28

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

2020-06-01

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