Classification takes many forms in our day to day activities. It can take a simple form in spam filters, trends to a complex form like image search.
What is Classification?
Classification is a type of Supervised Machine Learning that is used to predict categories of data points.
Classification works by looking at the characteristics or features of data points and putting them into categories based on the similarities depending on the model chosen.
There are different algorithms used in classification:
- Logistic regression
- K-Nearest Neighbors
- Random forest
- Decision trees etc
A good example of classification in action is your email service provider predicting whether an email is spam or not spam.
How is Gmail/Outlook able to achieve that? Is there a trade off that occurs behind the scenes that guides decision making?
Metrics of Evaluation🧮
These are the decision making guidelines that determine how well our model is doing.
Scenario:
Predicting spam and legitimate emails. Our model has 200 data points of which 180 are legitimate and 20 are spam. Our model predicts that 150 are legitimate and 50 are spam. There are 4 possible outcomes from the prediction:
Predicted Positive | Predicted Negative | |
---|---|---|
Positive | True Positive | False Negative |
Negative | False positives | True Negative |
a. Accuracy
Accuracy tells us how many correct predictions our model has captured, whether positive or negative, out of all predictions. It is important because it explains how right our model is in classifying the categories.
b. Precision
Precision tells us more about the positive predictions. How many positives have been correctly predicted out of all our positives? For instance, our model predicted 50 positives but could have included some values as spam that were not.
c. Recall
Recall shows us how many of the true positives were predicted by our model. The model can predict positives but how many of the true positives was it able to capture?
d. F1 Score
The balance between recall and precision.
Okay, but why does any of this matter?📍
Classification is used in many fields and thus the models need to suit the different scenarios as best as possible. The metrics are important because they guide us on the decisions we make based on what our models predict.
The trade off occurs where the model predicts more positives and in the process, it captures false positives which are treated as points of interest. On the other hand, the model may predict less positives but risks not capturing some of the actual positives.
The implications of favoring one metric can be missing out on important data points or capturing a lot more that may not necessarily be accurate. Thus the need to balance the metrics.
Classification is thought provoking because the process of model design and decision making goes beyond just the code. It is a deeper process that needs you to factor in what level of correctness you desire and understand what that means to the problem that is at hand.