DEV Community

ANKIT SHAW
ANKIT SHAW

Posted on

Your AI Model Isn't Wrong. You're Optimizing the Wrong Metric

Why Precision, Recall, and Threshold Selection Matter More Than Accuracy in Production AI

Most business leaders ask the same question when they see a machine learning model:

"How accurate is it?"

That sounds like the right question, but in production AI, it is often the wrong one.

A model can be highly accurate and still lose a company money. It can score well in a notebook and still fail when a sales team, fraud team, or operations team starts using it in the real world. The reason is simple: machine learning models do not only make predictions. They create business actions.

And every business action has a cost.

That is why precision, recall, and threshold selection matter. They are not just machine learning metrics. They are a way to decide which mistakes a business can afford, which mistakes it cannot afford, and how an AI system should behave when the answer is uncertain.

Accuracy Can Hide the Real Problem

Imagine you run a subscription business.

Every month, your company wants to identify customers who are likely to cancel. You build a machine learning model that predicts churn risk. The goal sounds simple: find customers who might leave, then have the retention team contact them before they cancel.

Now suppose the model gives your team a list of 100 customers.

Out of those 100 customers, 70 were actually at risk of leaving. The other 30 were not going to leave at all.

Was the model useful?

Maybe.

The team found 70 real churn risks, which is valuable. But they also spent time, money, and possibly discounts on 30 customers who did not need intervention.

Now imagine a different model. This one gives the team only 20 customers. All 20 are truly at risk of leaving.

That sounds better at first. No wasted calls. No wasted discounts. No false alarms.

But what if another 80 customers quietly churned because the model did not flag them?

Now the business has a different problem. The model was careful, but too conservative. It avoided wasting money on unnecessary outreach, but it missed many customers who actually needed attention.

Neither model is simply "good" or "bad." They are optimized for different business outcomes.

That is where accuracy becomes misleading. Accuracy gives one overall score, but it does not explain the type of mistake the model is making. In real businesses, different mistakes have different costs.

Precision and Recall in Business Language

Precision answers this question:

When the model raises an alarm, how often is it right?

In the churn example, precision tells you how many of the customers flagged by the model were genuinely at risk of leaving.

High precision is useful when false alarms are expensive. If every flagged customer receives a discount, a phone call, or manual review, you do not want the model creating too much unnecessary work.

Recall answers a different question:

Out of all the real problems that existed, how many did the model actually catch?

In the churn example, recall tells you how many of all at-risk customers were successfully identified.

High recall is useful when missing a real case is expensive. If a missed customer cancels and the company loses months of future revenue, then catching more true churn risks may matter more than avoiding every false alarm.

This is why precision and recall are not abstract metrics. They describe business behavior.

Precision protects against wasted action.

Recall protects against missed risk.

The right balance depends on the cost of each mistake.

The Threshold Nobody Talks About

Most people imagine that a machine learning model predicts either "yes" or "no."

In reality, many models produce probabilities.

A churn model might output scores like:

Customer Churn Probability
A 0.91
B 0.83
C 0.61
D 0.42
E 0.13

The model is not saying, "Customer C will definitely churn." It is saying, "Customer C has a 61% estimated probability of churning."

Someone still has to decide what probability is high enough to take action.

If the threshold is set at 0.50, then customers A, B, and C are flagged.

If the threshold is set at 0.80, only customers A and B are flagged.

If the threshold is set at 0.30, customers A, B, C, and D are flagged.

That threshold changes the business outcome.

Lowering the threshold usually increases recall because the model catches more possible risks. But it can reduce precision because it also creates more false alarms.

Raising the threshold usually increases precision because the model becomes more selective. But it can reduce recall because some real cases are missed.

This is the part many teams overlook: the threshold is not purely a technical setting. It is a business decision.

The model estimates probability. The business decides what level of probability justifies action.

Different Use Cases Need Different Mistakes

There is no universal best metric.

In fraud detection, missing fraud can be extremely expensive. A company may accept more false alarms if it means catching more actual fraud. In that case, recall often matters more.

In cancer screening, missing a real case can be catastrophic. The system should be designed to catch as many true cases as possible, even if some healthy patients need additional review. Again, recall becomes critical.

In spam filtering, the trade-off changes. If an important client email is incorrectly sent to spam, the business impact could be serious. Here, precision matters. It is better to let a few spam emails through than to hide an important message.

In customer retention, the answer is usually a balance. If the company contacts too many customers, it wastes sales effort and discounts. If it contacts too few, it loses revenue from customers who leave.

The metric must follow the business priority.

That is the real lesson. You do not choose precision or recall because one sounds more technical. You choose based on the cost of being wrong.

What I Learned From Building a Customer Retention AI System

I ran into this trade-off while building my Customer Retention AI project for telecom churn.

The project uses a 1,200-row telecom customer dataset where 420 customers churned and 780 did not. The target is binary: churn = 1 means the customer left, and churn = 0 means the customer stayed.

At first, it is tempting to treat this as a normal classification problem: train a model, check the accuracy, and ship it.

But that would miss the business problem.

The goal is not just to predict churn. The goal is to give a retention team a ranked queue of customers they should review first. That means the model has to fit a human workflow, not just produce a score.

In my project, the model is advisory. It does not automatically contact customers or assign offers. It produces churn probabilities, risk bands, and a review priority so a human retention specialist can decide what action makes sense.

That changed how I evaluated the system.

I made recall the primary metric because missing churners is the more expensive mistake. If the model predicts that a customer will stay, but the customer actually leaves, the business loses the opportunity to intervene.

But I could not ignore precision either. A model with high recall but terrible precision would flood the retention team with too many low-quality cases. So precision became a guardrail metric: not the main target, but still important enough to protect the review queue.

I also compared the model against a simple rule-based baseline: flag customers when support_tickets >= 3. That baseline matters because many businesses already operate with rules like this. A machine learning model is only useful if it improves the decision process the business already has.

The harder question comes after the model produces predictions:

At what probability should we classify a customer as likely to churn?

In the batch scoring pipeline, each customer receives a churn probability. Customers are then sorted into a ranked review queue. The first production-style version uses a top-100 review queue, with risk bands based on probability:

  • High risk: 0.75 and above
  • Medium risk: 0.50 to 0.75
  • Low risk: below 0.50

Those numbers are not magic. They are operating assumptions.

If the threshold is too low, the retention team catches more at-risk customers, but they also spend more time reviewing customers who were never going to leave.

If the threshold is too high, the team avoids wasted outreach, but more customers may churn without being contacted.

At that point, the conversation is no longer just about machine learning. It becomes a business trade-off.

What is the cost of one unnecessary retention call?

What is the cost of giving a discount to someone who would have stayed anyway?

What is the lifetime value of a customer who churns?

How much capacity does the retention team actually have?

These questions matter as much as the model score. A technically impressive model can still fail if its decisions do not fit the business workflow around it.

That is why production AI needs more than training accuracy. It needs decision design.

Where MLOps Begins

Many people describe MLOps as a collection of tools: Docker, MLflow, CI/CD pipelines, monitoring dashboards, model registries, and cloud infrastructure.

Those tools matter, but they are not the point.

MLOps exists because the real world changes.

Customer behavior changes. Marketing campaigns change. Competitors change. Economic conditions change. Product pricing changes. The type of customer signing up this month may be different from the type of customer who signed up six months ago.

That means the model's old assumptions can become stale.

A churn threshold that worked last quarter may not work today. A fraud model trained on last year's behavior may miss this year's fraud patterns. A lead scoring model that performed well before a pricing change may become unreliable after the sales process changes.

This is why production systems monitor precision, recall, drift, data quality, and business outcomes.

In the customer retention project, monitoring is not treated as decoration. The system tracks changes in features like monthly bill, internet usage, call minutes, support tickets, customer tenure, city, contract type, and employment status. If those inputs shift, the old threshold and old model behavior may no longer match the current customer base.

Not because engineers love dashboards.

Because businesses hate losing money quietly.

MLOps is the discipline of keeping the model useful after it leaves the notebook. It connects model behavior to business performance over time.

A Better Framework for Production AI

These questions are not optional details. They define whether the AI system creates value or just produces scores.

Training a model may be 20% of the work. The remaining 80% is deciding how that model should behave inside a real business process.

That is where many AI projects fail. Not because the algorithm was weak, but because the team never clearly defined what kind of mistake the business could tolerate.

Conclusion

The most important question in production AI is not always, "How accurate is the model?"

A better question is:

"What business decision does this model control, and what is the cost of being wrong?"

Precision, recall, and threshold selection help answer that question. They turn model evaluation into business reasoning.

The threshold is not chosen by the data scientist alone. It is chosen by the cost of making the wrong business decision.

That is the missing business layer of MLOps.

Machine learning does not fail in production only because the model is bad. It often fails because yesterday's business assumptions become today's production bugs.

Top comments (0)