tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
564 stars 78 forks source link

Expand checking done in check_args() #1095

Open EmilHvitfeldt opened 3 months ago

EmilHvitfeldt commented 3 months ago

Something like decision_tree() doesn't do any type checking, where we can at least check for numeric input and sensible ranges without getting opinionated

library(parsnip)

data(hpc_data, package = "modeldata")

bt <- decision_tree(tree_depth = c(1, 5, 10)) %>% 
  set_engine("rpart") %>%
  set_mode("classification")

fit(bt, class ~ ., hpc_data)
#> Error in if (maxdepth > 30L) stop("Maximum depth is 30"): the condition has length > 1

Created on 2024-04-01 with reprex v2.1.0