I am using RandomForestSRC to create a random forest model using regression, and I want to perform a gridsearch on the optimal mtry, nodesize, ntrees, nodedepth in combination in order to better visualize the optimization process.
I have tried the following:
mtry <- c(4,8,16) nodesize <- c(50,150,300) ntrees <- c(500,1000,2000) nodedepth <- c(5,10) frmodel <- rfsrc(mort_30 ~ variable1+variable2+variable3, #(ect) data= data.train, mtry= mtry, nodesize= nodesize, ntrees=ntrees, nodedepth=nodedepth, blocksize=1, importance=TRUE, seed=40)
But I keep getting this error:
I if (mtry < 1 | mtry >n.xvar) mtry <- max(1, min(mtry, n.xvar)): the condition has length > 1 and only the first element will be used
It seems I wont be able to assign more than one value to these. Is there another way to do this, short of manually making a tree for every single combination?