public class Node
extends java.lang.Object
Constructor and Description |
---|
Node()
Creates a node with a base constructor that doesn't initialize the node structures
|
Node(myDataset data,
int id)
Creates a node from a complete dataset and its corresponding id.
|
Node(Node nod)
Creates a node from another existing node
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Checks if a node is the same node as another object
|
Split |
evaluateAllSplits()
Evaluates all splits and returns the best split found.
|
java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> |
getDecreasedNI()
Obtains a list of lists with n1,...
|
java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> |
getDecreasedNIV()
Obtains a list of lists with the k classes in decreasing order of ni - V(Si).
|
int |
getDifferentValuesAttributeI(int i)
Gets the number of different values for the ith attribute
|
int |
getIdentifier()
Gets the identifier of the node
|
int |
getMajorOutputClass()
Gets the output class of the majority of the instances.
|
int |
getNumClasses()
Gets the number of different classes in the node
|
int |
getNumItemsClassI(int i)
Gets the number of items that belongs to class i
|
int |
getNumRegisters()
Gets the number of different registers of data that there are in the node
|
int |
getOutputClass()
Gets the output class of the first register of the node.
|
int |
hashCode()
Hash-code function for the class that is used when object is inserted in a structure like a hashtable
|
boolean |
isPure()
Check is a node is pure or a node isn't pure
|
void |
setIdentifier(int identifier)
Replaces the identifier of the node with another new node
|
java.util.ArrayList<Node> |
split(Split best_split,
int last_new_node)
Splits a node into two nodes from a split following the identifier of a given number into an arraylist
of nodes.
|
java.lang.String |
toString()
Overriden function that converts the class to a string
|
double |
V(int k)
Calculates V for the data in this node with k class, in other words, this calculates the minimum
cost of specifying the split value at the parent of a node containing the data in this node
|
public Node()
public Node(myDataset data, int id)
data
- Dataset that has the data that is going to be stored in the nodeid
- Number identifying the node that is being createdpublic Node(Node nod)
nod
- Original node from which we are going to create a copypublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object that is checked to see if it is the same nodeObject.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean isPure()
public Split evaluateAllSplits()
public java.util.ArrayList<Node> split(Split best_split, int last_new_node)
best_split
- Split used in this node to divide the node into two new nodes left and rightlast_new_node
- Identifier of the last node created in the algorithmpublic int getIdentifier()
public void setIdentifier(int identifier)
identifier
- New identifier for the nodepublic int getOutputClass()
public int getNumRegisters()
public int getNumItemsClassI(int i)
i
- Class to which the items should belong to be consideredpublic int getDifferentValuesAttributeI(int i)
i
- Position of the attribute which differents values we are countingpublic int getMajorOutputClass()
public int getNumClasses()
public java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getDecreasedNI()
public java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getDecreasedNIV()
public double V(int k)
k
- class for calculating the V measure