MLmetrics icon indicating copy to clipboard operation
MLmetrics copied to clipboard

Inconsistencies and errors with `Precision()`

Open dleng2242 opened this issue 4 years ago • 0 comments

Hello,

Firstly, thanks for developing this package. I have found some bugs with the Precision() function when all the true or predicted values equal the positive value. There is also unexpected behaviour when none of the true values are the "positive value".

See below a minimal example;

Precision(y_true = c(1, 1, 1, 1),
                y_pred = c(1, 0, 1, 0),
                positive = "1")
Error in FUN(X[[i]], ...) : 
  only defined on a data frame with all numeric variables

Precision(y_true = c(1, 0, 1, 0),
                y_pred = c(1, 1, 1, 1),
                positive = "0")
Error in FUN(X[[i]], ...) : 
  only defined on a data frame with all numeric variables

Precision(y_true = c(0, 0, 0, 0),
                y_pred = c(1, 0, 1, 0),
                positive = "1")
[1] NA

Hope this helps,

dleng2242 avatar May 07 '20 16:05 dleng2242