示例#1
0
 /** Prints the classifier. */
 public void print() {
   System.out.print("  Act: " + action + "   Conf:  ");
   for (int i = 0; i < rep.length; i++) {
     rep[i].print();
   }
   if (parameters != null) parameters.print();
 } // end print
示例#2
0
 /**
  * Prints the classifier to the specified file.
  *
  * @param fout is the file output where the classifier has to be printed.
  */
 public void print(PrintWriter fout) {
   fout.print(" ");
   for (int i = 0; i < rep.length; i++) {
     rep[i].print(fout);
   }
   fout.print("  " + action + "  ");
   if (parameters != null) parameters.print(fout);
 }
示例#3
0
  /**
   * Returns if the classifier of the class subsumes the classifier passed as a parameter.
   *
   * @param cl is the subsumed classifier.
   * @return a boolean indicating if it subsumes
   */
  public boolean doesSubsume(Classifier cl) {

    if (rep.getAction() != cl.rep.getAction()) return false;

    if (parameters.couldSubsume()) {
      if (rep.isMoreGeneral(cl.rep)) {
        return true;
      }
    }
    return false;
  } // end doesSubsume
示例#4
0
  /**
   * Returns if the classifier of the class subsumes the classifier passed as a parameter.
   *
   * @param cl is the subsumed classifier.
   * @return a boolean indicating if it subsumes
   */
  public boolean doesSubsume(Classifier cl) {
    int i;

    // First, check if the condition is the same
    if (action != cl.getAction()) return false;

    // Then, check that is more general
    if (parameters.couldSubsume()) {
      for (i = 0; i < rep.length; i++) {
        if (!rep[i].isMoreGeneral(cl.rep[i])) return false;
      }
      return true;
    }
    return false;
  } // end doesSubsume
示例#5
0
  /**
   * Prints the desnormalized classifier to the specified file.
   *
   * @param fout is the file output where the classifier has to be printed.
   */
  public void printNotNorm(PrintWriter fout) {
    int i = 0;
    fout.print(" ");
    try {
      for (i = 0; i < rep.length; i++) {
        if (Config.typeOfAttributes[i].equals("ternary")) {
          rep[i].print(fout);
        } else if (Config.typeOfAttributes[i].equals("integer")) {
          rep[i].printNotNorm(fout, Config.attBounds[i][0]);
        } else if (Config.typeOfAttributes[i].equals("real")) {
          rep[i].printNotNorm(fout, Config.attBounds[i][0], Config.attBounds[i][1]);
        }
      }
    } catch (Exception e) {
      System.out.println("Exception when printing the attribute: " + i);
      e.printStackTrace();
    }
    fout.print("\t " + (String) Config.classConv.elementAt(action));

    if (parameters != null) parameters.print(fout);
  }
示例#6
0
 /**
  * Returns the numerosity of the classifier.
  *
  * @return an integer with the numerosity
  */
 public int getNumerosity() {
   return parameters.getNumerosity();
 } // end getNumerosity
示例#7
0
 /**
  * Returns the time stamp of the classifier.
  *
  * @return an integer with the time stamp of the classifier.
  */
 public int getTime() {
   return parameters.getTime();
 } // end getTime
示例#8
0
 /**
  * Sets the prediction error
  *
  * @param predErr is the prediction error value.
  */
 public void setPredError(double predErr) {
   parameters.setPredError(predErr);
 } // end setPredError
示例#9
0
 /**
  * Increases the number of matches
  *
  * @param num is the number of matches to be increased.
  */
 public void increaseNumberMatches(int num) {
   parameters.increaseNumberMatches(num);
 } // end increaseNumberMatches
示例#10
0
 /**
  * Computes the generality of the classifier and stores it in it corresponding parameter in the
  * class Parameters.
  */
 public void calculateGenerality() {
   parameters.setGenerality(getGenerality());
 } // end calculateGenerality
示例#11
0
 /**
  * Returns if the classifier can subsume. The classifier has to be sufficiently accurate and
  * sufficiently experienced to subsume another classifier.
  *
  * @return a boolean indicating if the classifier can subsume.
  */
 public boolean couldSubsume() {
   return parameters.couldSubsume();
 } // end couldSubsume
示例#12
0
 /**
  * Updates the parameters of a classifier.
  *
  * @param microClSum is the numerosity of the action set (all the action set.).
  * @param classOfExample is the class of the example.
  */
 public void updateParameters(double microClInC, int classOfExample) {
   parameters.updateParameters(microClInC, action, classOfExample);
 } // end updateParameters
示例#13
0
 /**
  * Sets the time stamp for this classifier.
  *
  * @param tStamp is the time stamp
  */
 public void setTime(int tStamp) {
   parameters.setTime(tStamp);
 } // end setTime
示例#14
0
 /** Prints the classifier. */
 public void print() {
   rep.print();
   if (parameters != null) parameters.print();
 }
示例#15
0
 /**
  * Prints the desnormalized classifier to the specified file.
  *
  * @param fout is the file output where the classifier has to be printed.
  */
 public void printNotNorm(PrintWriter fout) {
   rep.printNotNorm(fout);
   if (parameters != null) parameters.print(fout);
 }
示例#16
0
 public boolean couldComp() {
   return parameters.couldComp();
 }
示例#17
0
 /**
  * Adds the value passed to the usefulTimes parameter of the classifier
  *
  * @param num is the value that has to be added
  */
 public void addUsefulTimes(int num) {
   parameters.addUsefulTimes(num);
 }
示例#18
0
 /**
  * Returns if the classifier is experienced, and accurate enough to be in the reduction set.
  * Otherwise, the classifier will not be included in the reduction
  *
  * @param maxReward is the maximum reward of the environment.
  * @return a boolean indicating if the classifier can be in the reduction set.
  */
 public boolean couldReduce(double maxReward) {
   return parameters.couldReduce(maxReward);
 }
示例#19
0
 /**
  * Returns the estimated action set size.
  *
  * @return an integer with the estimated action set size.
  */
 public double getCSize() {
   return parameters.getCSize();
 } // end getASize
示例#20
0
 /**
  * Updates the fitness of a classifier
  *
  * @param kSum is the sum of all accuracies.
  * @param k is the accuracy of the classifier.
  */
 public void updateFitness(double kSum, double k) {
   parameters.updateFitness(kSum, k);
 } // end updateFitness
示例#21
0
 /**
  * Returns the experience of the classifier.
  *
  * @return an integer with the experience of the classifier.
  */
 public int getExperience() {
   return parameters.getExperience();
 } // end getExperience
示例#22
0
 /**
  * Sets the useful parameter
  *
  * @param value is the value that the useful param has to be set.
  */
 public void setUseful(boolean value) {
   parameters.setUseful(value);
 } // end setUseful
示例#23
0
 /** Sets the numerosity of the classifier. */
 public void setNumerosity(int num) {
   parameters.setNumerosity(num);
 } // end setNumerosity
示例#24
0
 /**
  * Sets the prediction value.
  *
  * @param pred is the prediction to be set
  */
 public void setPrediction(double pred) {
   parameters.setPrediction(pred);
 } // end setPrediction
示例#25
0
 /**
  * Increases the numerosity of the classifier.
  *
  * @param num is the number to increase the numerosity of the classifier.
  */
 public void increaseNumerosity(int num) {
   parameters.increaseNumerosity(num);
 } // end increaseNumerosity
示例#26
0
 /**
  * Returns the accuracy of the classifier.
  *
  * @return a double with the accuracy
  */
 public double getAccuracy() {
   return parameters.getAccuracy();
 } // end getAccuracy
示例#27
0
 /**
  * Sets the number of matches
  *
  * @param num is the number of matches to be set.
  */
 public void setNumberMatches(int num) {
   parameters.setNumberMatches(num);
 } // end setNumberMatches
示例#28
0
 /**
  * Returns the fitness of the "micro-classifier"
  *
  * @return a double with the micro-classifier fitness
  */
 public double getMicroClFitness() {
   return parameters.getMicroClFitness();
 } // end getMicroClFitness
示例#29
0
 /**
  * Returns the probability of a classifier to be deleted.
  *
  * @return a double with the probability of being deleted.
  * @param avFitness is the average fitness of the set.
  */
 public double deletionVote(double avFitness) {
   return parameters.deletionVote(avFitness);
 } // end deletionVote
示例#30
0
 /**
  * Sets the usefulTimes parameter
  *
  * @param value is the value that the useful param has to be set.
  */
 public void setUseful(int value) {
   parameters.setUsefulTimes(value);
 } // end setUseful