0

I'm currently trying to draw ROC and precision-recall curves for my model and struggling a bit to understand how to use my data for the PRROC package of R. I have a data frame containing different confidence thresholds in [0.1, 1] and for each of these confidence thresholds I know the amount of true positives, false positives, false negatives and true negatives (conf, TP, FP, TN, FN). The PRROC package requires to use foreground (fg) and background (bg) data i.e. positive and negative. But I'm actually confused about what it means regarding my data.

I did try with this :

  fg <- rep(df$conf, df_perf$TP + df_perf$FN) %>% as.numeric()
  bg <- rep(df$conf, df_perf$FP + df_perf$TN) %>% as.numeric() 

  roc <- roc.curve(scores.class0 = fg, scores.class1 = bg, curve = TRUE)
  pr <- pr.curve(scores.class0 = fg, scores.class1 = bg, curve = TRUE)

I do not understand if the positive class refers to the positive outputs of the predictor or the real positive class. With my data and the code up there, I achieve an AUC of the ROC curve auc = 0.5, which leads me to think that there is a problem.

I'm wondering if I'm just too stuck in the categories I did and misunderstand the whole theory of ROC and PR curves.

For anyone who can help me thank you very much it will be a big help !!!

0

Browse other questions tagged or ask your own question.