public class SLIQ extends Algorithm
correct, log, modelDataset, modelFileName, resultFileName, startTime, testCorrect, testDataset, testFileName, testOutputFileName, trainDataset, trainFileName, trainOutputFileName
Constructor and Description |
---|
SLIQ(java.lang.String paramFile)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
agregaDatos(Node padre,
Node hijo)
Aggregates the data of the given child that will be pruned into the father given.
|
protected void |
aplicaMejorCorte(Node nodo)
Método que aplica en un nodo el mejor corte obtenido previamente
Apply the best cut fouded to divide the given node.
|
protected void |
aplicaMejorCorteContinuo(Node nodo)
Divides the node in the more optimal way possible (Continuous attribute).
|
protected void |
aplicaMejorCorteDiscreto(Node nodo)
Divides the node in the more optimal way possible (Discrete attribute).
|
protected void |
calculaMejorCorte(int indAtributo,
Node nodo)
Computes the best cut of the given attribute for the given node.
|
void |
cuentaNodosHojas(Node node)
Counts the number of nodes pending from the given node.
|
int |
evaluateItemset(Itemset itemset,
Node node)
Returns the predicted class of the given example obtained from the given node.
|
protected void |
generaListas()
Constructs the lists of attriibutes and classes used during SLIQ execution.
|
void |
generateTree()
Generates the tree with the SLIQ algorithm.
|
static void |
main(java.lang.String[] args)
Main function.
|
protected void |
podaArbol()
Prunes the tree.
|
protected void |
podaNodoCompleto(Node padre)
Prunes the node given as parameter, deleting its children.
|
protected void |
podaNodoParcial(Node padre,
int indHijo)
Prunes the node given as parameter, deleting the given child.
|
void |
printResult()
Writes the statistical measurements obtained on the output file.
|
void |
printTest()
Evaluates the test dataset and writes the results on the output file.
|
void |
printTrain()
Evaluates the training dataset and writes the results on the output file.
|
protected void |
setOptions(java.io.StreamTokenizer options)
Reads the parameters used by the algorith.
|
getHeader, initTokenizer
public SLIQ(java.lang.String paramFile)
paramFile
- parameters file.protected void generaListas()
public void generateTree()
protected void podaArbol()
protected void podaNodoCompleto(Node padre)
padre
- given node to be pruned.protected void podaNodoParcial(Node padre, int indHijo)
padre
- given father to be pruned.indHijo
- given child index to delete.protected void agregaDatos(Node padre, Node hijo)
padre
- Father node.hijo
- Child node.protected void calculaMejorCorte(int indAtributo, Node nodo)
indAtributo
- Attribute index.nodo
- Node to be divided.protected void aplicaMejorCorte(Node nodo)
nodo
- node to be divided.protected void aplicaMejorCorteDiscreto(Node nodo)
nodo
- node to be divided.protected void aplicaMejorCorteContinuo(Node nodo)
nodo
- node to be divided.public int evaluateItemset(Itemset itemset, Node node)
itemset
- given example.node
- given node.public void cuentaNodosHojas(Node node)
node
- given node.public void printResult() throws java.io.IOException
printResult
in class Algorithm
java.io.IOException
- if the file can not be written.public void printTrain()
printTrain
in class Algorithm
public void printTest()
protected void setOptions(java.io.StreamTokenizer options) throws java.lang.Exception
setOptions
in class Algorithm
options
- StreamTokenizer used to read the different parametersjava.lang.Exception
- if the input file format is wrong.public static void main(java.lang.String[] args)
args
- Arguments of the program (a configuration script, generally)