Skip to main content

Logistic Regression

What is a logistic regression and how do you use it?

Yes or no. On or off. Cat or dog. These are all examples of binary classes, and by using a logistic regression we can predict a binary outcome given a set of features. At its most basic, logistic regression uses a threshold or decision boundary to learn how to map features to a class.

Let's look at a simplistic example. Say we have some data on characteristics of cats and dogs, [sense of smell, eyesight, sound]. We'd like to classify each data point as either a cat or dog by teaching the algorithm that dogs tend to bark and have excellent sense of smell while cats meow and have great eyesight.

For each data point, a logistic regression returns the probability of that point belonging to a given class, which we can then use to predict classification of new records added to the dataset!

However, the real fun begins when we can see how this works on actual data, so let's dive in!

Hex example project