Classification
التصنيف
Definition
A supervised learning task in which the model predicts a discrete class (label) for each input, such as “spam” or “not spam”.
Definition
Classification is a supervised learning task in which a model learns to assign each input to one of a set of discrete categories, based on labelled training examples.
Practical examples
from sklearn.metrics import precision_score, recall_score, f1_score
y_true = [1, 1, 1, 0, 0, 1, 0, 1]
y_pred = [1, 0, 1, 0, 1, 1, 0, 0]
print(precision_score(y_true, y_pred), recall_score(y_true, y_pred), round(f1_score(y_true, y_pred), 3))Expected output
0.75 0.6 0.667
Mathematical equations
F_1 = 2\cdot\frac{\text{Precision}\cdot\text{Recall}}{\text{Precision}+\text{Recall}}, \quad \text{Precision}=\frac{TP}{TP+FP}, \quad \text{Recall}=\frac{TP}{TP+FN}Scientific sources
References and scientific sources
-
BookThe Elements of Statistical Learning (2nd ed.) A statistical reference on machine learning, freely available from the authors' website.
-
BookPattern Recognition and Machine Learning A classic reference on probabilistic machine learning.
