dtree
DTREE constructor
Description
Examples
Create DTREE
Object
Create a tree of order 2 and depth 3.
x = 1:10; t = dtree(2,3,x)
Data Tree Object Structure =============================== Size of initial data :[1 10] Order :2 Depth :3 Terminal nodes :[7 8 9 10 11 12 13 14] ------------------------------------------
Use nodejoin
to recompose the second node.
t = nodejoin(t,2)
Data Tree Object Structure =============================== Size of initial data :[1 10] Order :2 Depth :3 Terminal nodes :[7 8 9 10 2] ------------------------------------------
Input Arguments
ord
— Order of the tree
2
(default) | integer ≥ 2
Order of the tree, specified as an integer greater than or equal to 2.
Data Types: double
d
— Depth of the tree
0
(default) | nonnegative integer
Depth of the tree, specified as a nonnegative integer.
Data Types: double
x
— Data
vector | matrix
Data, specified as a vector or matrix.
Data Types: double
u
— User data
{}
(default) | array | cell array | structure array
User data to set in the ud
field of
T
, specified as an array, cell array, or structure
array.
Example:
t = dtree(2,3,[0 1],{1,"aa",rand(3,3)})
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: t = dtree(order=2,depth=3)
specifies a tree of depth 3
and order 2.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: t = dtree("order",2,"depth",3)
specifies a tree of
depth 3 and order 2.
order
— Order of the tree
2
(default) | integer ≥ 2
Order of the tree, specified as an integer greater than or equal to 2.
depth
— Depth of the tree
0
(default) | nonnegative integer
Depth of the tree, specified as nonnegative integer.
data
— Data associated to the tree
vector | matrix
Data associated to the tree, specified as a vector or matrix.
spsch
— Split scheme for nodes
logical array
Split scheme for nodes, specified as an ord
-by-1
logical array.
The root of the tree can be split and it has ord
children. If spsch(j) = 1
, you can
split the jth child. Each node that you can split has
the same property as the root node.
ud
— User data field
{}
(default) | array | cell array | structure array
User data to set in the ud
field of
T
, specified as an array, cell array, or
structure array.
Output Arguments
T
— Tree
DTREE
object
Tree, returned as a DTREE
object. The tree has these
fields:
dtree | Parent object |
allNI | All nodes information |
terNI | Terminal nodes information |
For more information on object fields, type:
help dtree/get
nb
— Number of terminal nodes
integer
Number of terminal nodes (leaves) of T
.
Data Types: double
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)