public class Tree
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected float |
confidence
The confidence factor for pruning.
|
protected int |
covered
To check the number of itemsets it covers when is created
|
static int |
global
To compute the average attributes per rule
|
protected int |
id
To check the number of itemsets it covers when is created
|
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 |
NumberOfId
Number of Leafs currently created in the tree
|
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.
|
int |
classifyingLeaf(Itemset itemset)
Classifies the given item.
|
void |
collapse()
Function to collapse a tree to a node if training error doesn't increase.
|
int |
coveredSamples()
Returns the number of samples covered.
|
int |
getAttributesPerRule()
Function to compute the number of attributes of the tree
|
protected Tree |
getNewTree(Dataset data)
Function to create a new tree.
|
java.util.ArrayList<java.lang.Integer> |
leafsSize()
Returns the number of samples covered by each leaves.
|
void |
prune()
Function to prune a tree.
|
java.lang.String |
toString()
Function to print the tree.
|
public static int NumberOfNodes
public static int NumberOfLeafs
public static int NumberOfId
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 static int global
protected int covered
protected int id
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
public int getAttributesPerRule()
protected Tree getNewTree(Dataset data) throws java.lang.Exception
data
- The dataset.java.lang.Exception
- If the new tree cannot be created.public int coveredSamples()
public java.util.ArrayList<java.lang.Integer> leafsSize()
public int classifyingLeaf(Itemset itemset)
itemset
- given item to classify.