5

I'm working on a project and I need to be able to make some decision trees based on a dataset I've imported into R. Using the rpart package, I'd like to be able to create a pair of decision trees, one using the gini split criteria and the other using the entropy split criteria. I'd also like to be able to adjust the maximum tree depth if possible. Does anybody know how to do this? I'd greatly appreciate any help!

1

1 Answer 1

10

According to the R manual here, rpart() can be set to use the gini or information (i.e. entropy) split using the parameter:

parms = list(split = "gini"))

or

parms = list(split = "information"))

... respectively.

You can also add parameters for rpart.control (see here) including maxdepth, for which the default is 30.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.