I would like to run an unbiased cforest using the caret package. Is this possible?
tc <- trainControl(method="cv",
number=f,
index=indexList,
savePredictions=T,
classProbs = TRUE,
summaryFunction = twoClassSummary)
createCfGrid <- function(len, data) {
g = createGrid("cforest", len, data)
g = expand.grid(.controls = cforest_unbiased(mtry = 5, ntree = 1000))
return(g)
}
set.seed(1)
(cfMatFit <- train(as.factor(f1win) ~ .,
data=df,
method="cforest",
metric="ROC",
trControl=tc,
tuneGrid = createCfGrid))
The error is Error in as.character.default(<S4 object of class "ForestControl">) :
no method for coercing this S4 class to a vector
This is because cforest_control() can not be coerced into a data frame. The function does work if I use:
...
g = expand.grid(.mtry = 5)
...
However if I want to change ntree, this has no effect:
...
g = expand.grid(.mtry = 5, .ntree = 1000)
...
This does not error like randomForest does.