TATECHATLAS
◎ English
Math & models / Guide

Selecting Evaluation Metrics for Binary Classification to Reduce False Positives

A practical guide to choosing precision-oriented metrics, threshold analysis, and confusion matrix decomposition in scikit-learn for minimizing false positive rates in binary classification tasks.

On this page

To control false alarms, first specify the positive class, the population and the operational constraint. Precision measures the fraction of flagged cases that are correct; FPR measures the fraction of actual negatives that are flagged. Neither is an absolute FP count. Compare confusion-matrix counts at candidate thresholds together with minimum acceptable recall on held-out data.

Define the Decision Goal

Before selecting any metric, determine whether the downstream application requires a calibrated probability estimate or a hard binary label. If the goal is probabilistic prediction, proper scoring rules such as log loss or Brier score reward well-calibrated distributions. If the goal is binary decision making, the metric must evaluate the quality of the decision boundary itself, which is where precision, recall, and confusion matrix counts become relevant. The scikit-learn documentation frames this distinction as the first step in scoring function selection, inspired by statistical decision theory. For false positive reduction, the binary decision perspective is the operative one because you ultimately need to control how many negative instances are incorrectly flagged as positive.

Choose the threshold by a stated operational limit and minimum recall. Report FP counts, number of negatives and sample period alongside precision and FPR; avoid comparing rates from different populations as if they implied equal work.

Evaluate probabilities separately

Evaluate probabilities and decisions separately. Log loss and Brier score assess probability predictions; precision and recall assess labels obtained at a chosen threshold. Training with log loss and evaluating decisions with precision is legitimate. A good probability model does not automatically meet a particular false-alarm constraint: the operating threshold still needs independent validation.

Choose the operational constraint

Precision = TP/(TP+FP), while FPR = FP/(TN+FP). A classifier with TP=90, FP=10 has precision 0.90; one with TP=9, FP=1 also has 0.90. Their false-alarm volumes differ tenfold. Conversely, equal FPR can produce very different FP counts when the number of negatives changes. Choose a count, rate or investigation workload according to the real task, and retain a recall floor so an almost silent classifier does not win by avoiding decisions.

Compare candidate thresholds

F-beta combines precision and recall as (1+beta²)PR/(beta²P+R). With beta below one, the score emphasizes precision, but beta is not a direct monetary FP/FN cost ratio. Precision-recall curves help explore candidates; inspect FP counts and FPR as well. Fix the choice on validation data, then assess the selected operating point on a separate test set. Do not pick and report the best threshold on the same test sample.

Examine ROC and DET Curves

ROC curves plot true positive rate against false positive rate across thresholds, while DET curves plot false negative rate against false positive rate on normal deviate scale. DET curves are particularly useful for threshold analysis when comparing error types because the linear appearance under near-normal score distributions makes operating point selection more intuitive. However, DET curves do not provide a single numerical score for easy model comparison without additional analysis, which is a practical limitation when you need to rank multiple candidate models. Use ROC for overall discrimination assessment and DET when you need to visually identify the operating region where FP and FN are balanced.

Track negative-class errors

Specificity = TN/(TN+FP) and FPR = FP/(TN+FP), so their sum is one when negatives exist. FPR has a negative-class denominator, but its measured value still depends on the sampled population and subgroup composition. Precision additionally changes with prevalence. When a denominator is zero, state an undefined value or the chosen convention rather than treating it as evidence of success.

A threshold does not guarantee higher precision

Install the dependency with python -m pip install scikit-learn. This small illustrative dataset contains three negatives and three positives. At threshold 0.40 the counts are TN=1, FP=2, FN=0, TP=3: precision 0.60, FPR 2/3 and recall 1. At 0.75 they are TN=2, FP=1, FN=2, TP=1: precision 0.50, FPR 1/3 and recall 1/3. Raising the threshold reduces FP here but also lowers precision. These are calculated illustrative results, not a measured model evaluation.

from sklearn.metrics import confusion_matrix

labels = [0, 0, 0, 1, 1, 1]
scores = [0.10, 0.40, 0.80, 0.45, 0.70, 0.90]
for threshold in (0.40, 0.75):
    predicted = [int(score >= threshold) for score in scores]
    tn, fp, fn, tp = confusion_matrix(labels, predicted, labels=[0, 1]).ravel()
    precision = tp / (tp + fp) if tp + fp else None
    fpr = fp / (tn + fp) if tn + fp else None
    recall = tp / (tp + fn) if tp + fn else None
    print(threshold, int(fp), precision, fpr, recall)

Use the current scorer API

For cross-validation, make_scorer expects a scalar score from the metric, not a confusion-matrix array. A custom estimator scorer can return a dictionary of named scalar scores; alternatively collect out-of-fold predictions and compute counts explicitly. Current make_scorer uses response_method to select predict or probability/score responses. The old needs_threshold keyword is not the current API. Class weights influence fitting; increasing the positive-class weight does not implement a general penalty against false positives. Start with explicit validation of thresholds and relevant costs before changing training weights.

Things to check

  • Precision, FPR and FP count use different denominators. A higher threshold need not increase precision. Threshold selection and final assessment use separate data. Cross-validation scores are scalar or a named dictionary of scalars.
  • Choose the threshold by a stated operational limit and minimum recall. Report FP counts, number of negatives and sample period alongside precision and FPR; avoid comparing rates from different populations as if they implied equal work.

The six records illustrate arithmetic only; they do not estimate deployment quality or confidence intervals. Version-dependent helpers such as confusion_matrix_at_thresholds require a compatible scikit-learn release (added in 1.8). Shifted prevalence, leakage and correlated observations can invalidate conclusions from a validation sample.

Sources

  1. scikit-learn: precision ↗
  2. scikit-learn: confusion matrix ↗
  3. scikit-learn: F-beta ↗
  4. scikit-learn: scorer API ↗
  5. scikit-learn: decision threshold ↗
Back to top ↑