Tuning a Classification Tree
Build on cross-validation by learning to tune a CART classification decision tree using tidymodels.
We'll cover the following...
Preparing the data
The following code prepares the Titanic training data as part of a tidymodels workflow.
Configuring the model for tuning
The parsnip package supports a variety of methods for tuning tidymodels workflow for hyperparameter tuning occurs when the algorithm is specified. The parsnip package’s decision_tree() function supports tuning of the following hyperparameters:
cost_complexity: A positive number for the cost/complexity parameter (akacp) used by therpartpackage.tree_depth: A positive integer for the maximum depth of the tree.min_n: A positive integer for the minimum number of data points in a node required for the node to be split further. This corresponds to ...