Using linear methods for classification – logistic regression
Linear models can actually be used for classification tasks. This involves fitting a linear model to the probability of a certain class, and then using a function to create a threshold at which we specify the outcome of one of the classes.
The function used here is typically the logistic function (surprise!). It's a pretty simple function:
Visually, it looks like the following:
Let's use the
make_classification method, create a dataset, and get to classifying:
>>> from sklearn.datasets ...