0

Does tidymodels now provide a means to tune classification model thresholds? I believe this was slated as an upcoming feature in the Spring of 2020. I looked around the tidymodels website, but have not seen a mention the feature.

Mutuelinvestor
  • 3,384
  • 10
  • 44
  • 75
  • 3
    Take a look at the [probably](https://probably.tidymodels.org/) package, especially the vignette on how to optimize probability thresholds. This package is still fairly immature so we are interested in feedback on what does/does not work for you. – Julia Silge Apr 14 '21 at 23:43

2 Answers2

3

As Julia says, there is an indirect method to do this.

We plan on making it a fully tunable parameter (like other parameters) but a few things have pushed this back but it is near the top of our development list.

topepo
  • 13,534
  • 3
  • 39
  • 52
1

There's now an R package available, probably (as part of the tidymodels ecosystem) that solves this problem.

In essence, we can change classification thresholds now like this:

hard_pred_0.75 <- lending_test_pred %>%
  mutate(
    .pred = make_two_class_pred(
      estimate = .pred_good, 
      levels = levels(Class), 
      threshold = .75
    )
  ) 

See this example for (reproducible) details.

Sebastian Sauer
  • 1,555
  • 15
  • 24