I have been testing conditional trees and random forests with caret, and I've noticed it does something weird with factors.
So, for example, a ctree using the base dataset chickwts
:
# Via 'party'
ctreeNC = ctree(weight ~ feed, data=chickwts)
plot(ctreeNC, type="simple")
# Via 'caret'
ctreeCARET <- train(weight ~ feed, data = chickwts, method = "ctree")
plot(ctreeCARET$finalModel, type = "simple")
And with random forest:
# Via 'randomForest'
rfNOCARET <- randomForest(weight ~ feed, data=chickwts)
>importance(rfNOCARET)
IncNodePurity
feed 242589
# Via 'caret'
rfCARET <- train(weight ~ feed, method = "rf", data = chickwts)
>varImp(rfCARET)
IncNodePurity
feedhorsebean 120992.97
feedlinseed 50673.75
feedmeatmeal 15688.51
feedsoybean 32652.89
feedsunflower 23308.30
I read that train only accepted numerical values (in 2008), but I'm not sure if this has changed by now. Any insights?