修剪
Class:分类树
Produce sequence of classification subtrees by pruning
Syntax
tree1 = prune(tree)
tree1 = prune(tree,Name,Value)
Description
creates a copy of the classification treetree1
=修剪(tree
)tree
with its optimal pruning sequence filled in.
creates a pruned tree with additional options specified by onetree1
=修剪(tree
,Name,Value
)Name,Value
pair argument. You can specify several name-value pair arguments in any order asName1,Value1,…,NameN,ValueN
.
Input Arguments
|
创建的分类树 |
Name-Value Arguments
将可选的参数对Name1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and encloseName
in quotes.
|
A numeric scalar. |
|
A numeric scalar from |
|
A numeric vector with elements from |
Output Arguments
|
A classification tree. |
Examples
Tips
tree1 = prune(tree)
returns the decision treetree1
that is the full, unprunedtree
, but with optimal pruning information added. This is useful only if you createdtree
by pruning another tree, or by using thefitctree
function with pruning set'off'
. If you plan to prune a tree multiple times along the optimal pruning sequence, it is more efficient to create the optimal pruning sequence first.