tidymodels / tailor

Sandbox for a postprocessor object.
Other
2 stars 0 forks source link

`adjust_numeric_range()` requires `estimate` to be called `.pred` #22

Open simonpcouch opened 1 month ago

simonpcouch commented 1 month ago

adjust_numeric_range() allows specifying estimate = "some_other_column_name", but probably::bound_prediction() then errors, noting that the estimate isn't called .pred.

library(tailor)
data("two_class_example", package = "modeldata")

tailor_fit <- tailor() %>%
  adjust_numeric_range(.5) %>%
  fit(
    two_class_example,
    outcome = "Class1",
    estimate = "Class2"
  )
#> Error in `probably::bound_prediction()`:
#> ! The argument `x` should have a column named `.pred`.

two_class_example$.pred <- two_class_example$Class2

tailor_fit <- tailor() %>%
  adjust_numeric_range(.5) %>%
  fit(
    two_class_example,
    outcome = "Class1",
    estimate = ".pred"
  )

Created on 2024-06-05 with reprex v2.1.0

simonpcouch commented 1 month ago

cc @topepo

It looks like this behavior is intentional in probably. From the docs of probably::bound_prediction():

x | A data frame that contains a numeric column named .pred.

Do we want tailor to just temporarily rename in order to pass this data to probably or do we want to add an estimate argument to probably::bound_predictions()?