public class Tree
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected float |
confidence
The confidence factor for pruning.
|
protected boolean |
isEmpty
Is this node empty or not.
|
protected boolean |
isLeaf
Is this node leaf or not.
|
protected SelectCut |
model
The selected model.
|
protected Cut |
nodeModel
The model of the node.
|
static int |
NumberOfLeafs
Number of Leafs in the tree
|
static int |
NumberOfNodes
Total number of Nodes in the tree
|
protected boolean |
prune
Is pruned the tree or not.
|
protected Tree[] |
sons
Sons of the node.
|
protected Dataset |
train
The dataset.
|
Constructor and Description |
---|
Tree(SelectCut selectNodeModel,
boolean pruneTree,
float cf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
buildNode(Dataset data)
Adds one new node.
|
void |
buildTree(Dataset data)
Function to build the classifier tree.
|
double[] |
classificationForItemset(Itemset itemset)
Function to get the classification of classes.
|
void |
collapse()
Function to collapse a tree to a node if training error doesn't increase.
|
protected Tree |
getNewTree(Dataset data)
Function to create a new tree.
|
void |
prune()
Function to prune a tree.
|
java.lang.String |
toString()
Function to print the tree.
|
public static int NumberOfNodes
public static int NumberOfLeafs
protected SelectCut model
protected Cut nodeModel
protected Tree[] sons
protected boolean isLeaf
protected boolean isEmpty
protected Dataset train
protected boolean prune
protected float confidence
public Tree(SelectCut selectNodeModel, boolean pruneTree, float cf)
selectNodeModel
- The cut model.pruneTree
- Prune the tree or not.cf
- Minimum confidence.public void buildNode(Dataset data) throws java.lang.Exception
data
- The dataset.java.lang.Exception
- If the node cannot be built.public void buildTree(Dataset data) throws java.lang.Exception
data
- The dataset.java.lang.Exception
- If the tree cannot be built.public final void collapse()
public void prune() throws java.lang.Exception
java.lang.Exception
- If the prune cannot be made.public final double[] classificationForItemset(Itemset itemset) throws java.lang.Exception
itemset
- The itemset to classify.java.lang.Exception
- If the probabilities cannot be computed.public java.lang.String toString()
toString
in class java.lang.Object