0

I would like to add 2 hyper parameters to my ctree model. Here is the code that runs:

library(party)
dat1 <- fread('https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data',stringsAsFactors=T)

## split data to train and test
set.seed(123)
dat1 <- subset(dat1, !is.na(V1))
smp_size<-100
train_ind <- sample(seq_len(nrow(dat1)), size = smp_size)
train <- dat1[train_ind, ]
test <- dat1[-train_ind, ]

ct2 <- ctree(V1 ~ ., data = train,controls = ctree_control(mtry = 2 ))

I works.

Now, I would like to add the parameters: minprob and ntree. Here is the code:

ct2 <- ctree(V1 ~ ., data = train,controls = ctree_control(mtry = 2,ntree = 500,minprob =0.1 ))

And I get error:

Error in ctree_control(mtry = 2, ntree = 500, minprob = 0.1) : 
  unused arguments (ntree = 500, minprob = 0.1)
Avi
  • 2,247
  • 4
  • 30
  • 52
  • 1
    See here pp. 3:https://cran.r-project.org/web/packages/partykit/partykit.pdf – Avi Nov 28 '18 at 15:40
  • Yes but that seems to be related to the `cforest` function not `ctree`, and that does make sense because `ntree` is when you have a forest, `ctree` to my knowledge is just one decision tree. Pardon me if I'm mistaken anyway. – RLave Nov 28 '18 at 15:45
  • The randomforest is ctree or cforest? – Avi Nov 28 '18 at 15:46
  • `cforest` as the name suggest. – RLave Nov 28 '18 at 15:46

0 Answers0