예제 #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