Lift Area Ratio — a population-independent model discrimination metric
Project description
LAR // Lift Area Ratio
A population-independent discrimination metric — interpretable alternative to ROC-AUC
[01] - why not AUC?
AUC averages performance across all thresholds equally. Two models can have the same AUC but behave very differently at your actual operating point.
// **LAR asks**
// how much better than random is my model at concentrating positives at the top of the ranking?
[02] - how it works
LAR is based on ERR (Event Rate Ratio) — at a given percentile, how much more concentrated are positives compared to the overall population:
ERR = (b / n) / (B / N)
N := total observations
B := total positives
n := observations up to percentile
b := positives found up to percentile
Three reference curves:
[oracle] ERR starts at N/B -> drops once all positives are found /* upper bound */
[model] sits between oracle and random
[random] ERR = 1 flat /* no skill */
LAR := ratio of areas above the random line:
LAR = A / O
= area(model) / area(oracle)
∈ [0, 1]
LAR |
meaning |
|---|---|
0.00 |
no skill |
0.83 |
83% of perfect discrimination |
1.00 |
oracle |
// NOTE: event rate cancels out - directly comparable across datasets
[03] - install
$ pip install lift-area-ratio
[04] - usage
from lar import LiftAreaRatio
lar = LiftAreaRatio(n_percentiles=100)
result = lar.fit(scores, y)
lar.summary(result)
# ================================================
# N (observations) : 2000
# B (positives) : 197 | ER : 9.85%
# max ERR (oracle) : 10.15
# ------------------------------------------------
# area(model) : 192.66
# area(oracle) : 231.72
# LAR = A/O : 0.8314 => 83.1% of perfect
# ================================================
lar.plot(result, title="My Model")
[05] - API
LiftAreaRatio(n_percentiles=100)
.fit(scores, y) -> LARResult
scores :: array-like # higher = more likely positive
y :: array-like # binary labels {0, 1}
.summary(result)
.plot(result, title, figsize, save=False, file_name="")
LARResult
.lar # final score
.area_model # area under model curve
.area_oracle # area under oracle curve
.N # total observations
.B # total positives
.event_rate # B / N
.lift_model # DataFrame :: percentile, ERR per bin
.lift_oracle # DataFrame :: percentile, ERR oracle
[06] - requirements
python >= 3.10
numpy >= 2.2.0
pandas >= 2.3.0
matplotlib >= 3.10.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lift_area_ratio-0.1.4.tar.gz.
File metadata
- Download URL: lift_area_ratio-0.1.4.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3636ab8c8fc1161a19f6cf4923b3cf2807c5c86fdd021de25531d404ea148e
|
|
| MD5 |
b5fc50797fe2c5277ec768f1bd86055c
|
|
| BLAKE2b-256 |
39a1ab5a19eac6ccc1bae7fafb317a17fa4b6990033a8dc636758257a8686aef
|
File details
Details for the file lift_area_ratio-0.1.4-py3-none-any.whl.
File metadata
- Download URL: lift_area_ratio-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
872b2cb0c832b128bc27fbcd54406e87a49555bbbecedcb2cc5de59db759c4a7
|
|
| MD5 |
c19218c81bdb40b1ceb9298fed6b2c34
|
|
| BLAKE2b-256 |
1904c0caa3d4b46397bc48684234fd86a074d97e8f889e0b1f75990fbfbbb34c
|