public class C45CS extends Algorithm
correct, log, modelDataset, modelFileName, resultFileName, startTime, testCorrect, testDataset, testFileName, testOutputFileName, trainDataset, trainFileName, trainOutputFileName
Constructor and Description |
---|
C45CS(java.lang.String paramFile)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double[] |
classificationForItemset(Itemset itemset)
Returns class probabilities for an itemset.
|
double |
evaluateItemset(Itemset itemset,
int index,
boolean isTrain)
Function to evaluate the class which the itemset must have
according to the classification of the tree.
|
void |
generateTree(Dataset itemsets)
Generates the tree.
|
double |
getTestAUC()
Calculates the AUC for the test set
|
double |
getTrainAUC()
Calculates the AUC for the training set
|
static void |
main(java.lang.String[] args)
Main function.
|
static int |
maxIndex(double[] doubles)
Returns index of maximum element in a given array of doubles.
|
static int |
minIndex(double[] doubles)
Returns index of minimum element in a given array of doubles.
|
void |
printResult()
Writes the tree and the results of the training and the test in the file.
|
void |
printTest()
Evaluates the test dataset and writes the results in the file.
|
void |
printTrain()
Evaluates the training dataset and writes the results in the file.
|
void |
priorsProbabilities()
Sets the class prior probabilities.
|
protected void |
setOptions(java.io.StreamTokenizer options)
Function to read the options from the execution file and assign the values to the parameters.
|
java.lang.String |
toString()
Function to print the tree.
|
getHeader, getNextToken, initTokenizer
public C45CS(java.lang.String paramFile) throws java.lang.Exception
paramFile
- The parameters file.java.lang.Exception
- If the algorithm cannot be executed.protected void setOptions(java.io.StreamTokenizer options) throws java.lang.Exception
setOptions
in class Algorithm
options
- The StreamTokenizer that reads the parameters file.java.lang.Exception
- If the format of the file is not correct.public void generateTree(Dataset itemsets) throws java.lang.Exception
itemsets
- The dataset used to build the tree.java.lang.Exception
- If the tree cannot be built.public double evaluateItemset(Itemset itemset, int index, boolean isTrain) throws java.lang.Exception
itemset
- The itemset to evaluate.index
- Position in the training or test set of the evaluated instanceisTrain
- It indicates if the current instance belongs to the training set or notjava.lang.Exception
- if the itemset can not be evaluated.public final double[] classificationForItemset(Itemset itemset) throws java.lang.Exception
itemset
- The itemset.java.lang.Exception
- If cannot compute the classification.public static int maxIndex(double[] doubles)
doubles
- The array of elements.public static int minIndex(double[] doubles)
doubles
- The array of elements.public void priorsProbabilities() throws java.lang.Exception
java.lang.Exception
- If cannot compute the probabilities.public void printResult() throws java.io.IOException
printResult
in class Algorithm
java.io.IOException
- If the file cannot be written.public void printTrain()
printTrain
in class Algorithm
public void printTest()
public java.lang.String toString()
toString
in class java.lang.Object
public double getTrainAUC()
public double getTestAUC()
public static void main(java.lang.String[] args)
args
- The parameters file.