public class Statistic
extends java.lang.Object
This class is used to show and configurate all the possible statistics. In the normal mode, it will generate four statistic output files: The INC file that contains the incremental results of the execution. The TRN and the TST file, that have the final result statistic of the a train o a test execution. And finally, it generates the PLT (population) file, that contains all the resulting classifiers of the execution. The statistics that will be written on that files are: iterations, number of good classifications, number of bad classifications, number of not covered classifications, total number of examples, percentage of correct classification of the covered examples, percentage of correct classifications of the whole number of examples, number of macro classifiers of the population, percentage of the optimal population that has been reached already, the percentage of generalitzation and the number of micro classifiers of the population.
Constructor and Description |
---|
Statistic(java.lang.String execKind,
java.lang.String baseName)
Creates an Statistic object.
|
Modifier and Type | Method and Description |
---|---|
void |
closeFiles()
Closes all the opened files.
|
void |
CVPrintStatistics(Population pop,
Population optimalPop,
int[] trainTestResults,
int trainNumber,
int[] testResults,
int testNumber,
TimeControl tControl)
Prints the statistics for a cross validation experiment.
|
void |
CVPrintTestStatistics(Population pop,
Population optimalPop,
int[] trainTestResults,
int trainNumber,
int[] testResults,
int testNumber,
TimeControl tControl)
It prints the statistics for a cross validation experiment, but
only for the testing execution.
|
void |
drawPopulation(Population pop)
It draws the population to a file.
|
void |
makeIncStatistics(Population pop,
Population optimalPop,
int iteration,
int[] executionResults,
double sysError)
It makes the incremental statistics.
|
void |
makeTestStatistics(Population pop,
Population optimalPop,
int iteration,
int[] executionResults)
It makes the test statistics.
|
void |
makeTimeStatistics(TimeControl tControl)
It makes the time statistics.
|
void |
makeTrainOrTestStatistics(java.io.PrintWriter f,
Population pop,
Population optimalPop,
int iteration,
int[] executionResults)
It makes the train statistics.
|
void |
makeTrainStatistics(Population pop,
Population optimalPop,
int iteration,
int[] executionResults)
It makes the train statistics.
|
void |
printPopulation(Population pop)
It writes the population to a file.
|
void |
printStateAndClass(double[] envState,
int action)
It prints the environmental state and the correct associated action.
|
void |
printStateAndClassNoCov(double[] envState,
int action)
It prints the environmental state and for those examples with no action.
|
void |
writeExpectedTestOut(int expected,
int current)
It writes to the test statistics file the expected out compared with the
output predicted by the system.
|
void |
writeExpectedTrainOut(int expected,
int current)
It writes to the train statistics file the expected out compared with the
output predicted by the system.
|
public Statistic(java.lang.String execKind, java.lang.String baseName)
Creates an Statistic object. It takes the name of the ouput files from the configuration file and opens them. If this parameter does not exist in the configuration file, it is not possible to perform statistics.
public void makeIncStatistics(Population pop, Population optimalPop, int iteration, int[] executionResults, double sysError)
It makes the incremental statistics. It will write incrementally the statistics mentioned above.
pop
- is the current population.iteration
- is the current iteration of the problem.executionResults
- is a vector that contains the results of
the window execution. In the first position it contains the number
of examples that have been correctly classified. In the second it
contains the number of failed classifications, and in the third one
the number of not covered classifications.public void makeTrainStatistics(Population pop, Population optimalPop, int iteration, int[] executionResults)
It makes the train statistics. It will write on a train statistics file the statistics mentioned above.
pop
- is the current population.iteration
- is the current iteration of the problemexecutionResults
- is a vector that contains the results of
the train execution. In the first position it contains the number
of examples that have been correctly classified. In the second it
contains the number of failed classifications, and in the third one
the number of not covered classifications.public void makeTestStatistics(Population pop, Population optimalPop, int iteration, int[] executionResults)
It makes the test statistics.
pop
- is the current population.iteration
- is the current iteration of the problemexecutionResults
- is a vector that contains the results of
the test execution. In the first position it contains the number
of examples that have been correctly classified. In the second it
contains the number of failed classifications, and in the third one
the number of not covered classifications.public void makeTrainOrTestStatistics(java.io.PrintWriter f, Population pop, Population optimalPop, int iteration, int[] executionResults)
It makes the train statistics.
pop
- is the current population.iteration
- is the current iteration of the problemexecutionResults
- is a vector that contains the results of
the test execution. In the first position it contains the number
of examples that have been correctly classified. In the second it
contains the number of failed classifications, and in the third one
the number of not covered classifications.f
- is a PrintWriter of the file where the results have to be
writen.public void makeTimeStatistics(TimeControl tControl)
It makes the time statistics. It will write into a file the time wasted in training and testing the system, and the reduction algorithms time.
tControl
- is a TimeControl object that contains the times
wasted in each category
public void printPopulation(Population pop)
pop
- is the current population.public void drawPopulation(Population pop)
It draws the population to a file. A character allele is drawn as 1 o 0. Otherwise, a real allele is drawn in ten points, that represent the interval [0..1] divided in ten fragments. In each fragment, there are three types of symbols: . --> The fragment is not covered by the classifier. o --> The fragment is partially covered by the classifier. O --> The fragment is totally covered by the classifier. This notation has been obtained from Wilson2000 XCSR
pop
- is the current population.
public void CVPrintStatistics(Population pop, Population optimalPop, int[] trainTestResults, int trainNumber, int[] testResults, int testNumber, TimeControl tControl)
Prints the statistics for a cross validation experiment.
pop
- is the final population of the cross validationoptimalPop
- is the optimal pop (if known)trainTestResults
- is the results of the test made with
the trainig set.trainNumber
- is the number of trains that have been madetestResults
- is the results fo the test made with the
test settestNumber
- is the number of tests examples that have been
triedtControl
- is a time control object that contains the time
wasted in each part of the execution.public void CVPrintTestStatistics(Population pop, Population optimalPop, int[] trainTestResults, int trainNumber, int[] testResults, int testNumber, TimeControl tControl)
It prints the statistics for a cross validation experiment, but only for the testing execution.
pop
- is the final population of the cross validationoptimalPop
- is the optimal pop (if known)trainTestResults
- is the results of the test made with
the trainig set.trainNumber
- is the number of trains that have been madetestResults
- is the results fo the test made with the
test settestNumber
- is the number of tests examples that have been
triedtControl
- is a time control object that contains the time
wasted in each part of the execution.public void printStateAndClass(double[] envState, int action)
It prints the environmental state and the correct associated action. It is only used in test experiments.
envState
- is the environmental state.
action
- is the correct action associated to that state.
public void printStateAndClassNoCov(double[] envState, int action)
It prints the environmental state and for those examples with no action. It's used only in test experiments.
envState
- is the environmental state.action
- is the correct action associated to that state.public void writeExpectedTrainOut(int expected, int current)
It writes to the train statistics file the expected out compared with the output predicted by the system.
expected
- the expected ouptutcurrent
- the current output (the real one)public void writeExpectedTestOut(int expected, int current)
It writes to the test statistics file the expected out compared with the output predicted by the system.
expected
- the expected ouptutcurrent
- the current output (the real one)public void closeFiles()
Closes all the opened files.