Building a classification model with a conditional inference tree
In addition to traditional decision trees (rpart
), conditional inference trees (ctree
) are another popular tree-based classification method. Similar to traditional decision trees, conditional inference trees also recursively partition the data by performing a univariate split on the dependent variable. However, what makes conditional inference trees different from traditional decision trees is that conditional inference trees adapt the significance test procedures to select variables rather than selecting variables by maximizing information measures (rpart
employs a Gini coefficient). In this recipe, we will introduce how to adapt a conditional inference tree to build a classification model.
Getting ready
You need to have the first recipe completed by generating the training dataset, trainset
, and the testing dataset, testset
.
How to do it...
Perform the following steps to build the conditional inference tree:
- First, we use
ctree...