0

When I enter:

tune_spec<- decision_tree(min_n= tune(), tree_depth= tune(), cost_complexity=tune()) %>% 
  set_engine("rpart") %>% 
  set_mode("regression")

tree_grid<- tune_spec %>% 
  extract_parameter_set_dials() %>% 
  grid_regular(levels=3)

set.seed(275)

folds<- vfold_cv(trains_set, v=3)

fits_cv<- fit_resamples(tune_spec, outcome~., resamples= folds, metrics= metric_set(rmse))

I get the error:

! 3 arguments have been tagged for tuning in these components: model_spec. 
Please use one of the tuning functions (e.g. `tune_grid()`) to optimize them.

When I tried tunegrid():

tune_results<- tune_grid(tune_spec, outcome~., resamples= folds, grid= tree_grid, metrics= metric_set(rmse))

I got the errors factor has new levels and There were issues with some computations

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Jun 16 '23 at 20:49

0 Answers0