public class TreeNode
extends java.lang.Object
Constructor and Description |
---|
TreeNode(TreeNode parent)
Default Constructor.
|
TreeNode(TreeNode parent,
int[] patterns)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
depth() |
double |
evaluate(double[] pattern,
boolean regression)
Given a instance, returns its class or regression value.
|
double |
getImpurities() |
TreeNode |
getLeftSon()
It gets the left son of the current node
|
int |
getOutputClass() |
double |
getOutputValue() |
TreeNode |
getParent()
It gets the parent of the current node
|
int[] |
getPatterns() |
TreeNode |
getRightSon() |
double |
getValue() |
int |
getVariable() |
boolean |
isTerminal() |
void |
setImpurities(double impurities) |
void |
setLeftSon(TreeNode leftSon) |
void |
setOutputClass(int outputClass) |
void |
setOutputValue(double outputValue) |
void |
setParent(TreeNode parent)
It sets the parent of the current node
|
void |
setPatterns(int[] patterns) |
void |
setRightSon(TreeNode rightSon) |
void |
setValue(double value) |
void |
setVariable(int variable) |
java.lang.String |
toString()
Returns a String representation of the node and its descendents.
|
public TreeNode(TreeNode parent)
parent
- parent node to be set to the new node.public TreeNode(TreeNode parent, int[] patterns)
parent
- parent node to be set to the new node.patterns
- Index of patterns in this nodepublic TreeNode getParent()
public void setParent(TreeNode parent)
parent
- to setpublic TreeNode getLeftSon()
public void setLeftSon(TreeNode leftSon)
leftSon
- son to setpublic TreeNode getRightSon()
public void setRightSon(TreeNode rightSon)
rightSon
- to setpublic int[] getPatterns()
public void setPatterns(int[] patterns)
patterns
- the patterns to setpublic int getVariable()
public void setVariable(int variable)
variable
- the variable to setpublic double getValue()
public void setValue(double value)
value
- the value to setpublic int getOutputClass()
public void setOutputClass(int outputClass)
outputClass
- the outputClass to setpublic double getOutputValue()
public void setOutputValue(double outputValue)
outputValue
- the outputValue to setpublic double getImpurities()
public void setImpurities(double impurities)
impurities
- the impurities to setpublic int depth()
public boolean isTerminal()
public double evaluate(double[] pattern, boolean regression)
pattern
- pattern to evaluateregression
- flag to determine whether it is a regression or classification problempublic java.lang.String toString()
toString
in class java.lang.Object