Classification

Classification is a supervised learning task where a model predicts which category an input belongs to, such as labeling an email 'spam' or 'not spam.'

Data & AI

The output is a discrete class rather than a number. Binary classification picks between two classes (yes/no), while multiclass classification chooses among several (cat, dog, bird). Many models output a probability for each class and pick the highest.

Classification powers spam filters, medical diagnosis, image labeling, and sentiment analysis. It's the counterpart to regression, which predicts numbers instead of categories.

Examples

Python

from sklearn.linear_model import LogisticRegression

clf = LogisticRegression().fit(X_train, y_train)
print(clf.predict([[5.1, 3.5, 1.4, 0.2]]))

Output:

['setosa']

Learn it in a lesson

See also

Back to the Dictionary