Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Klarna Engineering 10 min read Deep dive mediumAdept

Stop Misusing ROC Curve and GINI: Navigate Imbalanced Datasets with Confidence

ROC_AUC and the derived GINI coefficient (GINI = 2·ROC_AUC − 1) can be misleading on imbalanced binary classification problems: abundant true negatives keep the false positive rate low even when there are many false positives. Precision-Recall AUC ignores true negatives and focuses on the minority class, making it the more reliable threshold-agnostic metric in that setting. In a loan-default example with a 2% default rate, two models score an identical ~49% on a simplified ROC_AUC, yet PR_AUC separates them at 17% vs 25%, exposing that one model wrongly flags 100 more good customers. The caveat is that PR_AUC depends on target incidence, which makes it less intuitive for stakeholders.

Assumes: binary classificationconfusion matrix

Related posts

  • Calibrating LLM-Based Population Estimates with Human Validation

    Indeed Engineering mediumAdept

    The share of records an LLM classifies as positive is only an apparent prevalence. Sensitivity and specificity estimated from a small human-validated sample can correct it with the Rogan–Gladen estimator, and a delta-method variance gives a confidence interval. Simulations show the correction becomes unstable as Se+Sp−1 approaches zero, with error growing roughly as 1/D, so weak classifiers need much more validation data. In an Indeed job-matching opportunity-sizing study, about 100 human labels (Se 73.5%, Sp 77.8%) moved apparent coverage of 56.4% to a corrected 66.6% (95% CI 47.9–85.3%), which informed which investment to prioritize.

  • Roonomics: How Economics Helped Us to Build a Churn Prediction Model

    Deliveroo Engineering mediumAdept

    Deliveroo replaced a high-recall, rule-based restaurant churn flagging system with a ranked probability model tuned for precision, because retention teams have limited capacity and false positives carry a real opportunity cost. The model uses rolling-window cross-validation to avoid leakage, a precision-oriented score for the rare-event setting, business-importance weighting for prioritisation, and Shapley values for per-restaurant explanations, and it runs weekly as an Argo pipeline. Offline, it cut flagged restaurants by over 90% and raised precision 8x at the cost of recall, with calibration curves tracking the 45-degree line. A randomised treatment/control experiment is under way to test whether acting on the flags actually reduces churn.

  • Object Detection Leaderboard

    Hugging Face mediumAdept

    Object detection models on the Hugging Face Object Detection Leaderboard are ranked using IoU-based metrics, chiefly Average Precision (AP) and Average Recall (AR) with their variants. The post works step by step through classifying detections as true or false positives at an IoU threshold, building the Precision x Recall curve from confidence-sorted cumulative counts, and approximating its area with N-point interpolation (COCO's 101 points versus 11-point). It then explains the evaluation parameters and implementation differences that can make the same model report divergent AP numbers, and how to pick a model from the leaderboard with those pitfalls in mind.

  • Bootstrap Confidence Intervals for LLM Evaluation

    Indeed Engineering hardMaster

    When LLM outputs are non-deterministic, the cluster bootstrap gives near-nominal 95% coverage with the narrowest intervals. It runs each of N inputs k times and resamples whole inputs with all their runs. A simulation of a 4-class classifier at 70% accuracy compares five strategies. Single-draw cluster and hierarchical bootstraps are overly conservative, and mode-aggregation estimates majority-vote accuracy instead of single-call accuracy, so its coverage collapses to zero for k > 2. A variance decomposition via intraclass correlation guides the N-versus-k tradeoff, with k = 3 or 5 recommended when affordable.

  • Scaling Model Evaluation at Pinterest with Ray (Part 4)

    Pinterest Engineering mediumAdept

    Pinterest fused model-evaluation metric computation into its Ray batch inference jobs, removing the separate Spark/Ray metrics job and the write-predictions-to-S3-then-reread handoff. The fusion relies on a metric contract (preprocess, compute partials per batch, reduce partials) that covers decomposable metrics like MAE, holistic metrics like ROC-AUC (approximated via per-threshold confusion matrices), and group-wise metrics like Precision@K. Group-wise metrics use Spark to pack complete segments into buckets so no segment spans a bucket. Overlapping CPU metric work with GPU inference via Ray's shared object store cut end-to-end evaluation time by 25–32% at 100 feature-importance experiments, with runtime scaling linearly in experiment count.

The quest for software engineering knowledge.

Look:
Layout: