0
votes

I'm trying to fit a random forest like:

rf_model<-rand_forest(trees = 2000, mtry = 4, mode = "classification") %>% 
  set_engine("randomForest",importance=T, localImp = T, ) %>% 
  fit(y ~ ., data = train.data)

But it returns an error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘fit’ for signature ‘"rand_forest", "data.frame"’

1

1 Answers

0
votes

I encountered an error very similar to this which brought me to this page. I was able to fix it by specifying parsnip::fit. If you are trying to utilize a different fit function then I would either specify the library in front of the function or use the conflicted package.