I used the dataset cars as an example

logreg <- glm(formula = vs ~ hp + wt,
              family = binomial(link = "logit"), data = mtcars)

The prauc returned by PRAUC is 0.861

PRAUC(y_pred = logreg$fitted.values, y_true = mtcars$vs)

However, the prauc returned by pr.curve is 0.932

pr.curve(scores.class0 = logreg$fitted.values, weights.class0 = mtcars$vs)

Is there anything wrong?


The correct one is pr.curve. If you return the curve from it (via curve=T option) and plot at the values (see below), the area over the region contains approximately $53$ squares of area $(1/28)^2$, which has area approximately $0.067$, which means under it the area is nearly $0.93$.

pr curve from values

Sometimes, when the dataset is small, area calculation method matters, which is probably poorly implemented in MLmetrics.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.