/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runEvaluator(new ClassifierSubsetEval(), args); } }
public void setOptions(String[] options) throws Exception { String optionString; resetOptions(); optionString = ZeroR.class.getName(); setClassifier(AbstractClassifier.forName(optionString, Utils.partitionOptions(options))); setHoldOutFile(new File(optionString)); setUsePercentageSplit(Utils.getFlag("percentage-split", options)); setSplitPercent(optionString); setUseTraining(Utils.getFlag('T', options)); for (Tag t : TAGS_EVALUATION) { if (t.getIDStr().equalsIgnoreCase(optionString)) { setEvaluationMeasure(new SelectedTag(t.getIDStr(), TAGS_EVALUATION)); break; setIRClassValue(optionString); setSeed(Integer.parseInt(optionString));
if (getClassifier() != null) { options.add("-B"); options.add(getClassifier().getClass().getName()); if (getUseTraining()) { options.add("-T"); options.add(getHoldOutFile().getPath()); if (getUsePercentageSplit()) { options.add("-percentage-split"); options.add("-P"); options.add(m_splitPercent); options.add("-S"); options.add("" + getSeed());
/** Creates a ClassifierSubsetEval with J48 as classifier */ public ASEvaluation getEvaluator() { ClassifierSubsetEval eval = new ClassifierSubsetEval(); eval.setClassifier(new weka.classifiers.trees.J48()); return eval; }
getCapabilities().testWithFail(data); && (!getHoldOutFile().getPath().startsWith("Click to set"))) { java.io.Reader r = new java.io.BufferedReader(new java.io.FileReader(getHoldOutFile() .getPath())); m_holdOutInstances = new Instances(r);
} else { text.append("\tClassifier Subset Evaluator\n"); text.append("\tLearning scheme: " + getClassifier().getClass().getName() + "\n"); text.append("\tScheme options: "); text.append("\tHold out/test set: "); if (!m_useTraining) { if (getHoldOutFile().getPath().startsWith("Click to set")) { text.append("none\n"); } else { text.append(getHoldOutFile().getPath() + '\n');
/** * Reset options to default values */ protected void resetOptions() { m_performRanking = true; m_numUsedAttributes = 50; m_linearSelectionType = TYPE_FIXED_SET; m_setSizeEval = new ClassifierSubsetEval(); m_numFolds = 5; m_seed = 1; m_totalEvals = 0; m_cacheSize = 1; m_verbose = false; }
/** * Returns the capabilities of this evaluator. * * @return the capabilities of this evaluator * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; if (getClassifier() == null) { result = super.getCapabilities(); result.disableAll(); } else { result = getClassifier().getCapabilities(); } // set dependencies for (Capability cap : Capability.values()) { result.enableDependency(cap); } return result; }
public void setOptions(String[] options) throws Exception { String optionString; resetOptions(); optionString = ZeroR.class.getName(); setClassifier(AbstractClassifier.forName(optionString, Utils.partitionOptions(options))); setHoldOutFile(new File(optionString)); setUsePercentageSplit(Utils.getFlag("percentage-split", options)); setSplitPercent(optionString); setUseTraining(Utils.getFlag('T', options)); for (Tag t : TAGS_EVALUATION) { if (t.getIDStr().equalsIgnoreCase(optionString)) { setEvaluationMeasure(new SelectedTag(t.getIDStr(), TAGS_EVALUATION)); break; setIRClassValue(optionString); setSeed(Integer.parseInt(optionString));
if (getClassifier() != null) { options.add("-B"); options.add(getClassifier().getClass().getName()); if (getUseTraining()) { options.add("-T"); options.add(getHoldOutFile().getPath()); if (getUsePercentageSplit()) { options.add("-percentage-split"); options.add("-P"); options.add(m_splitPercent); options.add("-S"); options.add("" + getSeed());
getCapabilities().testWithFail(data); && (!getHoldOutFile().getPath().startsWith("Click to set"))) { java.io.Reader r = new java.io.BufferedReader(new java.io.FileReader(getHoldOutFile() .getPath())); m_holdOutInstances = new Instances(r);
} else { text.append("\tClassifier Subset Evaluator\n"); text.append("\tLearning scheme: " + getClassifier().getClass().getName() + "\n"); text.append("\tScheme options: "); text.append("\tHold out/test set: "); if (!m_useTraining) { if (getHoldOutFile().getPath().startsWith("Click to set")) { text.append("none\n"); } else { text.append(getHoldOutFile().getPath() + '\n');
/** * Returns the capabilities of this evaluator. * * @return the capabilities of this evaluator * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; if (getClassifier() == null) { result = super.getCapabilities(); result.disableAll(); } else { result = getClassifier().getCapabilities(); } // set dependencies for (Capability cap : Capability.values()) { result.enableDependency(cap); } return result; }
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runEvaluator(new ClassifierSubsetEval(), args); } }