Classifier
Class AnticipatoryClassifier
java.lang.Object
|
+--Classifier.BasicClassifier
|
+--Classifier.AnticipatoryClassifier
- All Implemented Interfaces:
- java.lang.Comparable
- public class AnticipatoryClassifier
- extends BasicClassifier
This class is used to represent anticipatory classifiers.
- Author:
- Olivier Sigaud and Pierre Gérard.
Constructor Summary |
AnticipatoryClassifier(Classifier.AnticipatoryClassifier classifier,
boolean init,
double initialReliability)
|
AnticipatoryClassifier(java.lang.String systemName,
java.lang.String perceptionForm,
java.lang.String actionForm,
double initialReliability)
|
AnticipatoryClassifier(java.lang.String systemName,
java.lang.String strValue,
java.lang.String perceptionForm,
java.lang.String actionFormString,
double initialReliability)
|
Method Summary |
void |
addBadAnticipation(Classifier.Perception lastPerception,
double learningRate)
|
void |
addGoodAnticipation(Classifier.Perception lastPerception,
double learningRate)
|
Utils.ValuesDistribution |
buildValuesDistributionForReliabilities()
|
Utils.ValuesDistribution |
buildValuesDistributionForReliabilitiesIfGeneral()
|
Utils.ValuesDistribution |
buildValuesDistributionForUnreliabilityOfGeneralPerceptions(byte[] indexArrayToBuild)
|
byte |
chooseIndexToMutSpec()
|
java.lang.Object |
clone()
Returns a clone of the MACSClassifier |
int |
compareTo(java.lang.Object p)
|
Classifier.Perception |
computeAnticipation(Classifier.Perception perception)
|
Classifier.AnticipatoryClassifier |
computeGoodSpecialized(byte index,
double initialReliability,
double learningRate)
The construction method has been changed here, it is a bit less efficient:
we copy the ReliabilitiesArrays and then we reinitialize them... |
private void |
decreaseReliabilitiesIfGeneral(byte index,
double learningRate)
|
boolean |
doesAnticipateBadly(byte nbFailuresToRemove)
|
boolean |
doesAnticipateWell(byte nbSuccessToProbe)
|
boolean |
doesOscillate(byte nbEvaluationsToSpecialize)
|
boolean |
equals(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
|
boolean |
equals(java.lang.Object classifier)
|
void |
flushMarkers(double initialReliability)
|
void |
freeMemories(double initialReliability)
|
Classifier.Anticipation |
getAnticipation()
|
private double |
getCertainty(byte nbEvaluationsToSpecialize,
byte nbFailuresToRemove,
byte nbSuccessToProbe)
|
double |
getEvaluationLevel(byte nbEvaluationsToSpecialize,
byte nbFailuresToRemove,
byte nbSuccessToProbe)
|
double |
getExplorationFactor()
|
int |
getLastEvaluation()
|
Classifier.Perception |
getLastPerceptionWhenAnticipatingBadly()
|
Classifier.Perception |
getLastPerceptionWhenAnticipatingWell()
|
double[] |
getReliabilities()
|
double[] |
getReliabilitiesIfGeneral()
|
double |
getReliabilitiesIfGeneral(byte index)
|
java.lang.String |
getReliabilitiesIfGeneralString()
|
java.lang.String |
getReliabilitiesString()
|
boolean |
hasAlreadyBeenEvaluated()
|
void |
increaseLastEvaluation()
|
private void |
increaseReliabilitiesIfGeneral(byte index,
double learningRate)
|
private void |
initReliabilitiesArrays(double initialReliability)
|
boolean |
isLessGeneralThan(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
|
boolean |
isMoreGeneralThan(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
|
boolean |
isReadyToGeneralize()
|
boolean |
matchAnticipation(Classifier.Perception ant)
|
boolean |
matches(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
|
Classifier.AnticipatoryClassifier |
mutGenOne(double initialReliability)
Put a new dontCare token in the condition part in the most suitable place.
|
void |
resetLastEvaluation()
|
void |
setAnticipation(Classifier.Anticipation newAnt)
|
protected void |
setReliabilitiesIfGeneral(byte index,
double value)
|
void |
specialize(Classifier.Perception lastGoodPerception,
byte index)
|
java.lang.String |
toString(boolean verbose)
|
void |
updateGeneralReliabilities(Classifier.Perception lastPerception,
Classifier.Perception currentPerception,
double learningRate)
|
private void |
updateReliabilitiesIfBadlyAnticipating(Classifier.Perception lastPerception,
double learningRate)
|
private void |
updateReliabilitiesIfWellAnticipating(Classifier.Perception lastPerception,
double learningRate)
|
Methods inherited from class Classifier.BasicClassifier |
getAction, getActionString, getCondition, getPerceptionLength, getPerceptionString, isLessGeneralThan, isMoreGeneralThan, matchAction, matchCondition, matches, matches, setAction, setCondition, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
nbGoodAnticipations
protected int nbGoodAnticipations
nbBadAnticipations
protected int nbBadAnticipations
lastEvaluation
protected int lastEvaluation
anticipation
protected Classifier.Anticipation anticipation
lastPerceptionWhenAnticipatingWell
protected Classifier.Perception lastPerceptionWhenAnticipatingWell
lastPerceptionWhenAnticipatingBadly
protected Classifier.Perception lastPerceptionWhenAnticipatingBadly
reliabilitiesArray
protected double[] reliabilitiesArray
- ------------- the following part is devoted to reliability exclusively... -------------------
reliabilitiesIfGeneralArray
protected double[] reliabilitiesIfGeneralArray
AnticipatoryClassifier
public AnticipatoryClassifier(Classifier.AnticipatoryClassifier classifier,
boolean init,
double initialReliability)
- Parameters:
initialReliability
-
AnticipatoryClassifier
public AnticipatoryClassifier(java.lang.String systemName,
java.lang.String strValue,
java.lang.String perceptionForm,
java.lang.String actionFormString,
double initialReliability)
- Parameters:
strValue
- perceptionForm
- actionFormString
- initialReliability
-
AnticipatoryClassifier
public AnticipatoryClassifier(java.lang.String systemName,
java.lang.String perceptionForm,
java.lang.String actionForm,
double initialReliability)
- Parameters:
perceptionForm
- actionForm
- initialReliability
-
clone
public java.lang.Object clone()
- Returns a clone of the MACSClassifier
- Overrides:
clone
in class BasicClassifier
- Returns:
- Object
compareTo
public final int compareTo(java.lang.Object p)
- Specified by:
compareTo
in interface java.lang.Comparable
- Overrides:
compareTo
in class BasicClassifier
- Parameters:
p
-
- Returns:
- int
getLastPerceptionWhenAnticipatingWell
public Classifier.Perception getLastPerceptionWhenAnticipatingWell()
getLastPerceptionWhenAnticipatingBadly
public Classifier.Perception getLastPerceptionWhenAnticipatingBadly()
- Returns:
- Classifier.Perception
getAnticipation
public Classifier.Anticipation getAnticipation()
- Returns:
- Classifier.Anticipation
getExplorationFactor
public double getExplorationFactor()
- Returns:
- double
equals
public boolean equals(java.lang.Object classifier)
- Overrides:
equals
in class BasicClassifier
- Parameters:
classifier
-
- Returns:
- boolean true if the two objects are equal, else false
equals
public boolean equals(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
- Parameters:
classifier
- watchForAnticipation
-
- Returns:
- boolean
isMoreGeneralThan
public boolean isMoreGeneralThan(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
- Parameters:
classifier
- watchForAnticipation
-
- Returns:
- boolean
isLessGeneralThan
public boolean isLessGeneralThan(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
- Parameters:
classifier
- watchForAnticipation
-
- Returns:
- boolean
matches
public boolean matches(Classifier.AnticipatoryClassifier classifier,
boolean watchForAnticipation)
- Parameters:
classifier
- watchForAnticipation
-
- Returns:
- boolean
matchAnticipation
public boolean matchAnticipation(Classifier.Perception ant)
- Parameters:
ant
-
- Returns:
- boolean
computeAnticipation
public Classifier.Perception computeAnticipation(Classifier.Perception perception)
- Parameters:
perception
-
- Returns:
- Classifier.Perception
setAnticipation
public void setAnticipation(Classifier.Anticipation newAnt)
- Parameters:
newAnt
-
doesOscillate
public boolean doesOscillate(byte nbEvaluationsToSpecialize)
- Parameters:
nbEvaluationsToSpecialize
-
- Returns:
- boolean
doesAnticipateWell
public boolean doesAnticipateWell(byte nbSuccessToProbe)
- Parameters:
nbSuccessToProbe
-
- Returns:
- boolean
doesAnticipateBadly
public boolean doesAnticipateBadly(byte nbFailuresToRemove)
- Parameters:
nbFailuresToRemove
-
- Returns:
- boolean
flushMarkers
public final void flushMarkers(double initialReliability)
- Parameters:
initialReliability
-
freeMemories
public final void freeMemories(double initialReliability)
- Parameters:
initialReliability
-
getLastEvaluation
public final int getLastEvaluation()
- Returns:
- int
resetLastEvaluation
public final void resetLastEvaluation()
increaseLastEvaluation
public final void increaseLastEvaluation()
getCertainty
private double getCertainty(byte nbEvaluationsToSpecialize,
byte nbFailuresToRemove,
byte nbSuccessToProbe)
- Parameters:
nbEvaluationsToSpecialize
- nbFailuresToRemove
- nbSuccessToProbe
-
- Returns:
- double
getEvaluationLevel
public double getEvaluationLevel(byte nbEvaluationsToSpecialize,
byte nbFailuresToRemove,
byte nbSuccessToProbe)
- Parameters:
nbEvaluationsToSpecialize
- nbFailuresToRemove
- nbSuccessToProbe
-
- Returns:
- double
hasAlreadyBeenEvaluated
public final boolean hasAlreadyBeenEvaluated()
- Returns:
- boolean
addGoodAnticipation
public final void addGoodAnticipation(Classifier.Perception lastPerception,
double learningRate)
- Parameters:
lastPerception
- learningRate
-
addBadAnticipation
public final void addBadAnticipation(Classifier.Perception lastPerception,
double learningRate)
- Parameters:
lastPerception
- learningRate
-
chooseIndexToMutSpec
public byte chooseIndexToMutSpec()
- Returns:
- byte
specialize
public void specialize(Classifier.Perception lastGoodPerception,
byte index)
- Parameters:
lastGoodPerception
- index
-
computeGoodSpecialized
public Classifier.AnticipatoryClassifier computeGoodSpecialized(byte index,
double initialReliability,
double learningRate)
- The construction method has been changed here, it is a bit less efficient:
we copy the ReliabilitiesArrays and then we reinitialize them...
- Parameters:
index
- initialReliability
- learningRate
-
- Returns:
- AnticipatoryClassifier
mutGenOne
public final Classifier.AnticipatoryClassifier mutGenOne(double initialReliability)
- Put a new dontCare token in the condition part in the most suitable place.
That place is indicated by the ReliabilitiesIfGeneral estimators.
- Parameters:
initialReliability
-
- Returns:
- AnticipatoryClassifier
buildValuesDistributionForUnreliabilityOfGeneralPerceptions
public final Utils.ValuesDistribution buildValuesDistributionForUnreliabilityOfGeneralPerceptions(byte[] indexArrayToBuild)
- Returns:
- Utils.ValuesDistribution
getReliabilities
public final double[] getReliabilities()
- Returns:
- double[]
getReliabilitiesIfGeneral
public final double[] getReliabilitiesIfGeneral()
- Returns:
- double[]
setReliabilitiesIfGeneral
protected final void setReliabilitiesIfGeneral(byte index,
double value)
- Parameters:
index
- value
-
getReliabilitiesIfGeneral
public final double getReliabilitiesIfGeneral(byte index)
- Parameters:
index
-
- Returns:
- double
getReliabilitiesIfGeneralString
public final java.lang.String getReliabilitiesIfGeneralString()
- Returns:
- String
getReliabilitiesString
public final java.lang.String getReliabilitiesString()
- Returns:
- String
initReliabilitiesArrays
private final void initReliabilitiesArrays(double initialReliability)
- Parameters:
initialReliability
-
isReadyToGeneralize
public final boolean isReadyToGeneralize()
- Returns:
- boolean
updateReliabilitiesIfWellAnticipating
private final void updateReliabilitiesIfWellAnticipating(Classifier.Perception lastPerception,
double learningRate)
updateReliabilitiesIfBadlyAnticipating
private final void updateReliabilitiesIfBadlyAnticipating(Classifier.Perception lastPerception,
double learningRate)
decreaseReliabilitiesIfGeneral
private void decreaseReliabilitiesIfGeneral(byte index,
double learningRate)
increaseReliabilitiesIfGeneral
private void increaseReliabilitiesIfGeneral(byte index,
double learningRate)
updateGeneralReliabilities
public final void updateGeneralReliabilities(Classifier.Perception lastPerception,
Classifier.Perception currentPerception,
double learningRate)
- Parameters:
lastPerception
- currentPerception
- learningRate
-
buildValuesDistributionForReliabilities
public final Utils.ValuesDistribution buildValuesDistributionForReliabilities()
- Returns:
- ValuesDistribution
buildValuesDistributionForReliabilitiesIfGeneral
public final Utils.ValuesDistribution buildValuesDistributionForReliabilitiesIfGeneral()
- Returns:
- ValuesDistribution
toString
public java.lang.String toString(boolean verbose)
- Overrides:
toString
in class BasicClassifier
- Parameters:
verbose
-
- Returns:
- String