/** * 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; } }
m_SubsetEval.buildEvaluator(m_Instances); m_Ranking = ranker.search(m_ASEval, m_Instances); } else { GreedyStepwise fs = new GreedyStepwise();