/** * 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()); } }
/** * 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()); } }
/** * 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(); } }
/** * 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(); } }
/** * Feature selection using Weka. * * @param trainData * weka train data * @param featureSearcher * list of features * @param attributeEvaluator * list of attribute evaluators * @return attribute selection * @throws Exception * in case of errors */ public static AttributeSelection singleLabelAttributeSelection(Instances trainData, List<String> featureSearcher, List<String> attributeEvaluator) throws Exception { AttributeSelection selector = new AttributeSelection(); // Get feature searcher ASSearch search = ASSearch.forName(featureSearcher.get(0), featureSearcher.subList(1, featureSearcher.size()).toArray(new String[0])); // Get attribute evaluator ASEvaluation evaluation = ASEvaluation.forName(attributeEvaluator.get(0), attributeEvaluator.subList(1, attributeEvaluator.size()).toArray(new String[0])); selector.setSearch(search); selector.setEvaluator(evaluation); selector.SelectAttributes(trainData); return selector; }
/** * * Feature selection using Weka. * * @param trainData * training data * @param featureSearcher * @param attributeEvaluator * @return a feature selector * @throws Exception */ public static AttributeSelection singleLabelAttributeSelection(Instances trainData, List<String> featureSearcher, List<String> attributeEvaluator) throws Exception { AttributeSelection selector = new AttributeSelection(); // Get feature searcher ASSearch search = ASSearch.forName(featureSearcher.get(0), featureSearcher.subList(1, featureSearcher.size()).toArray(new String[0])); // Get attribute evaluator ASEvaluation evaluation = ASEvaluation.forName(attributeEvaluator.get(0), attributeEvaluator.subList(1, attributeEvaluator.size()).toArray(new String[0])); selector.setSearch(search); selector.setEvaluator(evaluation); selector.SelectAttributes(trainData); return selector; }
/** * Feature selection using Weka. * * @param trainData * weka train data * @param featureSearcher * list of features * @param attributeEvaluator * list of attribute evaluators * @return attribute selection * @throws Exception * in case of errors */ public static AttributeSelection singleLabelAttributeSelection(Instances trainData, List<String> featureSearcher, List<String> attributeEvaluator) throws Exception { AttributeSelection selector = new AttributeSelection(); // Get feature searcher ASSearch search = ASSearch.forName(featureSearcher.get(0), featureSearcher.subList(1, featureSearcher.size()).toArray(new String[0])); // Get attribute evaluator ASEvaluation evaluation = ASEvaluation.forName(attributeEvaluator.get(0), attributeEvaluator.subList(1, attributeEvaluator.size()).toArray(new String[0])); selector.setSearch(search); selector.setEvaluator(evaluation); selector.SelectAttributes(trainData); return selector; }
try { attsel.SelectAttributes(data); } catch (Exception e) {
return SelectAttributes(ASEvaluator, options, train);
return SelectAttributes(ASEvaluator, options, train);
/** * Performs a attribute selection with the given search and evaluation scheme * on the provided data. The generated AttributeSelection object is returned. * * @param search the search scheme to use * @param eval the evaluator to use * @param data the data to work on * @return the used attribute selection object * @throws Exception if the attribute selection fails */ protected AttributeSelection search(ASSearch search, ASEvaluation eval, Instances data) throws Exception { AttributeSelection result; result = new AttributeSelection(); result.setSeed(42); result.setSearch(search); result.setEvaluator(eval); result.SelectAttributes(data); return result; }
/** * Performs a attribute selection with the given search and evaluation scheme * on the provided data. The generated AttributeSelection object is returned. * * @param search the search scheme to use * @param eval the evaluator to use * @param data the data to work on * @return the used attribute selection object * @throws Exception if the attribute selection fails */ protected AttributeSelection search(ASSearch search, ASEvaluation eval, Instances data) throws Exception { AttributeSelection result; result = new AttributeSelection(); result.setSeed(42); result.setSearch(search); result.setEvaluator(eval); result.SelectAttributes(data); return result; }
/** * Builds a model using the current scheme using the given data. * * @param data the instances to test the selection scheme on * @return a string containing the results. */ protected String useScheme(Instances data) throws Exception { AttributeSelection attsel = null; try { attsel = new AttributeSelection(); attsel.setSearch(m_Search); attsel.setEvaluator(m_Evaluator); attsel.setSeed(42); } catch (Exception e) { e.printStackTrace(); fail("Problem setting up attribute selection: " + e); } attsel.SelectAttributes(data); return attsel.toResultsString(); }
/** * Builds a model using the current scheme using the given data. * * @param data the instances to test the selection scheme on * @return a string containing the results. */ protected String useScheme(Instances data) throws Exception { AttributeSelection attsel = null; try { attsel = new AttributeSelection(); attsel.setSearch(m_Search); attsel.setEvaluator(m_Evaluator); attsel.setSeed(42); } catch (Exception e) { e.printStackTrace(); fail("Problem setting up attribute selection: " + e); } attsel.SelectAttributes(data); return attsel.toResultsString(); }
m_trainSelector.SelectAttributes(getInputFormat());
m_trainSelector.SelectAttributes(getInputFormat());
Integer fold) throws Exception { AttributeSelection ae = this.getAttributeSelection(); ae.SelectAttributes(inst); double rankedAttributes[][] = ae.rankedAttributes(); FeatureEvaluation fe = initializeFeatureEvaluation(corpusName,
iporesult.add(metaInstance); attsel.SelectAttributes(iporesult); selectedAttributes[i] = attsel.selectedAttributes(); iporesult.delete();
getStepManager().statusMessage(message); getStepManager().logBasic(message); eval.SelectAttributes(train); if (evalCopy instanceof AttributeTransformer) { m_transformerStore.put(setNum != null ? setNum : -1,
getStepManager().statusMessage(message); getStepManager().logBasic(message); eval.SelectAttributes(train); if (evalCopy instanceof AttributeTransformer) { m_transformerStore.put(setNum != null ? setNum : -1,