/** * Sets up a dummy subset evaluator that basically just delegates evaluation * to the estimatePerformance method in DecisionTable */ @Override protected void setUpEvaluator() throws Exception { m_evaluator = new EvalWithDelete(); m_evaluator.buildEvaluator(m_theInstances); }
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { try { if (args.length == 0) { throw new Exception("The first argument must be the name of an " + "attribute/subset evaluator"); } String EvaluatorName = args[0]; args[0] = ""; ASEvaluation newEval = ASEvaluation.forName(EvaluatorName, null); System.out.println(SelectAttributes(newEval, args)); } catch (Exception e) { System.out.println(e.getMessage()); } }
/** * Execute the supplied object. Subclasses need to override this method. * * @param toRun the object to execute * @param options any options to pass to the object * @throws Exception if a problem occurs */ @Override public void run(Object toRun, String[] options) throws Exception { if (!(toRun instanceof ASEvaluation)) { throw new IllegalArgumentException( "Object to run is not an instance of ASEValuation!"); } preExecution(); runEvaluator((ASEvaluation) toRun, options); postExecution(); }
/** * runs the evaluator with the given commandline options * * @param evaluator the evaluator to run * @param options the commandline options */ public static void runEvaluator(ASEvaluation evaluator, String[] options) { try { evaluator.preExecution(); System.out .println(AttributeSelection.SelectAttributes(evaluator, options)); } catch (Exception e) { String msg = e.toString().toLowerCase(); if ((msg.indexOf("help requested") == -1) && (msg.indexOf("no training file given") == -1)) { e.printStackTrace(); } System.err.println(e.getMessage()); } try { evaluator.postExecution(); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Select attributes for a split of the data. Calling this function updates * the statistics on attribute selection. CVResultsString() returns a string * summarizing the results of repeated calls to this function. Assumes that * splits are from the same dataset--- ie. have the same number and types of * attributes as previous splits. * * @param split the instances to select attributes from * @exception Exception if an error occurs */ public void selectAttributesCVSplit(Instances split) throws Exception { m_ASEvaluator.buildEvaluator(split); // Do the search int[] attributeSet = m_searchMethod.search(m_ASEvaluator, split); // Do any postprocessing that a attribute selection method might // require attributeSet = m_ASEvaluator.postProcess(attributeSet); updateStatsForModelCVSplit(split, m_ASEvaluator, m_searchMethod, attributeSet, m_doRank); }
try { ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0]; ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; if (!isStopRequested()) { getStepManager().statusMessage(message); getStepManager().logBasic(message); evalCopy.buildEvaluator(train); if (evalCopy instanceof AttributeTransformer) { m_transformerStore.put(setNum != null ? setNum : -1, selectedAtts = evalCopy.postProcess(selectedAtts); if (m_isRanking) { double[][] ranked = m_setCount.decrementAndGet(); evalCopy.clean();
m_ASEvaluator.buildEvaluator(m_trainInstances); if (m_ASEvaluator instanceof AttributeTransformer) { m_trainInstances = attributeSet = m_ASEvaluator.postProcess(attributeSet); if (!m_doRank) { m_selectionResults.append(printSelectionResults()); m_ASEvaluator.clean();
/** * Returns the Capabilities of this filter. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; if (m_ASEvaluator == null) { result = super.getCapabilities(); result.disableAll(); } else { result = m_ASEvaluator.getCapabilities(); // class index will be set if necessary, so we always allow the dataset // to have no class attribute set. see the following method: // weka.attributeSelection.AttributeSelection.SelectAttributes(Instances) result.enable(Capability.NO_CLASS); } result.setMinimumNumberInstances(0); return result; }
: (SubsetEvaluator) ASEvaluation.makeCopies(m_ASEval, 1)[0];
AttributeSelection eval = new AttributeSelection(); ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0]; ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; eval.setEvaluator(evalCopy); m_setCount.decrementAndGet(); evalCopy.clean();
(weka.clusterers.Clusterer) scheme, options); } else if (selectedType == SchemeType.ATTRIBUTE_SELECTION) { weka.attributeSelection.ASEvaluation.runEvaluator( (weka.attributeSelection.ASEvaluation) scheme, options); } else if (selectedType == SchemeType.ASSOCIATOR) {
try { ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0]; ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; if (!isStopRequested()) { getStepManager().statusMessage(message); getStepManager().logBasic(message); evalCopy.buildEvaluator(train); if (evalCopy instanceof AttributeTransformer) { m_transformerStore.put(setNum != null ? setNum : -1, selectedAtts = evalCopy.postProcess(selectedAtts); if (m_isRanking) { double[][] ranked = m_setCount.decrementAndGet(); evalCopy.clean();
m_ASEvaluator.buildEvaluator(m_trainInstances); if (m_ASEvaluator instanceof AttributeTransformer) { m_trainInstances = attributeSet = m_ASEvaluator.postProcess(attributeSet); if (!m_doRank) { m_selectionResults.append(printSelectionResults()); m_ASEvaluator.clean();
/** * Returns the Capabilities of this filter. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; if (m_ASEvaluator == null) { result = super.getCapabilities(); result.disableAll(); } else { result = m_ASEvaluator.getCapabilities(); // class index will be set if necessary, so we always allow the dataset // to have no class attribute set. see the following method: // weka.attributeSelection.AttributeSelection.SelectAttributes(Instances) result.enable(Capability.NO_CLASS); } result.setMinimumNumberInstances(0); return result; }
/** * Select attributes for a split of the data. Calling this function updates * the statistics on attribute selection. CVResultsString() returns a string * summarizing the results of repeated calls to this function. Assumes that * splits are from the same dataset--- ie. have the same number and types of * attributes as previous splits. * * @param split the instances to select attributes from * @exception Exception if an error occurs */ public void selectAttributesCVSplit(Instances split) throws Exception { m_ASEvaluator.buildEvaluator(split); // Do the search int[] attributeSet = m_searchMethod.search(m_ASEvaluator, split); // Do any postprocessing that a attribute selection method might // require attributeSet = m_ASEvaluator.postProcess(attributeSet); updateStatsForModelCVSplit(split, m_ASEvaluator, m_searchMethod, attributeSet, m_doRank); }
: (SubsetEvaluator) ASEvaluation.makeCopies(m_ASEval, 1)[0];
/** * runs the evaluator with the given commandline options * * @param evaluator the evaluator to run * @param options the commandline options */ public static void runEvaluator(ASEvaluation evaluator, String[] options) { try { evaluator.preExecution(); System.out .println(AttributeSelection.SelectAttributes(evaluator, options)); } catch (Exception e) { String msg = e.toString().toLowerCase(); if ((msg.indexOf("help requested") == -1) && (msg.indexOf("no training file given") == -1)) { e.printStackTrace(); } System.err.println(e.getMessage()); } try { evaluator.postExecution(); } catch (Exception ex) { ex.printStackTrace(); } }
AttributeSelection eval = new AttributeSelection(); ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0]; ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; eval.setEvaluator(evalCopy); m_setCount.decrementAndGet(); evalCopy.clean();
(weka.clusterers.Clusterer) scheme, options); } else if (selectedType == SchemeType.ATTRIBUTE_SELECTION) { weka.attributeSelection.ASEvaluation.runEvaluator( (weka.attributeSelection.ASEvaluation) scheme, options); } else if (selectedType == SchemeType.ASSOCIATOR) {
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { try { if (args.length == 0) { throw new Exception("The first argument must be the name of an " + "attribute/subset evaluator"); } String EvaluatorName = args[0]; args[0] = ""; ASEvaluation newEval = ASEvaluation.forName(EvaluatorName, null); System.out.println(SelectAttributes(newEval, args)); } catch (Exception e) { System.out.println(e.getMessage()); } }