What is binary classification?
Binary classification is a supervised machine learning task in which a model predicts one of two possible classes for an observation.
Typical class pairs include:
- Spam or Not Spam for an email.
- Fraud or Legitimate for a transaction.
- Churn or No Churn for a customer.
How does it work?
The model learns patterns from training examples that each have a known label, commonly encoded as 0 or 1.
For a new observation, it predicts a class. Many binary classifiers also produce a score or estimated probability for the positive class.
Example: fraud detection
Suppose a classifier estimates that a transaction has a 0.82 probability of being fraudulent.
With a decision threshold of 0.50:
- Probability at or above
0.50→ Fraud. - Probability below
0.50→ Legitimate.
The threshold is a decision rule, not a fixed requirement. A lower threshold may catch more fraud but flag more legitimate transactions.
What are positive and negative classes?
- Positive class: the event you are trying to detect, such as
Fraud. - Negative class: the alternative, such as
Legitimate.
These labels are conventions; positive does not mean desirable.
How is binary classification evaluated?
Important outcomes include:
- True positive: fraud correctly flagged.
- False positive: legitimate transaction incorrectly flagged.
- False negative: fraud incorrectly missed.
- True negative: legitimate transaction correctly accepted.
Accuracy alone can be misleading when one class is rare. Metrics such as precision, recall, F1-score, and ROC-AUC provide additional views of performance.
In short, binary classification assigns an observation to one of two classes. Choosing the prediction threshold and evaluation metrics depends on the cost of each type of mistake.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.