what is the difference between using
1)randomForest(...)
2) train(...method = "rf"...)
what is the difference between using
1)randomForest(...)
2) train(...method = "rf"...)
I am assuming that you are referring to the randomForest()
function from the randomForest
package and train()
function from the caret
package.
The train()
function allows you to pre-process the data inside the function in addition to using different methods for your analysis just by making a change to the method =" "
.
For more details please read http://topepo.github.io/caret/model-training-and-tuning.html
The link gives details of what the train
function can do.
would the random forest be the same under both methods?
Yes.
caret
is more convenient though.
If you used the same tuning parameters, then yes. train
is designed to let you use the same code to fit different models and also to tune those models.
In this case, depending on how you call it, train
might not evaluate the value of mtry
that your call to randomForest
used. If that's the case, then the results would be different.
It might help if you read the paper on caret
. It's a bit old but will explain what the package is meant to do. There is also a ton of documentation that might help.
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.