Author Archives: jamesdmccaffrey

The Wheat Seed Problem Using Radius Neighbors Classification with the scikit Library

I was looking at k-NN classification using the scikit library recently. While wading through the scikit documentation, I noticed that scikit has a closely related Radius Neighbors classifier module. When I did my k-NN example, I used the Wheat Seeds … Continue reading

Posted in Scikit | Leave a comment

Example of Kernel Ridge Regression Using the scikit Library

A regression problem is one where the goal is to predict a single numeric value. For example, you might want to predict the income of a person based on their sex, age, State, and political leaning. (Note: Somewhat confusingly, “logistic … Continue reading

Posted in Scikit | Leave a comment

Revisiting My Neural Network Regression System with Raw JavaScript

A couple of years ago I implemented a neural network regression system (predict a single numeric value) in raw JavaScript. I enjoy coding, even in raw JavaScript, so one Saturday evening I figured I’d revise my old example. I didn’t … Continue reading

Posted in JavaScript | Leave a comment

Computing and Displaying a Confusion Matrix for a PyTorch Neural Network Multi-Class Classifier

After training a PyTorch multi-class classifier, it’s important to evaluate the accuracy of the trained model. Simple classification accuracy is OK but in many scenarios you want a so-called confusion matrix that gives details of the number of correct and … Continue reading

Posted in PyTorch | Leave a comment

The Wheat Seed Problem Using k-NN Classification With the scikit Library

One of my work laptops died so I tried to reimage it by reinstalling everything, including OS, from the ground up. While that was going on, I decided to entertain myself by doing a k-nearest neighbors (k-NN) classification example using … Continue reading

Posted in Scikit | Leave a comment

Regression (People Income) Using a scikit MLPRegressor Neural Network

The scikit-learn library was originally designed for classical machine learning techniques like logistic regression and naive Bayes classification. The library eventually added the ability to do binary and multi-class classification via the MLPClassifier (multi-layer perceptron) class and regression via the … Continue reading

Posted in Scikit | Leave a comment

The House Voting Dataset Problem Using PyTorch

A somewhat unusual machine learning problem scenario is one where the predictor variables are all Boolean. This is sometimes called Bernoulli classification. The most well-known example (to me anyway) of this type of problem is the House Voting dataset. I … Continue reading

Posted in PyTorch | Leave a comment

Revisiting My Binary Classification Neural Network with Raw JavaScript

Quite some time ago I implemented a neural network binary classifier in raw JavaScript. One Saturday morning, I was going to walk my two dogs but it was raining so I decided to revisit my code while I waited for … Continue reading

Posted in JavaScript | Leave a comment

Example of Multinomial Naive Bayes Classification Using the scikit Library

The scikit-learn code library has a MultinomialNB class that can be used to create prediction models for multinomial data. The most common form of multinomial data has predictor variables where the values are counts. For example, suppose you want to … Continue reading

Posted in Scikit | Leave a comment

“Binary Classification Using a scikit Decision Tree” in Visual Studio Magazine

I wrote an article titled “Binary Classification Using a scikit Decision Tree” in the February 2023 edition of Microsoft Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2023/02/21/scikit-decision-tree.aspx. A decision tree is a machine learning technique that can be used for binary classification or … Continue reading

Posted in Scikit | 1 Comment