public class Tree
extends java.lang.Object
implements java.lang.Comparable
Title: Tree
Description: It contains the implementation of the tree structure
Company: KEEL
Modifier and Type | Field and Description |
---|---|
static int |
bienCubiertos
Number of correct classified examples.
|
static int[][] |
ejemplos
Number of examples for each leaf/class
|
static int |
maxNodos
Maximum number of nodes.
|
static int |
nodos
Number of Leafs in the tree
|
static int |
nodosT
Number of Leafs in the tree
|
Constructor and Description |
---|
Tree()
Default Constructor.
|
Tree(Tree pae,
myDataset train,
double pSplit,
boolean primero,
double prob1,
double prob2)
Paramenter constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
clasificar(double[] ejemplo)
Classifies a given example, returning the predicted class.
|
int |
compareTo(java.lang.Object a) |
Tree |
copia(Tree padre)
Returns a copy of the tree with the given father set.
|
int |
elijeNodo()
Chooses randomly a node.
|
double |
evaluar()
Computes the fitness for the tree.
|
double |
evaluar2()
Computes the fitness for the tree.
|
void |
nodeSwap(int nodoYo,
int nodoPadre,
Tree padre)
Swaps the two nodes given with the given tree.
|
java.lang.String |
printString()
Returns a String representation of the tree.
|
void |
splitRule(int nodo)
Splits the rule of the given node.
|
void |
splitSet(int nodo)
Splits the given node.
|
void |
treeSwap(int nodoYo,
int nodoPadre,
Tree padre)
Swaps the two trees given with the given tree.
|
public static int nodosT
public static int nodos
public static int maxNodos
public static int bienCubiertos
public static int[][] ejemplos
public Tree()
public Tree(Tree pae, myDataset train, double pSplit, boolean primero, double prob1, double prob2)
pae
- Father Tree.train
- Training dataset.pSplit
- Split probability.primero
- Root identifier.prob1
- First probability used to grow the tree.prob2
- Second probability used to grow the tree.public Tree copia(Tree padre)
padre
- father to be set to the copy.public java.lang.String printString()
public int elijeNodo()
public double evaluar()
public double evaluar2()
public void nodeSwap(int nodoYo, int nodoPadre, Tree padre)
nodoYo
- node index of this tree to swap.nodoPadre
- node index of the given tree to swap.padre
- given tree.public void treeSwap(int nodoYo, int nodoPadre, Tree padre)
nodoYo
- node index of this tree to swap.nodoPadre
- node index of the given tree to swap.padre
- given tree.public void splitSet(int nodo)
nodo
- given node.public void splitRule(int nodo)
nodo
- given node.public java.lang.String clasificar(double[] ejemplo)
ejemplo
- given example.public int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable