Author Archives: jamesdmccaffrey

PyTorch Multi-Class Accuracy By Class Using a Set-Wise Approach

I recently revisited multi-class classification using PyTorch. My demo was to predict a person’s political type (conservative, moderate, liberal) based on sex, age, state (michigan, nebraska, oklahoma), and annual income. See jamesmccaffrey.wordpress.com/2022/09/01/multi-class-classification-using-pytorch-1-12-1-on-windows-10-11/. My demo computed overall model accuracy. I decided … Continue reading

Posted in PyTorch | Leave a comment

Binary Classification Using PyTorch 1.12.1 on Windows 10/11

There are frequent updates to the PyTorch neural network library, and I’m continuously learning new techniques and best practices. I figured it was time to update one of my standard binary classification demos for the current PyTorch version 1.12.1. I … Continue reading

Posted in PyTorch | Leave a comment

“Researchers Make Computer Chess Programs More Human” on the Pure AI Web Site

I contributed to an article titled “Researchers Make Computer Chess Programs More Human” on the September 2022 edition of the Pure AI web site. See https://pureai.com/articles/2022/09/06/more-human-chess-programs.aspx. In some machine learning scenarios, it’s useful to make a prediction system that is … Continue reading

Posted in Machine Learning | Leave a comment

NFL 2022 Week 3 Predictions – Zoltar Likes Six Vegas Underdogs

Zoltar is my NFL football prediction computer program. It uses reinforcement learning and a neural network. Here are Zoltar’s predictions for week #3 of the 2022 season. These predictions are fuzzy, in the sense that it usually takes Zoltar about … Continue reading

Posted in Zoltar | Leave a comment

A Quick Look at the .NET MAUI (Multi-Platform User Interface) Library

I was updating my Microsoft Visual Studio program and decided to take a look at using the .NET MAUI template. Suppose you want to create an application that runs on a Windows desktop machine, and a Mac machine and an … Continue reading

Posted in Miscellaneous | Leave a comment

PyTorch Not-Fully-Connected Layer Using prune.custom_from_mask()

I ran across an interesting PyTorch function that I hadn’t seen before. The torch.nn.utils.prune.custom_from_mask() function can mask out weights and biases in a neural layer. This allows you to create layers that are not fully connected. I checked the PyTorch … Continue reading

Posted in PyTorch | Leave a comment

Why PyTorch Layer Weight Matrix Shape Seems Backward

A PyTorch weight matrix has shape [num_out, num_in] rather than the more logical [num_in, num_out]. This seems a bit strange. Furthermore, when computing a set of output nodes, the weight matrix must be transposed before applying matrix multiplication. This seems … Continue reading

Posted in PyTorch | Leave a comment

“Multi-Class Classification Using PyTorch, Part 1: New Best Practices” in Visual Studio Magazine

I wrote an article titled “Multi-Class Classification Using PyTorch, Part 1: New Best Practices” in the September 2022 edition of Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2022/09/06/multi-class-pytorch.aspx. A multi-class classification problem is one where the goal is to predict a discrete … Continue reading

Posted in PyTorch | Leave a comment

NFL 2022 Week 2 Predictions – Zoltar Likes Four Vegas Underdogs

Zoltar is my NFL football prediction computer program. It uses reinforcement learning and a neural network. Here are Zoltar’s predictions for week #2 of the 2022 season. These predictions are fuzzy, in the sense that it usually takes Zoltar about … Continue reading

Posted in Zoltar | Leave a comment

Using the Simplest Possible Transformer Sequence-to-Sequence Example

I’ve been exploring PyTorch Transformer Architecture models sequence-to-sequence problems for several months. TA architecture systems are among the most complicated software things I’ve ever worked with. I recently completed a demo implementation of my idea of the simplest possible sequence-to-sequence. … Continue reading

Posted in PyTorch, Transformers | Leave a comment