public class UCS
extends java.lang.Object
This class controls the UCS run. The core of UCS is a population of classifiers (pop). Moreover, it has a set of objects to implement the different operators and mechanisms: environments, GA, prediction array, etc.
Constructor and Description |
---|
UCS(java.lang.String configFile)
Initializes an UCS object.
|
Modifier and Type | Method and Description |
---|---|
int[] |
createAndInitArray(int N)
Creates and initializes an integer vector of size N
|
void |
doOneSingleStepExploit(double[] envState,
int classOfExample,
int tStamp,
int[] windowExecutionResults,
boolean isTest,
int typeOfTest,
boolean writeExpOut)
Performs one single step exploit.
|
void |
doOneSingleStepExplore(double[] envState,
int classOfExample,
int tStamp)
Performs one explore iteration.
|
void |
doOneTestExperiment(Environment tEnv,
int typeOfTest,
int[] globalResults,
boolean writeExpOut)
Performs a test experiment.
|
void |
doOneTrainExperiment(int[] globalResults)
Runs one train UCS experiment.
|
void |
doScreenStatistics(int tStamp,
int exploitNum,
int[] statisticVector,
int[] globalResults)
It computes the statistics
|
void |
doTestScreenStatistics(int tStamp,
int[] globalResults,
int numProblems)
It does test screen statistics
|
void |
finishUCS(long iTime)
It makes the last things to do after closing the program.
|
void |
print(java.io.BufferedReader r)
Does print the population and stops the execution.
|
void |
run()
It runs the system.
|
void |
startTrainUCS()
Runs one UCS train experiment.
|
public UCS(java.lang.String configFile)
Initializes an UCS object. It configures the UCS run reading the configuration file.
configFile
- is the name of the config file.public void run()
public void startTrainUCS()
public void doOneTrainExperiment(int[] globalResults)
globalResults
- contains the addition of all classified, not classified
and correct and wrong classified examples of the exploit executions in the train.public void doOneTestExperiment(Environment tEnv, int typeOfTest, int[] globalResults, boolean writeExpOut)
Performs a test experiment. It does not apply the covering operator, the GA and the update parameters routines. It only creates the match set and the prediction array, choosing the best action. If there are more than one action with the same probability, it chooses one of them randomly. For the moment, the examples are chosen sequentially from the environment if it's a file single step environment, to be sure that all the examples will participate in the test run.
tEnv
- is the environment to do the test. It can be the same or different from
the train environment.typeOfTest
- is a parameter that indicates the kind of test: testing with the test
set (0) or testing with the train set (1)globalResults
- contains the addition of all classified, not classified and correct
and wrong classified examples of the exploit executions in the train.writeExpOut
- determines is an output file with expected-real
output has to be writen.public void doOneSingleStepExplore(double[] envState, int classOfExample, int tStamp)
Performs one explore iteration. It applies the covering operator, the GA and the update parameters routines if it is necessary.
envState
- is the new example that has to be classified.classOfExample
- example class.tStamp
- is the current time stamp of the system. It is used to decide
if the GA has to be applied, and to create new classifiers.public void doOneSingleStepExploit(double[] envState, int classOfExample, int tStamp, int[] windowExecutionResults, boolean isTest, int typeOfTest, boolean writeExpOut)
Performs one single step exploit. It only chooses the best prediction from the prediction array (it is not stochastic)
envState
- is the new example that has to be classified.classOfExample
- example class.tStamp
- is the current time stamp of the system. It's used to
decide if the GA has to be applied, and to create new classifiers.windowExecutionResults
- is an array where the results are set
down to make statistics.typeOfTest
- indicates the test set kind (if is the test set (0) or the train
set (1) ) of the run.isTest
- determines if it is a test result or not.writeExpOut
- determines if an output file with expected-real
output has to be writen.public void doScreenStatistics(int tStamp, int exploitNum, int[] statisticVector, int[] globalResults)
It computes the statistics
tStamp
- is the time of the UCS.exploitNum
- is the number of exploits that UCS has made.statisticVector
- is the vector that contains all the statisticsglobalResults
- is a vector with the global results statistics.public void doTestScreenStatistics(int tStamp, int[] globalResults, int numProblems)
It does test screen statistics
tStamp
- is the system time.globalResults
- is the sum of all statistics done in the system.numProblems
- is the number of examples done in the run.public int[] createAndInitArray(int N)
N
- is the size of the vector that has to be createdpublic void finishUCS(long iTime)
It makes the last things to do after closing the program. It upgrades the times, print the last statistics and close all opened files.
iTime
- is the actual time.public void print(java.io.BufferedReader r)
r
- is the bufferedReader where to read.