public class Tree extends Object implements Serializable, Cloneable
Constructor and Description |
---|
Tree(int nRows,
int minObsAllowedInChild,
int maxNumberOfCategories,
int maxNumberOfNodes,
int nClasses,
int nPreds,
PredictiveModel.VariableType varType,
int[] predNValues,
PredictiveModel.VariableType[] predType,
int nyMissing)
Creates the root node of a decision tree and contains information about
the relationship of child nodes.
|
Modifier and Type | Method and Description |
---|---|
protected Tree |
clone()
Returns a clone of this object.
|
TreeNode |
getNode(int i)
Returns a copy of the specified node of the decision tree.
|
TreeNode[] |
getNodes()
Returns nodes within a decision tree.
|
int |
getNumberOfClasses()
Returns the number of classes assumed by the response variable, if the
response variable is categorical.
|
int |
getNumberOfLevels()
Returns the number of levels or depth of a tree.
|
int |
getNumberOfNodes()
Returns the number of nodes (size of a tree).
|
int |
getNumberOfPredictors()
Returns the number of predictors used in the model.
|
int |
getNumberOfSurrogateSplits()
Returns the number of surrogate splits searched for at each tree node.
|
int[] |
getPredictorNumberOfValues()
Returns the number of distinct values of each predictor variable.
|
PredictiveModel.VariableType |
getPredictorType(int i)
Returns the
PredictiveModel.VariableType of a
predictor variable. |
PredictiveModel.VariableType |
getResponseType()
Returns the
PredictiveModel.VariableType of
the response variable. |
boolean[] |
getTerminalNodeIndicators()
Returns the terminal node indicator array.
|
boolean |
isTerminalNode(int i)
Returns the terminal node indicator of the node at the given index.
|
public Tree(int nRows, int minObsAllowedInChild, int maxNumberOfCategories, int maxNumberOfNodes, int nClasses, int nPreds, PredictiveModel.VariableType varType, int[] predNValues, PredictiveModel.VariableType[] predType, int nyMissing)
nRows
- an int
, the number of observations (rows) in
the input dataminObsAllowedInChild
- an int
, the number of
observations necessary in all potential child nodes before a node may be
splitmaxNumberOfCategories
- an int
, the maximum number of
categories allowed for categorical predictor variablesmaxNumberOfNodes
- an int
, the maximum number of nodes
allowed in the treenClasses
- an int
, the number of classes assumed by the
response variable, if the response variable is categoricalnPreds
- an int
, the number of predictors used in the
modelvarType
- a PredictiveModel.VariableType
array of length equal to the number of variables active in the model,
which is less than or equal to the available columns in the data,
(xy[i].length
)predNValues
- an int
array containing the number of
values of each predictor variablepredType
- a
PredictiveModel.VariableType
array of length
equal to the number of predictors containing the type of each predictor
variablenyMissing
- an int
equal to the number of missing
values in the response variablepublic TreeNode getNode(int i)
i
- an int
that specifies the index of a
TreeNode
to be returnedTreeNode
corresponding to the specified indexpublic boolean[] getTerminalNodeIndicators()
boolean
array indicating which nodes are terminal
nodes and which are not. If true
at index i
,
then the node at index i
is a terminal node.public TreeNode[] getNodes()
TreeNode
array containing a copy of the
TreeNode
s within the decision treepublic int getNumberOfClasses()
int
, the number of classes assumed by the
response variable, if the response variable is categoricalpublic int getNumberOfLevels()
int
specifying the number of levels or depth of a
treepublic int getNumberOfNodes()
int
, the number of nodes or size of the treepublic int getNumberOfPredictors()
int
, the number of predictors used in the modelpublic int getNumberOfSurrogateSplits()
Surrogate splits are relevant only for classes that implement the
com.imsl.datamining.decisionTree.DecisionTreeSurrogateMethod
interface.
int
, the number of surrogate splits searched for
at each nodepublic int[] getPredictorNumberOfValues()
For continuous predictor variables, the value is set to 0 and is not meaningful.
int
array containing the number of values of each
predictor variablepublic PredictiveModel.VariableType getPredictorType(int i)
PredictiveModel.VariableType
of a
predictor variable.i
- an int
, the index of the predictorVariableType
, the variable type of the predictor
at index i
public PredictiveModel.VariableType getResponseType()
PredictiveModel.VariableType
of
the response variable.PredictiveModel.VariableType
, indicates the
response variable typepublic boolean isTerminalNode(int i)
i
- an int
specifying the index of the nodeboolean
, that if true
, then the node
at index i
is a terminal nodeCopyright © 2020 Rogue Wave Software. All rights reserved.