public class Parameters
extends java.lang.Object
In this class there are all the classifier parameters of XCS.
Constructor and Description |
---|
Parameters()
Constructs a Parameters Object.
|
Parameters(int tStamp,
double size,
double gen)
It creates an instance of Parameters.
|
Parameters(Parameters p,
int tStamp)
Copy constructor
Constructs a Parameters Object initializing its attributes from another Parameters object.
|
Parameters(Parameters p1,
Parameters p2,
int tStamp)
It creates a new parameter object making a crossover between the
parents parametres.
|
Parameters(java.util.StringTokenizer t)
Constructs a Parameters Object initializing its attributes
|
Modifier and Type | Method and Description |
---|---|
void |
addUsefulTimes(int num)
Adds the given value to the usefulTimes parameter of
the classifier
|
boolean |
couldComp()
Indicates if the classifier is accurate and experienced enough
to not be removed from the population
|
boolean |
couldReduce(double maxReward)
Indicates if the classifier is experienced,
and accurate enough to be in the reduction set.
|
boolean |
couldSubsume()
Indicates if the classifier can subsume.
|
double |
deletionVote(double avFitness)
Returns the probability of a classifier to be deleted.
|
double |
getAccuracy()
Returns the accuracy of the classifier.
|
double |
getASize()
Returns the estimated action set size.
|
int |
getCompTime()
Returns the time of the classifier.
|
int |
getExperience()
Returns the experience of the classifier.
|
double |
getFitness()
Returns the fitness of the current classifier.
|
double |
getGenerality()
Gets the generality of the classifier.
|
int |
getNumberMatches()
Gets the number of matches of the classifier.
|
int |
getNumerosity()
Returns the numerosity of the classifier.
|
double |
getPredError()
Returns the prediction error of the classifier.
|
double |
getPrediction()
Returns the prediction of the classifier.
|
int |
getTime()
Returns the time of the classifier.
|
boolean |
getUseful()
Gets the useful parameter of the classifier.
|
int |
getUsefulTimes()
Returns the useful time parameter of the classifier
|
void |
increaseNumberMatches(int num)
Increases the number of matches
|
void |
increaseNumerosity(int num)
Increases the numerosity of the classifier.
|
void |
print()
Prints the classifier into standard output.
|
void |
print(java.io.PrintWriter fout)
Prints the classifier to the specified file.
|
void |
setASize(double size)
Sets the classifier action set size estimate
|
void |
setCompTime(int sTime)
Sets the time stamp for this classifier.
|
void |
setExperience(int expCl)
Sets the experience of the classifier.
|
void |
setFitness(double fit)
Sets the fitness of the classifier.
|
void |
setGenerality(double general)
Sets the generality of the classifier.
|
void |
setNumberMatches(int num)
Sets the number of matches
|
void |
setNumerosity(int num)
Sets the numerosity of the classifier
|
void |
setPredError(double predErr)
Sets the prediction error
|
void |
setPrediction(double pred)
Sets the prediction value.
|
void |
setTime(int sTime)
Sets the time stamp for this classifier.
|
void |
setUseful(boolean value)
Sets the useful parameter
|
void |
setUsefulTimes(int value)
Sets the usefulTimes parameter
|
void |
updateFitness(double kSum,
double k)
Updates the fitness of a classifier
|
void |
updateParameters(double P,
double microClSum)
Updates the parameters of a classifier (reinforcement component)
|
public Parameters()
Constructs a Parameters Object.
public Parameters(int tStamp, double size, double gen)
It creates an instance of Parameters. It is used in covering
tStamp
- is the current time of the system.size
- is the action set sizegen
- is the generality of the classifier.public Parameters(Parameters p1, Parameters p2, int tStamp)
It creates a new parameter object making a crossover between the parents parametres.
p1
- is the object that contain the parameters for the
first parent.p2
- is the object that contain the parameters for the
second parent.tStamp
- is the current time stamp.public Parameters(Parameters p, int tStamp)
Copy constructor Constructs a Parameters Object initializing its attributes from another Parameters object.
p
- is the origin of the copy.tStamp
- time stamp.public Parameters(java.util.StringTokenizer t)
Constructs a Parameters Object initializing its attributes
t
- contains the information to initialize the parameters object.public void updateParameters(double P, double microClSum)
Updates the parameters of a classifier (reinforcement component)
P
- is the payoff of the current iteration (P = reward + gamma * maxPrediction)microClSum
- is the numerosity of the action set (all the action set.).public void updateFitness(double kSum, double k)
Updates the fitness of a classifier
kSum
- is the sum of all accuracies.k
- is the accuracy of the classifier.public double getAccuracy()
Returns the accuracy of the classifier.
public double getASize()
Returns the estimated action set size.
public int getExperience()
Returns the experience of the classifier.
public int getNumerosity()
Returns the numerosity of the classifier.
public double getFitness()
Returns the fitness of the current classifier.
public double getPrediction()
Returns the prediction of the classifier.
public double getPredError()
Returns the prediction error of the classifier.
public int getTime()
Returns the time of the classifier.
public int getCompTime()
Returns the time of the classifier. The difference between timeOfCl and tComp is that the last one is used to the "new reduction" algorithm, while "timeOfCl" is the usual time stamp of XCS
public double getGenerality()
Gets the generality of the classifier.
public int getNumberMatches()
Gets the number of matches of the classifier.
public boolean getUseful()
Gets the useful parameter of the classifier.
public int getUsefulTimes()
Returns the useful time parameter of the classifier
public void setFitness(double fit)
Sets the fitness of the classifier.
fit
- is the fitness that has to be set.public void setPrediction(double pred)
Sets the prediction value.
pred
- is the prediction to be setpublic void setPredError(double predErr)
Sets the prediction error
predErr
- is the prediction error value.public void setTime(int sTime)
Sets the time stamp for this classifier.
sTime
- is the time stamppublic void setCompTime(int sTime)
Sets the time stamp for this classifier.
sTime
- is the time stamppublic void setASize(double size)
Sets the classifier action set size estimate
size
- is the estimate of the action set sizepublic void setExperience(int expCl)
Sets the experience of the classifier.
expCl
- is the experience of the classifier.public void setNumerosity(int num)
Sets the numerosity of the classifier
num
- is the numerosity of the classifier.public void setGenerality(double general)
Sets the generality of the classifier.
general
- is the generality that has to be set to the classifier.
public void setNumberMatches(int num)
Sets the number of matches
num
- is the number of matches to set.public void setUseful(boolean value)
Sets the useful parameter
value
- is the value that the useful param has to be set.public void setUsefulTimes(int value)
Sets the usefulTimes parameter
value
- is the value that the usefulTimes param has to be set.public void increaseNumberMatches(int num)
Increases the number of matches
num
- is the number of matches to increase.public void increaseNumerosity(int num)
Increases the numerosity of the classifier.
num
- number to increase.public double deletionVote(double avFitness)
Returns the probability of a classifier to be deleted.
avFitness
- is the average fitness of the set.public boolean couldSubsume()
Indicates if the classifier can subsume. The classifier has to be sufficiently accurate and sufficiently experienced to subsume another classifier.
public boolean couldReduce(double maxReward)
Indicates if the classifier is experienced, and accurate enough to be in the reduction set. Otherwise, the classifier will not be included in the reduction
maxReward
- is the maximum reward of the environment.public boolean couldComp()
public void addUsefulTimes(int num)
num
- is the value that has to be addedpublic void print(java.io.PrintWriter fout)
Prints the classifier to the specified file.
fout
- is the file output where the parameters have to be printed.public void print()