Linear Classifiers
Learn about the classification.
We'll cover the following...
What is classification?
Classification is a process of taking input, passing it through a classifier, and predicting a categorical output.
Some examples of classifications are:
-
Classifying blog articles into defined categories like politics, sports, celebrity, lifestyle, etc.
-
Classifying images into predefined categories like a cat, mouse, horse, human, etc.
-
Classifying customers into segments like high-buying, high-risk-taking, etc.
So, all the above examples are related to classification. In this technique, we always deal with a fixed number of categories, unlike regression where our output belongs to the continuous range.
Quiz: Determine the classification problem
Which is an example of classification?
Predicting the temperature from range 0 to 100.
Predicting the speed of the car.
Predicting T Shirt size (S, M, L, or XL) based on last purchase.
Predicting house prices in New York.
Linear classifier
Let’s look at an example of the classification problem with an example. We will use the famous problem of iris species prediction. Iris is an open dataset which contains fifty observations of three species each. Each observation has four data points: sepal length, sepal width, petal length, and petal width. We have to predict the species of iris using these properties. First, we take the data of two species: virginica and setosa.
sepal_length | sepal_width | petal_length | petal_width | species |
---|---|---|---|---|
6.7 | 3.3 | 5.7 | 2.1 | virginica |
6.4 | 3.1 | 5.5 | 1.8 | virginica |
4.9 | 3.1 | 1.5 | 0.1 | setosa |
5.5 | 3.5 | 1.3 | 0.2 | setosa |
Linear classifiers put a weight on each feature to help predict the species.
Feature | Weight |
---|---|
sepal_length | 1.2 |
sepal_width | -2.9 |
petal_length | 1.6 |
petal_width | -0.8 |
Linear classifiers take the weight and multiply this with feature values. Depending on the score we decide between two categories.
...