Author Archives: jamesdmccaffrey

NFL 2021 Week 20 (Division Championships) Predictions – Zoltar Likes the Vegas Favorite Chiefs to Cover

Zoltar is my NFL football prediction computer program. It uses custom reinforcement learning and a neural network. Here are Zoltar’s predictions for week #20 (division championships) of the 2021 season. It usually takes Zoltar about four weeks to hit his … Continue reading

Posted in Zoltar | Leave a comment

The Flax Neural Network Library

I came across two interesting, related, Python libraries recently: JAX and Flax. JAX (“just after execution”) is sort of an enhanced NumPy (numerical Python) library. JAX adds support for numeric arrays on GPU and TPU hardware, and automatic gradient calculation. … Continue reading

Posted in Machine Learning | Leave a comment

IMDB Movie Review Sentiment Analysis Using an LSTM with PyTorch

When I was first learning PyTorch, I implemented a demo of the IMDB movie review sentiment analysis problem using an LSTM. I recently revisited that code to incorporate all the things I learned about PyTorch since that early example. My … Continue reading

Posted in PyTorch | Leave a comment

Matrix Inverse From Scratch Using Python

Computing the inverse of a matrix is a fundamental algorithm for machine learning and numerical programming. On a recent flight to a conference, just for hoots (and for programming exercise) I decided to implement a matrix inverse function from scratch … Continue reading

Posted in Machine Learning | Leave a comment

JavaScript and the Sapir-Whorf Hypothesis

The Sapir-Whorf hypothesis loosely states that the structure of a spoken language affects its the way its speakers see and understand the world. This makes intuitive sense — a tribesman from a primitive country there the language doesn’t have words … Continue reading

Posted in JavaScript, Machine Learning | Leave a comment

NFL 2021 Week 19 (Wild Card) Predictions – Zoltar Likes Vegas Underdogs Raiders and Steelers

Zoltar is my NFL football prediction computer program. It uses custom reinforcement learning and a neural network. Here are Zoltar’s predictions for week #19 (wild card round) of the 2021 season. It usually takes Zoltar about four weeks to hit … Continue reading

Posted in Zoltar | Leave a comment

The Kendall Tau Distance For Permutations Example C# Code

Suppose you have a permutation p1 = (0, 2, 4, 1, 3) and a second permutation p2 = (4, 0, 3, 2, 1) and you want to know the distance/difference between them. The Kendall Tau distance between two permutations is … Continue reading

Posted in Miscellaneous | Leave a comment

Assigning Fixed Weight and Bias Values to a PyTorch Neural Network

Sometimes it’s useful to assign fixed weight and bias values to a neural network. To do so requires a knowledge of how those values are stored. I wrote a short demo program to illustrate the technique. The demo creates a … Continue reading

Posted in PyTorch | Leave a comment

Chi-Square From Scratch Using Python

One night I just couldn’t fall asleep so to kill time productively I decided to implement chi-square from scratch using Python. The term “chi-square” has multiple related meanings. There is a chi-square test that compares a set of observed counts … Continue reading

Posted in Miscellaneous | Leave a comment

PyTorch Explicit vs. Implicit Weight and Bias Initialization

Sometimes library code is too helpful. In particular, I don’t like library code that uses default mechanisms. One example is PyTorch library weight and bias initialization. Consider this PyTorch neural network definition: import torch as T device = T.device(“cpu”) class … Continue reading

Posted in PyTorch | 3 Comments