VOOZH about

URL: https://www.geeksforgeeks.org/machine-learning/false-positives-and-false-negatives/

⇱ False Positives and False Negatives - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

False Positives and False Negatives

Last Updated : 23 Jul, 2025

In machine learning and statistics, model evaluation plays a crucial role in determining the effectiveness of predictions. Two important types of errors are:

  • False Positive (FP): Incorrectly classifying a negative sample as positive.
  • False Negative (FN): Incorrectly classifying a positive sample as negative.
👁 false_positive
False Positive/Negative

Both types of errors significantly impact model performance, especially in applications such as fraud detection, medical diagnosis and spam filtering.

False Positive (Type I Error)

A false positive occurs when the model incorrectly predicts a positive outcome for a sample that is actually negative.

Example of False Positive

  • Test Type: Spam email detection
  • True Condition: An email is not spam.
  • Prediction: The email is marked as spam.
  • Result: False positive.

False positives can result in Type I errors, meaning the null hypothesis is incorrectly rejected. In situations where false positives are frequent, the model may become overly sensitive, incorrectly identifying normal situations as problematic.

False Negative (Type II Error)

A false negative occurs when the model incorrectly predicts a negative outcome for a sample that is actually positive.

Example of False Negative

  • Test Type: Disease detection
  • True Condition: A person has the disease.
  • Prediction: The test indicates no disease.
  • Result: False negative.

False negatives are associated with Type II errors, meaning the null hypothesis is incorrectly accepted. High rates of false negatives often indicate that the model may be too conservative, failing to identify cases where action is needed.

Confusion Matrix

A confusion matrix is a tool used to visualize the performance of a classification model. It contains the following values:


Actual Positive

Actual Negative

Predicted Positive

True Positive (TP)

False Positive (FP)

Predicted Negative

False Negative (FN)

True Negative (TN)

Mathematical Formulation

The key metrics to evaluate the effect of false positives and false negatives are:

Precision

Precision measures how many of the predicted positive samples are truly positive.

  • Higher false positives reduce precision.
  • Precision is important in applications where false positives are costly, e.g., spam filtering.

Recall (Sensitivity)

Recall measures how many of the actual positive samples are correctly classified.

  • Higher false negatives reduce recall.
  • Recall is important in applications like medical diagnosis, where missing positive cases is dangerous.

F1-Score

The F1-score balances precision and recall.

  • F1-score is ideal for evaluating models in imbalanced datasets.

Impact in Machine Learning

Consequences of False Positives

False positives can lead to unnecessary actions or misjudgments.

  1. Healthcare: Incorrectly diagnosing healthy patients as ill, leading to unnecessary treatments.
  2. Email filtering: Flagging legitimate emails as spam, potentially missing important messages.
  3. Fraud detection: Flagging non-fraudulent transactions as fraudulent, causing inconvenience to customers.

Consequences of False Negatives

False negatives can be more dangerous in some cases, as they involve missing actual positive cases.

  1. Healthcare: Failing to detect a disease, leading to lack of treatment.
  2. Security: Failing to identify malicious activity, allowing security breaches.
  3. Fraud detection: Missing fraudulent transactions, leading to financial losses.

Real-World Examples

1. Spam Detection:

  • FP: Flagging legitimate emails as spam.
  • FN: Missing actual spam emails.

2. Medical Diagnosis:

  • FP: Incorrectly diagnosing a patient as ill.
  • FN: Failing to detect a disease.

3. Credit Card Fraud Detection:

  • FP: Flagging a legitimate transaction as fraudulent.
  • FN: Missing a fraudulent transaction.

Strategies to Minimize False Positives and False Negatives

1. Threshold Adjustment:

  1. Increasing the threshold reduces false positives but may increase false negatives.
  2. Lowering the threshold reduces false negatives but may increase false positives.

2. Cost-Sensitive Learning:

  1. Assigning different penalties to false positives and false negatives.
  2. Useful in fraud detection and medical diagnosis.

3. Cross-Validation and Hyperparameter Tuning:

  1. Improving model accuracy reduces both FP and FN errors.

Python Code Example

The following Python code demonstrates how to compute false positives, false negatives, and evaluate precision, recall, and F1-score using sklearn.

Output

👁 confusion-matrix
Confusion Matrix

Interpretation of Results

From the confusion matrix:

  • True Negatives (TN): 4
  • True Positives (TP): 4
  • False Positives (FP): 1
  • False Negatives (FN): 1

The precision (0.8), recall (0.8), and F1-score (0.8) indicate a balanced model performance with both false positives and false negatives contributing equally. A trade-off exists: optimizing to reduce one could increase the other, but the current values suggest that the model strikes a reasonable balance between these error

Related Articles

Comment
Article Tags: