/** 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
/** * 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); }
/** * 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
/** * 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
/** * 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); }
/** * Returns the numerosity of the classifier. * * @return an integer with the numerosity */ public int getNumerosity() { return parameters.getNumerosity(); } // end getNumerosity
/** * 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
/** * Sets the prediction error * * @param predErr is the prediction error value. */ public void setPredError(double predErr) { parameters.setPredError(predErr); } // end setPredError
/** * 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
/** * 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
/** * 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
/** * 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
/** * Sets the time stamp for this classifier. * * @param tStamp is the time stamp */ public void setTime(int tStamp) { parameters.setTime(tStamp); } // end setTime
/** Prints the classifier. */ public void print() { rep.print(); if (parameters != null) parameters.print(); }
/** * 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); }
public boolean couldComp() { return parameters.couldComp(); }
/** * 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); }
/** * 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); }
/** * Returns the estimated action set size. * * @return an integer with the estimated action set size. */ public double getCSize() { return parameters.getCSize(); } // end getASize
/** * 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
/** * Returns the experience of the classifier. * * @return an integer with the experience of the classifier. */ public int getExperience() { return parameters.getExperience(); } // end getExperience
/** * 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
/** Sets the numerosity of the classifier. */ public void setNumerosity(int num) { parameters.setNumerosity(num); } // end setNumerosity
/** * Sets the prediction value. * * @param pred is the prediction to be set */ public void setPrediction(double pred) { parameters.setPrediction(pred); } // end setPrediction
/** * 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
/** * Returns the accuracy of the classifier. * * @return a double with the accuracy */ public double getAccuracy() { return parameters.getAccuracy(); } // end getAccuracy
/** * 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
/** * Returns the fitness of the "micro-classifier" * * @return a double with the micro-classifier fitness */ public double getMicroClFitness() { return parameters.getMicroClFitness(); } // end getMicroClFitness
/** * 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
/** * 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