Category Archives: PyTorch

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

Visualizing the MNIST Dataset Using PyTorch Autoencoder Dimensionality Reduction

Writing machine learning code is like many things: it’s a skill that must be practiced. This morning I decided to refactor an old program that I wrote about a year ago, from Keras to PyTorch. The goal is to display … Continue reading

Posted in PyTorch | Leave a comment

Neural Regression Using PyTorch: Model Accuracy

I wrote an article titled “Neural Regression Using PyTorch: Model Accuracy” in the March 2021 edition of the online Microsoft Visual studio Magazine. See https://visualstudiomagazine.com/articles/2021/03/12/pytorch-model-accuracy.aspx. The goal of a regression problem is to predict a single numeric value. The example … Continue reading

Posted in PyTorch | 1 Comment

Creating a Streaming Data Loader for the MNIST Dataset

The MNIST image dataset is one of the most commonly used datasets in machine learning. But MNIST is rather difficult to work with because a.) there are 60,000 training images and so the data won’t fit into memory on a … Continue reading

Posted in PyTorch | Leave a comment

Variational Autoencoder Reconstruction Probability Anomaly Detection for the MNIST Dataset

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 MNIST image dataset. Good news and bad news: … Continue reading

Posted in Machine Learning, PyTorch | Leave a comment