Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

cuttype

Class: classregtree

Cut types

classregtree will be removed in a future release. See fitctree, fitrtree, ClassificationTree, or RegressionTree instead.

Syntax

c = cuttype(t)
c = cuttype(t,nodes)

Description

c = cuttype(t) returns an n-element cell array c indicating the type of cut at each node in the tree t, where n is the number of nodes. For each node i, c{i} is:

  • 'continuous' — If the cut is defined in the form x < v for a variable x and cut point v.

  • 'categorical' — If the cut is defined by whether a variable x takes a value in a set of categories.

  • '' — If i is a leaf node.

cutvar returns the cut points for 'continuous' cuts, and cutcategories returns the set of categories.

c = cuttype(t,nodes) takes a vector nodes of node numbers and returns the cut types for the specified nodes.

Examples

Create a classification tree for car data:

load carsmall

t = classregtree([MPG Cylinders],Origin,...
                 'names',{'MPG' 'Cyl'},'cat',2)
t = 
Decision tree for classification
 1  if Cyl=4 then node 2 elseif Cyl in {6 8} then node 3 else USA
 2  if MPG<31.5 then node 4 elseif MPG>=31.5 then node 5 else USA
 3  if Cyl=6 then node 6 elseif Cyl=8 then node 7 else USA
 4  if MPG<21.5 then node 8 elseif MPG>=21.5 then node 9 else USA
 5  if MPG<41 then node 10 elseif MPG>=41 then node 11 else Japan
 6  if MPG<17 then node 12 elseif MPG>=17 then node 13 else USA
 7  class = USA
 8  class = France
 9  class = USA
10  class = Japan
11  class = Germany
12  class = Germany
13  class = USA
view(t)

c = cuttype(t)
c = 
    'categorical'
    'continuous'
    'categorical'
    'continuous'
    'continuous'
    'continuous'
    ''
    ''
    ''
    ''
    ''
    ''
    ''

References

[1] Breiman, L., J. Friedman, R. Olshen, and C. Stone. Classification and Regression Trees. Boca Raton, FL: CRC Press, 1984.

Was this topic helpful?