What is classification in machine learning?
Classification in machine learning is a supervised learning task in which a model predicts which category (class) an observation belongs to.
Unlike regression, which predicts numerical quantities, classification predicts discrete labels such as spam or not spam.
Examples
- Email filtering:
SpamorNot Spam. - Loan risk:
DefaultorNo Default. - Document sorting:
Finance,Sports, orTechnology.
How does classification work?
- Training: The model learns patterns from examples containing input features and their known class labels.
- Prediction: For a new observation, it uses those patterns to predict a class. Many classifiers can also output a probability or score for each class.
Example: A spam classifier learns from previously labeled emails. For a new email, it may estimate a 90% probability of spam and classify it as Spam using a chosen decision threshold.
Main forms of classification
- Binary classification: choose between two classes, such as
YesandNo. - Multiclass classification: choose one class from three or more possibilities.
- Multilabel classification: assign multiple applicable labels to the same observation.
Classification vs regression
- Classification: predicts a category, even if that category is encoded as a number like
0or1. - Regression: predicts a numerical quantity, such as price, temperature, or revenue.
How is a classifier evaluated?
Common metrics include accuracy, precision, recall, and F1-score. The appropriate metric depends on which classification mistakes matter most.
In short, classification teaches a model to assign observations to predefined categories using patterns learned from labeled training data.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.