/** * 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; }
/** * set options to their default values */ protected void resetOptions() { m_trainSelector = new weka.attributeSelection.AttributeSelection(); setEvaluator(new CfsSubsetEval()); setSearch(new BestFirst()); m_SelectedAttributes = null; }
/** * set options to their default values */ protected void resetOptions() { m_trainSelector = new weka.attributeSelection.AttributeSelection(); setEvaluator(new CfsSubsetEval()); setSearch(new BestFirst()); m_SelectedAttributes = null; }
AttributeSelection attsel = new AttributeSelection(); // package weka.attributeSelection! InfoGainAttributeEval eval = new InfoGainAttributeEval(); Ranker search = new Ranker();
/** * 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; }
int classIndex = -1; boolean helpRequested = false; AttributeSelection trainSelector = new AttributeSelection();
int classIndex = -1; boolean helpRequested = false; AttributeSelection trainSelector = new AttributeSelection();
m_numToSelectStore.clear(); m_transformerStore.clear(); m_eval = new AttributeSelection();
m_numToSelectStore.clear(); m_transformerStore.clear(); m_eval = new AttributeSelection();
m_AttributeSelection = new AttributeSelection(); m_AttributeSelection.setEvaluator(m_Evaluator); m_AttributeSelection.setSearch(m_Search);
m_AttributeSelection = new AttributeSelection(); m_AttributeSelection.setEvaluator(m_Evaluator); m_AttributeSelection.setSearch(m_Search);
/** * 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(); }
search.setSearchBackwards(this.backwardSelection); this.fs = new AttributeSelection(); WrapperSubsetEval wrapper = new WrapperSubsetEval();
AttributeSelection eval = new AttributeSelection(); ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0];
AttributeSelection eval = new AttributeSelection(); ASEvaluation evalCopy = ASEvaluation.makeCopies(m_evaluatorTemplate, 1)[0];
AttributeSelection attsel = new AttributeSelection(); Ranker rankingMethod = new Ranker(); rankingMethod.setNumToSelect(topkCorrelated);