Last updated: Feb 11, 2025
The Classification and Regression (C&R) Tree node generates a decision
tree that allows you to predict or classify future observations. The method uses recursive
partitioning to split the training records into segments by minimizing the impurity at each step,
where a node in the tree is considered "pure" if 100% of cases in the node fall into a specific
category of the target field. Target and input fields can be numeric ranges or categorical (nominal,
ordinal, or flags); all splits are binary (only two subgroups).
Example
node = stream.createAt("cart", "My node", 200, 100)
# "Fields" tab
node.setPropertyValue("custom_fields", True)
node.setPropertyValue("target", "Drug")
node.setPropertyValue("inputs", ["Age", "BP", "Cholesterol"])
# "Build Options" tab, "Objective" panel
node.setPropertyValue("model_output_type", "InteractiveBuilder")
node.setPropertyValue("use_tree_directives", True)
node.setPropertyValue("tree_directives", """Grow Node Index 0 Children 1 2
Grow Node Index 2 Children 3 4""")
# "Build Options" tab, "Basics" panel
node.setPropertyValue("prune_tree", False)
node.setPropertyValue("use_std_err_rule", True)
node.setPropertyValue("std_err_multiplier", 3.0)
node.setPropertyValue("max_surrogates", 7)
# "Build Options" tab, "Stopping Rules" panel
node.setPropertyValue("use_percentage", True)
node.setPropertyValue("min_parent_records_pc", 5)
node.setPropertyValue("min_child_records_pc", 3)
# "Build Options" tab, "Advanced" panel
node.setPropertyValue("min_impurity", 0.0003)
node.setPropertyValue("impurity_measure", "Twoing")
# "Model Options" tab
node.setPropertyValue("use_model_name", True)
node.setPropertyValue("model_name", "Cart_Drug")
Properties |
Values | Property description |
---|---|---|
|
field | C&R Tree models require a single target and one or more input fields. A frequency field can also be specified. See the topic Common modeling node properties for more information. |
|
flag | |
|
|
is used for very large datasets, and requires
a Server connection. |
|
|
|
|
flag | |
|
string | Specify directives for growing the tree. Directives can be wrapped in triple quotes to avoid escaping newlines or quotes. Note that directives may be highly sensitive to minor changes in data or modeling options and may not generalize to other datasets. |
|
|
|
|
integer | Maximum
tree depth, from 0 to 1000. Used only if . |
|
flag | Prune tree to avoid overfitting. |
|
flag | Use maximum difference in risk (in Standard Errors). |
|
number | Maximum difference. |
|
number | Maximum surrogates. |
|
flag | |
|
number | |
|
number | |
|
number | |
|
number | |
|
flag | |
|
structured | Structured property. |
|
|
|
|
structured | Structured property. |
|
flag | |
|
number | Number of component models for boosting or bagging. |
|
|
Default combining rule for categorical targets. |
|
|
Default combining rule for continuous targets. |
|
flag | Apply boosting to very large data sets. |
|
number | |
|
|
|
|
number | Overfit prevention set. |
|
flag | Replicate results option. |
|
number | |
|
flag | |
|
flag | |
|
flag | |
|
|
Was the topic helpful?
0/1000