Open siemdejong opened 1 year ago
Hi! thanks for your contribution!, great first issue!
Hi @siemdejong, thanks for raising this issue. A couple of questions maybe:
For another writeup about gain metrics, see https://snorkel.ai/improving-upon-precision-recall-and-f1-with-gain-metrics/
Maybe an interesting discussion on scikit-learn and gain metrics: https://github.com/scikit-learn/scikit-learn/pull/24121
Hi, can I contribute in this issue?
Hi @arijitde92, Feel free to make a contribution on this topic :)
🚀 Feature
Add Precision-Recall-Gain (PRG) curve as a new feature with the same interface as the Precision-Recall (PR) curve.
Along with PRG, the Area Under the Precision Recall Gain curve (AUPRG) can be calculated, like is done
AveragePrecision
.The FGain1 score (FG1) is the F1 score, but transformed such that it is the minor diagonal in PRG-space. This could be added.
Motivation
The PR curve has some caveats as described in [1]. PRG aims to fix these problems:
In particular, the area under the PR curve is demonstrated to sometimes favour models that result in lower F1-scores. The PRG curve will ultimately result in better model selection.
Pitch
A Torchmetrics implementation of the PRG curve that has the same interface as the PR curve would aid in better model selection.
Precision-Gain (PG) and Recall-Gain (RG) can be calculated as
$$ PG = 1 - \frac{tp + fn}{fp + tn} \cdot \frac{fp}{tp}, $$
and
$$ RG = 1 - \frac{tp + fn}{fp + tn} \cdot \frac{fn}{tp}. $$
AUPRG can be calculated as done with
AveragePrecision
, but only accounting for the area in PR & RG $\in [0, 1]$.FG1 can be calculated as
$$ FG_1 = \frac{1}{2} PG + \frac{1}{2} RG. $$
It would be even more awesome if PRG can be extended to the multiclass/multilabel case.
Alternatives
The original authors of [1] have developed a package, pyprg (which is out-of-date with dependencies).
Then,
Additional context
[1] Flach & Kull. http://people.cs.bris.ac.uk/~flach/PRGcurves/PRcurves.pdf