jeffreyevans / rfUtilities

R package for random forests model selection, inference, evaluation and validation
GNU General Public License v3.0
23 stars 11 forks source link

rfUtilities::Aucuracy(x , y) inverse #9

Open JMFiore opened 1 year ago

JMFiore commented 1 year ago

The calculation of the function are done correctly, but in the documentation the functions asks for X to be the vector of predicted data and Y vector of observed data by doing that the metrics for Sensibility and Specificity are wrong. If the opposite is done, the calculations are correct. I suggest changing the description in the documentation to avoid misunderstanding.

img_metrics

JMFiore commented 1 year ago

observed1 <- factor(c(1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),levels=c('1','0'))# 1x6positive , 0x10negative predicted1<- factor(c(1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0),levels=c('1','0'))# TP=3, FN=3 , FP=2, TN=8

rfu_docum <- rfUtilities::accuracy( predicted1, observed1) ## as in documentation rfu_Notdoc <- rfUtilities::accuracy(observed1, predicted1) Sens_mlmetrics <- MLmetrics::Sensitivity(observed1,predicted1) caret_confm <- caret::confusionMatrix(predicted1,observed1) rfu_docum$sensitivity Sens_mlmetrics rfu_Notdoc$sensitivity

rfu_docum$confusion caret_confm$table