Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check tidyselect output in fit.tailor() #23

Merged
merged 3 commits into from
Jun 5, 2024
Merged

check tidyselect output in fit.tailor() #23

merged 3 commits into from
Jun 5, 2024

Conversation

simonpcouch
Copy link
Contributor

Closes #21.

library(modeldata)
library(tailor)

tailor_fit <- tailor() %>%
  adjust_probability_threshold(.5) %>%
  fit(
    two_class_example,
    outcome = "truth",
    estimate = "predicted",
    probabilities = tidyselect::contains("Class")
  )

tailor_fit <- tailor() %>%
  adjust_probability_threshold(.5) %>%
  fit(
    two_class_example,
    outcome = "truth_WRONG",
    estimate = "predicted",
    probabilities = tidyselect::contains("Class")
  )
#> Error in `fit()`:
#> ! Can't select columns that don't exist.
#> ✖ Column `truth_WRONG` doesn't exist.
tailor_fit <- tailor() %>%
  adjust_probability_threshold(.5) %>%
  fit(
    two_class_example,
    outcome = contains("truth_WRONG"),
    estimate = "predicted",
    probabilities = tidyselect::contains("Class")
  )
#> Error in `fit()`:
#> ! `outcome` must select at least one column.
#> ✖ Selector `contains("truth_WRONG")` did not match any columns in `.data`.
tailor_fit <- tailor() %>%
  adjust_probability_threshold(.5) %>%
  fit(
    two_class_example,
    outcome = contains("truth"),
    estimate = "predicted",
    probabilities = tidyselect::contains("Class_WRONG")
  )
#> Error in `fit()`:
#> ! `probabilities` must select at least one column.
#> ✖ Selector `tidyselect::contains("Class_WRONG")` did not match any columns in
#>   `.data`.

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

@simonpcouch simonpcouch merged commit aac6b57 into main Jun 5, 2024
1 check passed
@simonpcouch simonpcouch deleted the selection-21 branch June 5, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check tidyselect output before subsetting
1 participant