Concepts / Binary Classification Metrics

Binary Classification Metrics

The evaluation score is evidence about the goal, not the goal itself. Choosing the model with the highest score is only sound when that score tracks the business metric closely.

  • Programming

The Habit of Picking the Highest Number

When you first train a classifier, the natural habit is to look at one number, usually accuracy, and pick the model with the highest value. That habit feels rigorous, and in many small exercises it works. This article examines the belief behind the habit: that the metric you compute during development is the goal itself. The source material argues that this belief is usually wrong, and it explains what should replace it.

The misconception is this: if model A has a higher evaluation score than model B, then model A is the better choice for the application. Under this belief, the evaluation score is the target, and the job of machine learning is simply to push that number as high as possible. The source corrects this directly. In practice, people care about more than accurate predictions. They use those predictions as part of a larger decision-making process. The prediction is an input to a decision, and the decision is what has consequences in the world.

Watching Accuracy Fail on Imbalanced Data

Binary classification is the task of sorting every case into one of two classes. The source calls it arguably the most common and conceptually simple application of machine learning in practice. We speak of a positive class and a negative class, where the positive class is the one we are looking for. Even this simple task has a caveat: measuring accuracy can be misleading when the classes are unequal in size.

Trace the problem with a concrete dataset. Suppose there are 1000 images, and only 10 of them are positives, the class we are looking for. The other 990 are negatives. Now imagine a model that always predicts negative and never looks at the image at all. Follow what happens to its results.

Worked example

Tracing the always-negative model

A model predicts negative for all 1000 images. How many are correct, what is its accuracy, and how many positives does it find?

  1. 1
    Count the correct predictions

    Every negative image is predicted negative, which is correct. That gives 990 correct predictions. The 10 positive images are all predicted negative, which is wrong.

  2. 2
    Compute accuracy

    Accuracy is the fraction of correct predictions, so accuracy = $990 / 1000 = 0.99$, or 99 percent.

  3. 3
    Check the positive class

    The model found 0 of the 10 positive cases. For an application built to find positives, that is the entire failure, even though the headline number looks excellent.

Result

The model scores 99 percent accuracy while catching none of the positive cases, which may be the whole reason the application exists.

Accuracy99%Positives found0 of 10Negatives correct990 of 990Positive cases missed10 of 10
The always-negative model looks excellent on accuracy but fails on the positive class it was built to find.

Separating the Business Metric from the Prediction Score

Definition

A business metric is the high-level goal of a machine learning application. Before choosing an evaluation metric, the source advises you to think about this goal first.

The source gives examples of business metrics: avoiding traffic accidents, decreasing the number of hospital admissions, getting more users for a website, and having users spend more money in a shop. Each one is stated in the language of the organization or the people the system serves, not in the language of a model. None of them is a number a classifier outputs.

A prediction score is what the model produces during development, such as an accuracy value on a test set. It is a proxy you compute to help decide between models. The distinction matters: the business metric is what you want to improve, and the prediction score is a measurement you use to guess how well a model will help improve it. The two can point in different directions, as the always-negative model showed. A high prediction score can coexist with no progress on the business metric at all.

Key point

The evaluation score is evidence about the goal, not the goal itself. Choosing the model with the highest score is only sound when that score tracks the business metric closely.

Business Impact of Choosing One Algorithm

Definition

Business impact is the set of consequences of choosing one algorithm for a machine learning application. The business metric is the goal, and the business impact is what actually happens to that goal when you deploy one algorithm instead of another.

The source notes that business impact may only be fully assessed by putting a model into production. Assessing it for a particular model can therefore require placing that model into a real-life system, which is often difficult to do. The consequences of a choice are real outcomes, and they show up only when the choice meets the world.

Customers100Customers110Spend per customer100Spend per customer85
Switching from Algorithm A to Algorithm B changes two business quantities at once: the number of customers and the spend per customer.
Worked example

Customers up, spend down: is the switch worth it?

Algorithm B brings 10 percent more customers, but each customer spends 15 percent less. Does total spend rise or fall?

  1. 1
    Represent the change as multipliers

    Ten percent more customers multiplies the customer count by $1.10$. Fifteen percent less spend multiplies spend per customer by $0.85$.

  2. 2
    Combine the multipliers

    Total spend is customers times spend per customer, so the combined multiplier is $1.10 \times 0.85 = 0.935$.

  3. 3
    Interpret the result

    Since $0.935$ is less than $1$, total spend falls by about 6.5 percent, even though the customer count rose.

Result

A metric that looks only at customer count would favor Algorithm B. The business impact, measured as total spend, favors Algorithm A. The evaluation should capture the expected business impact of choosing one model over another.

The worked example shows why the source concludes that evaluation should still capture expected business impact. The result of evaluating a model is not always a single number that maps directly onto the goal. Two effects can move in opposite directions, and only the combined consequence tells you which choice is better.

Surrogate Evaluation When Testing Is Too Risky

Why not simply measure business impact directly during development? The source explains that in early development, and when tuning parameters, it is often infeasible to put models into production just for testing, because the business or personal risks can be high. The source gives a vivid case: evaluating the pedestrian avoidance of a self-driving car by letting it drive around without first verifying it. If the model is bad, pedestrians are the ones who suffer.

Definition

A surrogate evaluation procedure uses an evaluation metric that is easier to compute than the business metric. It is a stand-in that lets you learn something before the expensive or dangerous real-world test.

Trained classifierPedestrian vsnon-pedestrian imagessurrogate test setAccuracy on test setsurrogate metricModel selection nowReal-world drivingtestbusiness impact, laterrun onscorecompare modelswhen safe and feasible
The surrogate test runs now and informs model selection, while the true business test is deferred until it is safe and feasible.

Follow the pedestrian example through the pipeline. You cannot yet measure how well the car avoids pedestrians on real roads. So you test whether the model can classify images of pedestrians versus non-pedestrians, and you measure accuracy on that test. The result lets you rank candidate models today, without risking anyone. The real-world test remains the eventual judge of business impact.

The source states that the closest feasible metric to the business goal should be preferred, and that this closest metric should be used whenever possible for model evaluation and selection.

Mistakes When Reading a Single Metric

  • Common mistake

    Treating the highest accuracy as the best model

    What it looks like

    Two models are compared on a dataset where 99 percent of cases are negative. The one with higher accuracy might be the one that never predicts the positive class.

    Why it fails

    Accuracy counts correct predictions across both classes, so it can be dominated by the majority class.

    Do this instead

    Ask what the positive class is and whether the metric reflects how well the model handles it.

  • Common mistake

    Equating the evaluation score with the business goal

    Why it fails

    The source states that the evaluation score is not the target. The prediction is an input to a decision, and the decision has consequences.

    Do this instead

    Name the business metric first, then check whether the evaluation score tracks it.

  • Common mistake

    Choosing the easiest surrogate instead of the closest one

    Why it fails

    A surrogate that is easy to compute but far from the goal can lead to confident selection of the wrong model.

    Do this instead

    Pick the feasible metric closest to the business goal.

  • Common mistake

    Assuming a single number always captures the outcome, even when customer count and spend per customer move in opposite directions

Predict the Accuracy Before Computing It

What do you think happens?

A dataset has 1000 images, 50 of them positive and 950 negative. A model always predicts negative. What is its accuracy, and how many positives does it find?

Reveal answer
Answer:

Accuracy is $950 / 1000 = 0.95$, or 95 percent. It finds 0 of the 50 positives.

All 950 negatives are predicted correctly, so the score is high, yet none of the positive cases are found. The same pattern as the 1000-image example, with a different class balance.

MEDIUM

A company's goal is to increase the number of repeat customers. Model A has higher accuracy on a development set. Model B has slightly lower accuracy but a surrogate metric closer to repeat purchases. Which would you evaluate first with real customers, and why? Explain using the terms business metric, business impact, and surrogate.

Hints
  • Start by stating the business metric in the company's own language.
  • Ask which evaluation score is closest to that goal and feasible to compute now.
  • Consider what the real-world test would reveal that the development score cannot.

Summary of the Evaluation Chain

Read the chain from goal to measurement: the business metric names the goal, the business impact is what happens to that goal when you deploy a chosen algorithm, and the surrogate evaluation procedure is the feasible stand-in you use while the real test is too risky or too costly to run. Each link is a place where the number on your screen can drift from what matters in the world.

At a glance

  • A business metric is the high-level goal of an application, and the prediction score is only evidence about that goal.
  • Business impact is the set of consequences of choosing one algorithm, and it may only be fully assessed in production.
  • When production testing is too risky or infeasible, use a surrogate evaluation procedure, preferring the feasible metric closest to the goal.
  • In binary classification, accuracy can be misleading on imbalanced data, so the metric should reflect the positive class and the real goal.

Related concepts

More concepts starting with B