The Difference Between a Linear Classifier and Linearly Separable Data

You’d think that machine learning, a field of study that is deeply technical, would have consistent vocabulary. That is not the case.

There are two different meanings to the term “linear classifier”. The idea is best explained by looking at logistic regression. Suppose you are predicting whether a person is male (0) or female (1) based on their age and income. You get some training data and determine that the prediction model is z = (0.3 * age) + (0.2 * income) + 0.15 and then p = 1.0 / (1.0 + exp(-z)).

The value of p will always be between 0.0 and 1.0 and if it’s less than 0.5 then the prediction is class 0 (male) and if p is greater than 0.5 the prediction is class 1 (female).

Some people call logistic regression a linear classifier because the z part of the model is linear — no squares or cubes or interactions like (age * income). However, when you apply the 1.0 / (1.0 + exp(-z)) the result is not a straight line, it’s an “S” shape. So some people say that logistic regression is not a linear classifier.

This is very annoying.

Now there’s a closely related term “linearly separable data”. This means that, for example, if you looked at a graph of the male/female data, you could find a straight line that separates the data into males vs. females.

Somewhat weirdly, if you apply logistic regression to data that is linearly separable, the system may blow up because of the underlying mathematics.

The moral of the story is that in machine learning vocabulary can be ambiguous and it’s important to clarify exactly what all terminology means.

Note: See related post https://jamesmccaffreyblog.com/2019/04/27/the-difference-between-linearly-separable-data-and-a-linear-classifier-in-machine-learning/



Jaguar S-Type (2008). Alfa Romeo SS (1939). Camaro SS (1967). Tesla Model S (2015). I think that the styling of older cars is much more distinctive and often more beautiful than the styling of modern cars.

This entry was posted in Machine Learning. Bookmark the permalink.