/** * 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; }
search.setGenerateRanking(true); attsel.setEvaluator(eval); attsel.setSearch(search); try {
/** * 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; }
/** * constructor. Sets defaults for each member varaible. Default attribute * evaluator is CfsSubsetEval; default search method is BestFirst. */ public AttributeSelection() { setFolds(10); setRanking(false); setXval(false); setSeed(1); setEvaluator(new CfsSubsetEval()); setSearch(new GreedyStepwise()); m_selectionResults = new StringBuffer(); m_selectedAttributeSet = null; m_attributeRanking = null; }
/** * constructor. Sets defaults for each member varaible. Default attribute * evaluator is CfsSubsetEval; default search method is BestFirst. */ public AttributeSelection() { setFolds(10); setRanking(false); setXval(false); setSeed(1); setEvaluator(new CfsSubsetEval()); setSearch(new GreedyStepwise()); m_selectionResults = new StringBuffer(); m_selectedAttributeSet = null; m_attributeRanking = null; }
trainSelector.setSearch(searchMethod); } catch (Exception e) { throw new Exception('\n' + e.getMessage()
trainSelector.setSearch(searchMethod); } catch (Exception e) { throw new Exception('\n' + e.getMessage()
m_AttributeSelection.setSearch(m_Search); long start = System.currentTimeMillis(); m_AttributeSelection.
m_AttributeSelection.setSearch(m_Search); long start = System.currentTimeMillis(); m_AttributeSelection.
/** * 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.setSearch(m_ASSearch); m_trainSelector.SelectAttributes(getInputFormat());
m_trainSelector.setSearch(m_ASSearch); m_trainSelector.SelectAttributes(getInputFormat());
rankingMethod.setNumToSelect(topkCorrelated); attsel.setEvaluator(eval); attsel.setSearch(rankingMethod);
this.fs.setSearch(search);
ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; eval.setEvaluator(evalCopy); eval.setSearch(searchCopy); eval.setRanking(m_isRanking);
ASSearch searchCopy = ASSearch.makeCopies(m_searchTemplate, 1)[0]; eval.setEvaluator(evalCopy); eval.setSearch(searchCopy); eval.setRanking(m_isRanking);