Category Archives: PyTorch

Training a Generative Adversarial Network (GAN)

A generative adversarial network (GAN) is a complex deep neural system that can be used to generate fake data based on a set of real data. This can be useful in several scenarios, including generating additional training data for a … Continue reading

Posted in PyTorch | Leave a comment

Autoencoder Anomaly Detection Using PyTorch

I wrote an article titled “Autoencoder Anomaly Detection Using PyTorch” in the April 2021 edition of the online Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2021/04/13/autoencoder-anomaly-detection.aspx. Anomaly detection is the process of finding items in a dataset that are different in some … Continue reading

Posted in PyTorch | Leave a comment

Variational Autoencoder Reconstruction Probability Anomaly Detection for the UCI Digits Dataset

For the past several weeks, I’ve been looking at a deep neural technique for anomaly detection based on an idea called variational autoencoder (VAE) reconstruction probability. My most recent experiment was to apply the technique to the UCI Digits image … Continue reading

Posted in Machine Learning, PyTorch | Leave a comment

Computing Precision and Recall from Scratch for PyTorch Binary Classifiers

I was talking to some relatively young colleagues who had recently joined my company. We were looking at the results of a binary classifier. My colleagues used library code to compute precision and recall metrics, but they didn’t really understand … Continue reading

Posted in Machine Learning, PyTorch | Leave a comment

Explaining the PyTorch EmbeddingBag Layer

I came across a PyTorch documentation example that used an EmbeddingBag layer. I dissected the example to figure out exactly what an EmbeddingBag layer is and how it works. The bottom line is that an EmbeddingBag layer is useful for … Continue reading

Posted in PyTorch | Leave a comment

Logistic Regression Using PyTorch

The PyTorch code library is intended for creating neural networks but you can use it to create logistic regression models too. One approach, in a nutshell, is to create a NN with one fully connected layer that has a single … Continue reading

Posted in PyTorch | Leave a comment

How To: Create a Streaming Data Loader for PyTorch

I wrote an article titled “How To: Create a Streaming Data Loader for PyTorch” in the April edition of the online Microsoft Visual Studio Magaqzine. See https://visualstudiomagazine.com/articles/2021/04/01/pytorch-streaming.aspx. When using the PyTorch neural network library to create a machine learning prediction … Continue reading

Posted in PyTorch | Leave a comment

I Refactor the New TorchText Documentation AG News Demo

Version 0.9 of the PyTorch TorchText library was released a few days ago. The new version has many significant changes from versions 0.8 and earlier. It will take me many hours, spread out over several months, to master the new … Continue reading

Posted in PyTorch | 1 Comment

Using a Variational Autoencoder for Dimensionality Reduction to Make a Visualization

One morning, I had just written a PyTorch program that used a neural autoencoder to reduce MNIST 28 by 28 digits from 784 dimensions down to 2 dimensions, so that each image could be plotted on an xy graph. It … Continue reading

Posted in PyTorch | Leave a comment

I Like the New TorchText v0.9 Dataset Interface

Version 0.9 of the PyTorch TorchText library was released a few days ago. The TorchText library has several built-in datasets for use with text and natural language processing experiments. The v0.9 interface is completely different from v0.8 and earlier. The … Continue reading

Posted in PyTorch | Leave a comment