Key takeaways
High overall accuracy can conceal complete failure to identify the minority class.
Evaluate precision and recall together with the confusion matrix and the number of alerts that staff must process.
Use precision-recall curves and average precision to assess rare-event ranking alongside ROC-AUC, not as substitutes for an operational threshold.
Choose thresholds using the consequences of errors, review capacity and risk constraints rather than a default probability cut-off.
Keep resampling inside training folds and evaluate on data representative of deployment prevalence.
Monitor delayed outcomes, calibration, alert volume and performance across relevant segments after deployment.
The model that looks excellent in a management meeting
Imagine a payments business reviewing a machine-learning model designed to identify fraudulent transactions. Its management dashboard reports 99% accuracy. That sounds like a successful investment until someone asks how many fraudulent transactions the model actually detected.
Suppose the evaluation contains 10,000 transactions, of which 100 are fraudulent. A system that calls every transaction legitimate correctly classifies 9,900 transactions. It achieves 99% accuracy without identifying a single fraud case. The business has received an impressive performance figure but no detection capability.
This is the central problem addressed by imbalanced classification evaluation. When the event that matters occurs infrequently, the number of ordinary cases can dominate an overall performance measure. Similar problems arise in manufacturing fault detection, insurance claim screening, cybersecurity alerts and predicting infrequent customer departures.
The question is not simply whether a model makes correct predictions. It is whether it identifies enough of the important cases, at an acceptable cost, in time for someone to act.
Start with the errors that affect your business
Class imbalance describes a classification problem in which some outcome classes occur much less frequently than others. For a fraud model, the positive class might be confirmed fraud; the negative class is legitimate activity. Positive means the event being detected, not necessarily a desirable outcome.
A confusion matrix separates predictions into four groups. True positives (TP) are fraud cases flagged correctly; false positives (FP) are legitimate transactions flagged unnecessarily; false negatives (FN) are missed fraud cases; true negatives (TN) are legitimate transactions correctly left unflagged.
Each error has a different consequence. A missed fraud case may create a financial loss. A false alert may consume investigator time, delay a payment or inconvenience a customer. Flagging a genuine fraud case still requires an effective intervention before it creates value.
Ask the business owner to define the event, observation period, action deadline and acceptable errors before the data science team selects evaluation metrics. A rare class is not automatically the most important class; its importance depends on the decision and its consequences.
Precision and recall answer different business questions
Precision answers: of all cases flagged, how many actually contain the event? It is TP divided by (TP + FP). Recall, also called sensitivity, answers: of all actual events, how many did we flag? It is TP divided by (TP + FN). Specificity measures the proportion of genuine negative cases correctly left unflagged: TN divided by (TN + FP).
Consider a hypothetical evaluation on the same 10,000 transactions. At threshold A, a model catches 70 of the 100 fraud cases and flags another 130 legitimate transactions. It misses 30 frauds and correctly leaves 9,770 legitimate transactions unflagged.
The model generates 200 alerts. Precision is 70 / 200 = 35%; recall is 70 / 100 = 70%; and accuracy is 9,840 / 10,000 = 98.4%. Its accuracy is below that of the model that never flags fraud, yet it identifies 70 cases that the apparently more accurate system misses.
Use recall when missed events matter, precision when unnecessary interventions are costly, and specificity when the impact on legitimate cases needs attention. Report the underlying counts as well as the percentages. If the system produces no alerts, precision has no defined denominator; reporting it as zero by convention must not imply that the model was evaluated on any positive predictions.
Other measures can help compare candidates. F1 is the harmonic mean of precision and recall, calculated as 2TP / (2TP + FP + FN). Balanced accuracy averages sensitivity and specificity for binary classification. These are useful summaries, but neither directly measures economic value or the capacity to handle alerts.[1]
Why a good ROC curve may still create too many alerts
Models usually produce a score before converting it into a yes-or-no decision. A receiver operating characteristic (ROC) curve compares the true-positive rate with the false-positive rate across score thresholds. ROC-AUC summarises ranking discrimination: higher values indicate a greater ability to rank actual positives above actual negatives.
The difficulty is interpreting false-positive rates when negatives vastly outnumber positives. In the hypothetical population, a false-positive rate of just 1% corresponds to 99 legitimate transactions. At 80% recall, there would be 80 correct alerts and 99 incorrect alerts, giving precision of approximately 44.7%.
A precision-recall (PR) curve makes the trade-off between event coverage and alert reliability visible. Research by Saito and Rehmsmeier illustrates why this view can be especially informative for imbalanced binary classification.[2] The no-skill reference precision is the positive-class prevalence: 1% in this example.
Average precision (AP) summarises precision across increases in recall. It is often reported alongside PR-AUC, but AP and trapezoidal area under the PR curve are different calculation methods; record which definition was used.[3] Compare scores on the same representative evaluation population, because precision and AP depend on event prevalence.
ROC-AUC remains useful for discrimination, including comparisons across the low-false-positive region where a business may operate. Neither ROC-AUC nor AP tells management how many alerts it will receive at a chosen threshold. Examine the actual operating point and the score distribution before committing to deployment.
A lower-accuracy decision can be the better investment
Suppose the same model can operate at a lower threshold B. It now detects 90 fraud cases, misses 10, flags 410 legitimate transactions and correctly leaves 9,490 legitimate transactions unflagged. It generates 500 alerts, achieves 90% recall and 18% precision, and has 95.8% accuracy.
The appropriate threshold depends on what happens next. For illustration, assume each missed fraud costs £500, every alert costs £10 to investigate and timely investigation prevents the entire assumed loss for each detected fraud. These simplified figures are hypothetical, not industry benchmarks or measured savings.
With no detection, the estimated cost is 100 missed frauds × £500 = £50,000. Threshold A costs 30 × £500 plus 200 × £10 = £17,000. Threshold B costs 10 × £500 plus 500 × £10 = £10,000. Under these assumptions, B has the lowest cost despite having the lowest accuracy.
But suppose the investigation team can handle only 250 alerts per evaluation period. Threshold B is not feasible as configured. Threshold A fits within the limit, although an alternative threshold or a ranked queue of the highest-priority 250 cases might perform better. Evaluate the resulting policy independently rather than assuming that its performance lies halfway between the two thresholds.
In reality, fraud amounts differ, intervention may recover only part of a loss, and customer friction has a cost. Estimate the incremental value of the action using realistic loss severity, recovery rates and review effort. A default probability threshold of 0.5 is not a business requirement; tune it to a justified decision objective on validation data, not the final test set.[4]
Do not confuse a risk score with a reliable probability
A model can rank risky transactions ahead of ordinary transactions while producing unreliable probability estimates. Ranking matters when an investigation team works through a fixed queue. Calibration matters when a business uses estimated probabilities to calculate expected losses or determine whether intervention is worthwhile.
If 1,000 transactions each receive predicted fraud probabilities close to 10%, a well-calibrated model would have roughly 100 actual frauds in that group over repeated comparable samples. A score of 0.10 should not be treated as a 10% probability unless its interpretation has been validated.
Inspect calibration curves on data separate from model fitting, paying particular attention to the probability range used for decisions. Report the Brier score or log loss as complementary probability-quality measures; these reflect more than calibration alone.[5] Rare positive events can make calibration estimates uncertain, especially in narrow score bands.
Class weighting and resampling can alter the meaning of predicted probabilities. Where probabilities are needed, assess and, if necessary, recalibrate on representative data. A well-calibrated score may also deteriorate when the underlying event rate or population changes.
Fix the evaluation before trying to fix the imbalance
Teams often respond to class imbalance by duplicating minority examples, removing majority examples, weighting training losses or using the Synthetic Minority Over-sampling Technique (SMOTE). These are training choices, not proof of improved business outcomes. Compare them with a straightforward baseline and a threshold-adjusted model.
The most damaging evaluation mistake is to resample before separating training and test data. Synthetic or duplicated cases can share information across the split, and a balanced test set can make precision look better than it would be in production. Apply any resampling only inside each training fold, with validation and test data retaining the relevant natural distribution.[6]
Use stratified splits when observations are independent and preserving class proportions is appropriate. For transaction monitoring, a chronological split may better reflect future deployment. Where records from the same customer, device or machine are dependent, consider group-aware separation as well. Prevent features derived from future outcomes entering training or evaluation.
Reserve an independent test set for the final model and threshold. With very few positive examples, a handful of errors can change recall substantially. Show event counts and suitable uncertainty intervals, accounting for clustering or time dependence where relevant. For multiclass problems, report per-class measures and macro averages rather than relying only on frequency-weighted averages.
Check label quality as carefully as feature quality. If unflagged transactions are rarely investigated, some supposedly legitimate cases may contain undetected fraud. A model evaluated exclusively on previously investigated cases can inherit the blind spots of the old screening policy.
Monitor the decision, not just the model
Deployment changes the evaluation problem. The prevalence of fraud may rise during a new attack pattern, customer behaviour may change, or investigators may struggle to process a growing queue. A model can retain respectable discrimination while its precision and operational usefulness deteriorate.
Monitor event prevalence when outcomes become available, alert volumes, precision, recall, review turnaround time, missed-event losses and the proportion of alerts that produce a useful intervention. Compare performance by relevant product, channel and customer segment, with sufficient observations and appropriate privacy safeguards. Overall performance must not hide severe errors in smaller groups.
Fraud confirmation can arrive weeks after the original prediction. Use mature outcome cohorts to calculate performance, distinguish pending labels from negatives and report which metrics remain provisional. Review a properly designed sample of unflagged cases where feasible to understand otherwise invisible errors.
Assign ownership of threshold changes, model approval, escalation and monitoring. Document the chosen operating point and its assumptions, including review limits and the consequences of missed cases. A threshold update may solve a capacity or prevalence issue, whereas a change in the relationship between features and outcomes may require investigation, retraining or replacement.
What should leaders ask before approving a model?
Request a comparison against the current process and a simple baseline, including a confusion matrix, PR curve, relevant ROC results and a realistic threshold-level cost and workload analysis. Ask whether the evaluation data resembles the population that will receive the decision, and whether outcomes have had enough time to mature.
A simple rules-based system, a better review process or improved outcome labels may create more value than another sophisticated algorithm. If a model is promising but its operational impact is uncertain, a controlled pilot can test whether its alerts lead to useful actions, without treating an offline performance improvement as evidence of realised savings.
If your organisation is reviewing a fraud, churn or risk-scoring model, a focused assessment of evaluation data, threshold economics and the operational workflow can help establish whether the current performance measures support the decision you need to make.
The best classifier is not necessarily the one that makes the fewest mistakes overall. It is the one whose errors, interventions and costs are understood well enough to support a better business decision.
References and further reading
[1] scikit-learn documentation. Metrics and scoring: quantifying the quality of predictions. Source: https://scikit-learn.org/stable/modules/model_evaluation.html
[2] Saito, T. and Rehmsmeier, M. (2015). The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets. PLOS ONE, 10(3), e0118432. Source: https://doi.org/10.1371/journal.pone.0118432
[3] scikit-learn documentation. average_precision_score. Source: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html
[4] scikit-learn documentation. Tuning the decision threshold for class prediction. Source: https://scikit-learn.org/stable/modules/classification_threshold.html
[5] scikit-learn documentation. Probability calibration. Source: https://scikit-learn.org/stable/modules/calibration.html
[6] imbalanced-learn documentation. Common pitfalls and recommended practices. Source: https://imbalanced-learn.org/stable/common_pitfalls.html
Apply the approach
Illustrative fraud-screening evaluation of 10,000 transactions with 100 actual fraud cases (1% prevalence). Assume each missed fraud costs £500, every alert costs £10 to review, and timely investigation prevents the full assumed loss for each detected case. The review team can handle 250 alerts per period. The figures are hypothetical and demonstrate why model accuracy, cost and feasibility may point towards different operating decisions.
TP 0, FP 0, FN 100, TN 9,900. Recall 0%; precision undefined; 0 alerts; estimated cost £50,000.
TP 70, FP 130, FN 30, TN 9,770. Recall 70%; precision 35%; 200 alerts; estimated cost £17,000. Fits the 250-alert limit.
TP 90, FP 410, FN 10, TN 9,490. Recall 90%; precision 18%; 500 alerts; estimated cost £10,000 before capacity constraints. Exceeds the alert limit.
Put the approach into practice
- 01Define the positive class, decision deadline, costs of errors and available intervention capacity with the business owner.
- 02Build a leakage-resistant evaluation dataset and compare against the majority-class and current-process baselines.
- 03Compare precision, recall, AP, ROC-AUC and calibration as appropriate; retain the confusion matrix and event counts at each relevant operating point.
- 04Select a feasible threshold or ranked-queue policy using validation data, then assess it on an untouched test set and in a controlled pilot.
- 05Monitor mature outcomes, alert workload, segment performance, realised intervention value and calibration; document changes to the approved policy.
Frequently asked questions
What is the best metric for imbalanced classification evaluation?
There is no universal best metric. Average precision helps assess rare-event ranking, recall measures event coverage, and precision measures alert reliability. For deployment, select a threshold using decision costs and constraints, and report the underlying confusion matrix.
Should I use F1 score or balanced accuracy?
F1 combines positive-class precision and recall without directly rewarding true negatives. Binary balanced accuracy gives equal weight to positive and negative class recall. Both can be useful comparisons, but the choice depends on the cost of each error and the required action.
Is ROC-AUC misleading when the positive class is rare?
ROC-AUC remains a valid ranking metric, but a seemingly small false-positive rate can translate into many unnecessary alerts when negatives are numerous. Use precision-recall results and threshold-specific alert counts alongside ROC-AUC, particularly in the operating region relevant to the business.
Should I balance the test dataset using SMOTE?
No, not for estimating deployment performance. Apply SMOTE or another resampling method to training data only, within each training fold. Keep evaluation data representative of the intended population. If case-control sampling is unavoidable, account for sampling and prevalence when estimating population metrics.
How many rare-event examples are enough to evaluate a model?
There is no fixed minimum. The answer depends on the uncertainty your decision can tolerate, event prevalence, dependence between observations and whether you need reliable subgroup results. Plan sample sizes for the desired precision of the relevant metrics, and report uncertainty rather than just total record counts.
Can changing a threshold improve performance without retraining?
It can improve an operating objective such as expected cost or recall at a given alert capacity. It does not improve the underlying ranking discrimination of the same score function. Tune the threshold on validation data, confirm it independently and monitor the resulting decisions.