Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is rpart automatic pruning?

Tags:

r

rpart

pruning

Is rpart automatic pruning?

The decision tree produced by rpart is much more levels than that produced by Oracle Data Mining which has the automatic pruning.

like image 295
Jack Han Avatar asked Oct 30 '12 10:10

Jack Han


People also ask

Does rpart automatically prune?

No, but the defaults for the fitting function may stop splitting "early" (for some definition of "early").

Does rpart prune tree?

Syntax : printcp ( x ) where x is the rpart object. This function provides the optimal prunings based on the cp value. We prune the tree to avoid any overfitting of the data.

How does rpart work in R?

The rpart algorithm works by splitting the dataset recursively, which means that the subsets that arise from a split are further split until a predetermined termination criterion is reached.

What does rpart package do?

Rpart is a powerful machine learning library in R that is used for building classification and regression trees. This library implements recursive partitioning and is very easy to use.


1 Answers

No, but the defaults for the fitting function may stop splitting "early" (for some definition of "early").

See ?rpart.control for the parameters you can tweak. In particular, see the argument minsplit and minbucket in that help file. These are stopping rules that will prevent any node being split if those conditions are not met.

You will most likely need to prune the tree back using prune() to some optimal value of the cost-complexity parameter.

like image 82
Gavin Simpson Avatar answered Sep 19 '22 00:09

Gavin Simpson