Ranker ranker = new Ranker(); InfoGainAttributeEval ig = new InfoGainAttributeEval(); Instances instances = SamplesManager.asWekaInstances(trainSet); ig.buildEvaluator(instances); firstAttributes = ranker.search(ig,instances); candidates = Arrays.copyOfRange(firstAttributes, 0, FIRST_SIZE_REDUCTION); instances = reduceDimenstions(instances, candidates) PrincipalComponents pca = new PrincipalComponents(); pca.setVarianceCovered(var); ranker = new Ranker(); ranker.setNumToSelect(numFeatures); selection = new AttributeSelection(); selection.setEvaluator(pca); selection.setSearch(ranker); selection.SelectAttributes(instances ); instances = selection.reduceDimensionality(wekaInstances);
/** * Gets the current settings of ReliefFAttributeEval. * * @return an array of strings suitable for passing to setOptions() */ @Override public String[] getOptions() { Vector<String> options = new Vector<String>(); if (!(getStartSet().equals(""))) { options.add("-P"); options.add("" + startSetToString()); } options.add("-T"); options.add("" + getThreshold()); options.add("-N"); options.add("" + getNumToSelect()); return options.toArray(new String[0]); }
Ranker search = new Ranker(); search.setThreshold(-1.7976931348623157E308); search.setNumToSelect(-1); search.setGenerateRanking(true); attsel.setEvaluator(eval); attsel.setSearch(search);
/** * Calls a specified {@link AttributeEvaluator} to evaluate each feature * attribute of specified {@link MultiLabelInstances} data set, excluding * labels. Internally it uses {@link weka.attributeSelection.Ranker} * * @param attributeEval the attribute evaluator to guide the search * @param mlData the multi-label instances data set * @return an array (not necessarily ordered) of selected attribute indexes * @throws Exception if an error occur in search */ public int[] search(AttributeEvaluator attributeEval, MultiLabelInstances mlData) throws Exception { Instances data = RemoveAllLabels.transformInstances(mlData); weka.attributeSelection.Ranker wekaRanker = new weka.attributeSelection.Ranker(); int[] indices = wekaRanker.search((ASEvaluation) attributeEval, data); // convert these to feature indices int[] featureIndices = mlData.getFeatureIndices(); int[] finalIndices = new int[indices.length]; for (int i=0; i<indices.length; i++) finalIndices[i] = featureIndices[indices[i]]; return finalIndices; } }
Ranker rankingMethod = new Ranker(); rankingMethod.setNumToSelect(topkCorrelated); attsel.setEvaluator(eval); attsel.setSearch(rankingMethod);
public void setOptions(String[] options) throws Exception { String optionString; resetOptions(); setStartSet(optionString); Double temp; temp = Double.valueOf(optionString); setThreshold(temp.doubleValue()); setNumToSelect(Integer.parseInt(optionString));
if (!(getStartSet().equals(""))) { m_starting = m_startRange.getSelection(); if (!inStarting(i)) { m_attributeList[j++] = i; double[][] tempRanked = rankedAttributes(); int[] rankedAttributes = new int[m_attributeList.length];
m_calculatedNumToSelect = bestToWorst.length; } else { determineNumToSelectFromThreshold(bestToWorst);
public void setOptions(String[] options) throws Exception { String optionString; resetOptions(); setStartSet(optionString); Double temp; temp = Double.valueOf(optionString); setThreshold(temp.doubleValue()); setNumToSelect(Integer.parseInt(optionString));
if (!(getStartSet().equals(""))) { m_starting = m_startRange.getSelection(); if (!inStarting(i)) { m_attributeList[j++] = i; double[][] tempRanked = rankedAttributes(); int[] rankedAttributes = new int[m_attributeList.length];
return getStartSet();
m_calculatedNumToSelect = bestToWorst.length; } else { determineNumToSelectFromThreshold(bestToWorst);
/** * Creates a default Ranker. * * @return the search algorithm */ public ASSearch getSearch() { return new Ranker(); }
/** * Gets the current settings of ReliefFAttributeEval. * * @return an array of strings suitable for passing to setOptions() */ @Override public String[] getOptions() { Vector<String> options = new Vector<String>(); if (!(getStartSet().equals(""))) { options.add("-P"); options.add("" + startSetToString()); } options.add("-T"); options.add("" + getThreshold()); options.add("-N"); options.add("" + getNumToSelect()); return options.toArray(new String[0]); }
/** Creates a default Ranker */ public ASSearch getSearch() { return new Ranker(); }
/** Creates a default Ranker */ public ASSearch getSearch() { return new Ranker(); }
/** Creates a default Ranker */ public ASSearch getSearch() { return new Ranker(); }
/** Creates a default Ranker */ public ASSearch getSearch() { return new Ranker(); }