Building a classification model with recursive partitioning trees
In the previous recipe, we introduced how to use logistic regression to build a classification model. We now cover how to use a recursive partitioning tree to predict customer behavior. A classification tree uses split condition to predict class labels based on one or multiple input variables. The classification process starts from the root node of the tree; at each node, the process will check whether the input value should recursively continue to the right or left sub-branch according to the split condition, and stops when meeting any leaf (terminal) nodes of the decision tree. In this recipe, we introduce how to apply a recursive partitioning tree on the shopping cart dataset.
Getting ready
Download the house rental dataset from https://github.com/ywchiu/rcookbook/blob/master/chapter11/customer.csv first, and ensure you have installed R on your operating system.
How to do it…
Perform the following steps to build a classification...