Category Archives: PyTorch

Serving Up PyTorch Training Data Using The DataLoader collate_fn Parameter

When creating a deep neural network, writing code to prepare the training data and serve it up in batches to the network is almost always difficult and time consuming. A regular PyTorch DataLoader works great for tabular style data where … Continue reading

Posted in PyTorch | Leave a comment

Generating Synthetic Data Using a Generative Adversarial Network (GAN) with PyTorch in Visual Studio Magazine

I wrote an article titled “Generating Synthetic Data Using a Generative Adversarial Network (GAN) with PyTorch” in the June 2021 edition of Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2021/06/02/gan-pytorch.aspx. A generative adversarial network (GAN) is a deep neural system that can … Continue reading

Posted in PyTorch | Leave a comment

Combining Logistic Regression Models by Averaging Their Weights

Suppose you want to make a logistic regression binary classification model, for example to predict if a hospital patient is male or female based on variables such as age and hospitalization history. And suppose your training data file is very … Continue reading

Posted in PyTorch | Leave a comment

Creating a PyTorch Vocabulary Object for Natural Language Processing Problems

Even the simplest natural language processing problem is extremely difficult. With a basic neural network classifier, you usually have to normalize numeric data (such as dividing a person’s age by 100) and encode non-numeric data (e.g., “red” = 1,0,0) but … Continue reading

Posted in PyTorch | Leave a comment

Knowing When To Stop Training a Generative Adversarial Network (GAN)

A generative adversarial network (GAN) is a deep neural system that is designed to generate fake/synthetic data items. A GAN has a clever architecture made of two neural networks: a generator that creates fake data items, and a discriminator that … Continue reading

Posted in PyTorch | Leave a comment

Positive and Unlabeled Learning (PUL) Using PyTorch

I wrote an article titled “Positive and Unlabeled Learning (PUL) Using PyTorch” in the May 2021 edition of the online Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2021/05/20/pul-pytorch.aspx. A positive and unlabeled learning (PUL) problem occurs when a machine learning set of … Continue reading

Posted in Machine Learning, PyTorch | Leave a comment

Simple Ordinal Classification Using PyTorch

I was chatting with some of my colleagues at work about the topic of ordinal classification, also known as ordinal regression. An ordinal classification problem is a multi-class classification problem where the class labels to predict are ordered, for example, … Continue reading

Posted in PyTorch | Leave a comment

Logistic Regression Using PyTorch With L-BFGS Optimization

The PyTorch code library was designed to enable the creation of deep neural networks. But you can use PyTorch to create simple logistic regression models too. Logisitic regression models predict one of two possible discrete values, such as the sex … Continue reading

Posted in PyTorch | Leave a comment

Combining Two Different Logistic Regression Models by Averaging Their Weights

I was in a meeting recently and one of my colleagues briefly described some work he had done at a previous job. He had an enormous set of training data and wanted to train a logistic regression model. Logistic regression … Continue reading

Posted in PyTorch | Leave a comment

Generating Synthetic Data Using a Variational Autoencoder with PyTorch

I wrote an article titled “Generating Synthetic Data Using a Variational Autoencoder with PyTorch” in the May 2021 edition of Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2021/05/06/variational-autoencoder.aspx. A variational autoencoder (VAE) is a deep neural system that can be used to … Continue reading

Posted in PyTorch | Leave a comment