## PyTorch One Hot Encoding

2021-02-02PyTorch has a one_hot() function for converting class indices to one-hot encoded targets.

Skip to content# Recipe

## PyTorch One Hot Encoding

2021-02-02## Numpy Pad: Understanding np.pad()

2021-01-30## The PyTorch Softmax Function

2021-01-29## Iterating Over Rows in Pandas

2021-01-29## Installing Packages in a Jupyter Notebook

2021-01-22## The Quick Start Guide to Plotting Histograms in Seaborn

2021-01-21## Normalizing Images in PyTorch

2021-01-15## Dropping Columns and Rows in Pandas

2021-01-14## The Easiest Way to Rename a Column in Pandas

2021-01-12## Reshaping Arrays: How the NumPy Reshape Operation Works

2021-01-11

PyTorch has a one_hot() function for converting class indices to one-hot encoded targets.

The np.pad() function has a complex, powerful API. But basic usage is very simple and complex usage is achievable! This post shows you how to use NumPy pad and gives a couple examples.

You can use the top-level torch.softmax() function from PyTorch for your softmax activation needs.

When you absolutely have to iterate over rows in a Pandas DataFrame, use the .itertuples() method.

This post describes a trick for installing/upgrading Python packages in a Jupyter notebook. It’s useful for scratch code, but don’t do this when you need reproducible code.

The histplot() function in Seaborn is a great API for plotting histograms to visualize the distribution of your Pandas columns.

You can use the torchvision Normalize() transform to subtract the mean and divide by the standard deviation for image tensors in PyTorch. But it’s important to understand how the transform works and how to reverse it.

There are a few ways to drop columns and rows in Pandas. This post describes the easiest way to do it and provides a few alternatives that can sometimes be useful.

Two easy recipes for renaming column(s) in a Pandas DataFrame.

This post explains how the NumPy reshape operation works, how to use it and gotchas to watch out for.