kogalur / randomForestSRC

DOCUMENTATION:
https://www.randomforestsrc.org/
GNU General Public License v3.0
113 stars 18 forks source link

Threshold value location for classification #408

Closed erikerhardt closed 5 months ago

erikerhardt commented 6 months ago

rfsrc team,

I'm looking for the threshold value used for the confusion matrix printed in the standard output from the rfsrc object. Where is this threshold value located?

For imbalanced(), I can get thresholds with these functions, but their thresholds result in different confusion matrices.

    ## (1) default threshold (2) directly optimized gmean threshold
    threshold_default <-
      randomForestSRC::get.imbalanced.performance(
        o_class_full
      )["threshold"]

    threshold_gmean   <-
      randomForestSRC::get.imbalanced.optimize(
        o_class_full
      , measure = c("gmean", "F1", "F1mod", "F1modgmean")[1]
      , plot.it = FALSE
      )["threshold"] |>
      as.numeric()
Confusion matrix:

          predicted
  observed   No Yes class.error
       No  8526  18      0.0021
       Yes  172 367      0.3191

Thank you!