Monthly Archives: February 2019

Sorting a NumPy Array of Arrays

I was working on a Python program recently and I needed to sort a NumPy array-of-arrays based on one of the columns. For example, if the data is: [[10. 13. 15.] [19. 11. 14.] [15. 17. 12.] [14. 12. 18.]] … Continue reading

Posted in Miscellaneous | Comments Off on Sorting a NumPy Array of Arrays

I Give a Talk About Anomaly Detection Using Neural Clustering with PyTorch

About once a week, I give a short (typically 45 minutes long) talk at the large tech company I work for. I recently gave a talk about . . well, it’s not so easy to explain. Let me try. Anomaly … Continue reading

Posted in PyTorch | Comments Off on I Give a Talk About Anomaly Detection Using Neural Clustering with PyTorch

Generating Normal / Gaussian Distributed Random Values Using JavaScript

I’ve been working with JavaScript recently. Just for fun, I thought I’d tackle the problem of generating Gaussian distributed (aka Normal, aka bell-shaped) pseudo-random values, using raw JavaScript. There are several algorithms to do this but I prefer a simplified … Continue reading

Posted in JavaScript, Miscellaneous | Comments Off on Generating Normal / Gaussian Distributed Random Values Using JavaScript

Rank Order Accuracy using Discounted Cumulative Gain

Suppose you have some system that predicts the ordering (ranking) of items and you want to compute a measure of prediction accuracy. It’s a bit of a tricky problem. One approach is to use what’s called Discounted Cumulative Gain (DCG). … Continue reading

Posted in Miscellaneous | 3 Comments

My Top Ten Favorite Yeti Movies

I live in the Pacific Northwest. We’ve had quite a bit of snow this winter but luckily no yetis. I’d always assumed that there are dozens of movies about yeti aka the abominable snowman. Well, there are lots of movies … Continue reading

Posted in Top Ten | 4 Comments

Unraveling the Mysteries of a PyTorch LSTM Module

Update: See https://jamesmccaffreyblog.com/2019/06/28/the-pytorch-lstm-module-input-shape-tricked-me-again/ Because PyTorch is so new, there aren’t many code examples to be found on the Internet, and the documentation is frequently out-of-sync with the latest code. I’ve worked with very new, rapidly changing code libraries before and … Continue reading

Posted in Machine Learning, PyTorch | 1 Comment

Neural Network Activation Functions with JavaScript

I’ve been exploring the idea of implementing neural networks using raw JavaScript. None of the individual parts of a neural network (weights and biases, initialization, input-output, etc.) are hugely complicated by themselves, but there are a lot of parts. One … Continue reading

Posted in JavaScript, Machine Learning | Comments Off on Neural Network Activation Functions with JavaScript

Recap of the 2019 TDWI Conference

I spoke at the 2019 TDWI Conference. The event ran from February 10-15 and was in Las Vegas. I estimate there were about 500 people at the conference. Like most technical conferences, there were standard speaking sessions, workshops and training … Continue reading

Posted in Conferences | Comments Off on Recap of the 2019 TDWI Conference

Quick and Easy Naive Bayes Classification

Somewhat unusually, I can get a lot of technical work done while I travel. When I’m sitting in a terminal or sitting on a plane, there are no distractions and I do what I call mental coding. On a recent … Continue reading

Posted in Machine Learning | Comments Off on Quick and Easy Naive Bayes Classification

Reading a Text File of Numbers into a JavaScript Matrix Using Node.js

I’ve been looking at the idea of creating a neural network using plain JavaScript running in the Node.js system. A basic utility task is to read a text file of training data into memory as a numeric matrix. For my … Continue reading

Posted in JavaScript, Machine Learning | Comments Off on Reading a Text File of Numbers into a JavaScript Matrix Using Node.js