|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--XClassifier
Each instance of this class represents one classifier. The class provides different constructors for generating
Field Summary | |
private int |
action
The action of this classifier. |
private double |
actionSetSize
The action set size estimate of the classifier. |
private java.lang.String |
condition
The condition of this classifier. |
private static XCSConstants |
cons
An instance of the learning parameters in XCSJava. |
private int |
experience
The experience of the classifier. |
private double |
fitness
The fitness of the classifier in terms of the macro-classifier. |
private int |
numerosity
The numerosity of the classifier. |
private double |
prediction
The reward prediction value of this classifier. |
private double |
predictionError
The reward prediction error of this classifier. |
private int |
timeStamp
The time the last GA application took place in this classifier. |
Constructor Summary | |
XClassifier(double setSize,
int time,
int condLength,
int numberOfActions)
Construct a classifier with random condition and random action. |
|
XClassifier(double setSize,
int time,
int numberOfActions,
java.lang.String situation)
Construct matching classifier with random action. |
|
XClassifier(double setSize,
int time,
java.lang.String situation,
int act)
Constructs a classifier with matching condition and specified action. |
|
XClassifier(XClassifier clOld)
Constructs an identical XClassifier. |
Method Summary | |
void |
addNumerosity(int num)
Adds to the numerosity of the classifier. |
boolean |
applyMutation(java.lang.String state,
int numberOfActions)
Applies a niche mutation to the classifier. |
private void |
classifierSetVariables(double setSize,
int time)
Sets the initial variables of a new classifier. |
private void |
createMatchingCondition(java.lang.String cond)
Creates a matching condition considering the constant P_dontcare<\code>. |
private void |
createRandomAction(int numberOfActions)
Creates a random action. |
private void |
createRandomCondition(int condLength)
Creates a condition randomly considering the constant P_dontcare<\code>. |
boolean |
equals(XClassifier cl)
Returns if the two classifiers are identical in condition and action. |
double |
getAccuracy()
Returns the accuracy of the classifier. |
int |
getAction()
Returns the action of the classifier. |
double |
getActionSetSize()
Returns the size of the action set |
java.lang.String |
getCondition()
Returns the condition part of the classifier |
double |
getDelProp(double meanFitness)
Returns the vote for deletion of the classifier. |
double |
getDelProp(double meanFitness,
double meanPrediction)
Returns the vote for deletion of the classifier (second method). |
int |
getExperience()
Returns the age of the classifier |
double |
getFitness()
Returns the fitness of the classifier. |
int |
getNumerosity()
Returns the numerosity of the classifier. |
double |
getPrediction()
Returns the prediction of the classifier. |
double |
getPredictionError()
Returns the prediction error of the classifier. |
int |
getTimeStamp()
Returns the time stamp of the classifier. |
void |
increaseExperience()
Increases the Experience of the classifier by one. |
boolean |
isMoreGeneral(XClassifier cl)
Returns if the classifier is more general than cl. |
boolean |
isSubsumer()
Returns if the classifier is a possible subsumer. |
boolean |
match(java.lang.String state)
Returns if the classifier matches in the current situation. |
private boolean |
mutateAction(int numberOfActions)
Mutates the action of the classifier. |
private boolean |
mutateCondition(java.lang.String state)
Mutates the condition of the classifier. |
void |
printXClassifier()
Prints the classifier to the control panel. |
void |
printXClassifier(java.io.PrintWriter pW)
Prints the classifier to the print writer (normally referencing a file). |
void |
setActionSetSize(int as)
Sets the size of the action set |
void |
setExperience(int exp)
Sets the experience of the classifier |
void |
setFitness(double fit)
Sets the fitness of the classifier. |
void |
setNumerosity(int nm)
Sets the numerosity of the classifier |
void |
setPrediction(double pre)
Sets the prediction of the classifier. |
void |
setPredictionError(double preE)
Sets the prediction error of the classifier. |
void |
setTimeStamp(int ts)
Sets the time stamp of the classifier. |
boolean |
subsumes(XClassifier cl)
Returns if the classifier subsumes cl. |
boolean |
test(java.lang.String question)
test if a given classifier can match as an answer to the question posed. |
boolean |
twoPointCrossover(XClassifier cl)
Applies two point crossover and returns if the classifiers changed. |
double |
updateActionSetSize(double numerositySum)
Updates the action set size. |
double |
updateFitness(double accSum,
double accuracy)
Updates the fitness of the classifier according to the relative accuracy. |
double |
updatePrediction(double P)
Updates the prediction of the classifier according to P. |
double |
updatePreError(double P)
Updates the prediction error of the classifier according to P. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String condition
private int action
private double prediction
private double predictionError
private double fitness
private int numerosity
private int experience
private double actionSetSize
private int timeStamp
private static XCSConstants cons
Constructor Detail |
public XClassifier(double setSize, int time, java.lang.String situation, int act)
setSize
- The size of the current set which the new classifier matches.time
- The actual number of instances the XCS learned from so far.situation
- The current problem instance/perception.act
- The action of the new classifier.createMatchingCondition(String)
,
classifierSetVariables(double, int)
public XClassifier(double setSize, int time, int numberOfActions, java.lang.String situation)
setSize
- The size of the current set which the new classifier matches.time
- The actual number of instances the XCS learned from so far.numberOfActions
- The number of different actions to chose from
(This should be set to the number of actions possible in the problem).situation
- The current problem instance/perception.createMatchingCondition(String)
,
createRandomAction(int)
,
classifierSetVariables(double, int)
public XClassifier(double setSize, int time, int condLength, int numberOfActions)
setSize
- The size of the current set which the new classifier matches.time
- The actual number of instances the XCS learned from so far.condLength
- The length of the condition of the new classifier.numberOfActions
- The number of different actions to chose fromcreateRandomCondition(int)
,
createRandomAction(int)
,
classifierSetVariables(double, int)
public XClassifier(XClassifier clOld)
clOld
- The to be copied classifier.Method Detail |
private void createRandomCondition(int condLength)
P_dontcare<\code>.
- Parameters:
condLength
- the length of the condition part- See Also:
XCSConstants.P_dontcare
private void createMatchingCondition(java.lang.String cond)
P_dontcare<\code>.
- Parameters:
cond
- the string to be matched by the condition part- See Also:
XCSConstants.P_dontcare
private void createRandomAction(int numberOfActions)
numberOfActions
- The number of actions to chose from.private void classifierSetVariables(double setSize, int time)
setSize
- The size of the set the classifier is created in.time
- The actual number of instances the XCS learned from so far.XCSConstants.predictionIni
,
XCSConstants.predictionErrorIni
,
XCSConstants.fitnessIni
public boolean match(java.lang.String state)
state
- The current situation which can be the current state or problem instance.public boolean twoPointCrossover(XClassifier cl)
cl
- The second classifier for the crossover application.XCSConstants.pX
public boolean applyMutation(java.lang.String state, int numberOfActions)
state
- The current situation/problem instancenumberOfActions
- The maximal number of actions possible in the environment.private boolean mutateCondition(java.lang.String state)
state
- The current situation/problem instance.XCSConstants.pM
private boolean mutateAction(int numberOfActions)
numberOfActions
- The number of actions/classifications possible in the environment.XCSConstants.pM
public boolean equals(XClassifier cl)
cl
- The classifier to be compared.public boolean subsumes(XClassifier cl)
public boolean isSubsumer()
XCSConstants.theta_sub
,
XCSConstants.epsilon_0
public boolean isMoreGeneral(XClassifier cl)
cl
- The classifier that is tested to be more specific.public double getDelProp(double meanFitness)
meanFitness
- The mean fitness in the population.XCSConstants.delta
,
XCSConstants.theta_del
public double updatePrediction(double P)
P
- The actual Q-payoff value (actual reward + max of predicted reward in the following situation).XCSConstants.beta
public double updatePreError(double P)
P
- The actual Q-payoff value (actual reward + max of predicted reward in the following situation).XCSConstants.beta
public double getAccuracy()
XCSConstants.epsilon_0
,
XCSConstants.alpha
,
XCSConstants.nu
public double updateFitness(double accSum, double accuracy)
accSum
- The sum of all the accuracies in the action setaccuracy
- The accuracy of the classifier.XCSConstants.beta
public double updateActionSetSize(double numerositySum)
XCSConstants.beta
public int getAction()
public double getActionSetSize()
public int getExperience()
public void increaseExperience()
public double getPrediction()
public void setPrediction(double pre)
pre
- The new prediction of the classifier.public double getPredictionError()
public void setPredictionError(double preE)
preE
- The new prediction error of the classifier.public java.lang.String getCondition()
public double getFitness()
public void setFitness(double fit)
fit
- The new fitness of the classifier.public int getNumerosity()
public void addNumerosity(int num)
num
- The added numerosity (can be negative!).public int getTimeStamp()
public void setTimeStamp(int ts)
ts
- The new time stamp of the classifier.public void setNumerosity(int nm)
nm
- the new numerosity of the classifierpublic void setExperience(int exp)
exp
- The experience of the classifierpublic void setActionSetSize(int as)
as
- The size of the setpublic boolean test(java.lang.String question)
question
- in the communication process, the condition passed between XCSspublic void printXClassifier()
public void printXClassifier(java.io.PrintWriter pW)
pW
- The writer to which the classifier is written.public double getDelProp(double meanFitness, double meanPrediction)
meanFitness
- The mean fitness in the population.meanPrediction
- The mean prediction in the population.XCSConstants.delta
,
XCSConstants.theta_del
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |