本文整理汇总了Java中weka.attributeSelection.AttributeSelection.selectedAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSelection.selectedAttributes方法的具体用法?Java AttributeSelection.selectedAttributes怎么用?Java AttributeSelection.selectedAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.attributeSelection.AttributeSelection
的用法示例。
在下文中一共展示了AttributeSelection.selectedAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: featureSelection
import weka.attributeSelection.AttributeSelection; //导入方法依赖的package包/类
/**
* Method featureSelection, which uses an algorithm to select the most representative features of
* the data in patterns_krs table
*
* @param data The instances from patterns_krs table
*
* @return indexes The indexes of the attributes selected by the algorithm
*/
public int[] featureSelection(Instances data){
int[] indexes = null;
AttributeSelection attsel = new AttributeSelection();
//FuzzyRoughSubsetEval eval = new FuzzyRoughSubsetEval();
//HillClimber search = new HillClimber();
CfsSubsetEval eval = new CfsSubsetEval();
GreedyStepwise search = new GreedyStepwise();
attsel.setEvaluator(eval);
attsel.setSearch(search);
try {
attsel.SelectAttributes(data);
indexes = attsel.selectedAttributes();
logger.info("Selected Features: "+Utils.arrayToString(indexes));
} catch (Exception e) {
e.printStackTrace();
}
return indexes;
}
示例2: selectFeatures
import weka.attributeSelection.AttributeSelection; //导入方法依赖的package包/类
public void selectFeatures(){
AttributeSelection attSelection = new AttributeSelection();
CfsSubsetEval eval = new CfsSubsetEval();
BestFirst search = new BestFirst();
attSelection.setEvaluator(eval);
attSelection.setSearch(search);
try {
attSelection.SelectAttributes(iris);
int[] attIndex = attSelection.selectedAttributes();
System.out.println(Utils.arrayToString(attIndex));
} catch (Exception e) {
}
}
示例3: useLowLevel
import weka.attributeSelection.AttributeSelection; //导入方法依赖的package包/类
/**
* uses the low level approach
*/
protected static void useLowLevel(Instances data) throws Exception {
System.out.println("\n3. Low-level");
AttributeSelection attsel = new AttributeSelection();
attsel.SelectAttributes(data);
int[] indices = attsel.selectedAttributes();
for (int i = 0; i < indices.length; i++) {
System.out.println(data.attribute(i).toString());
}
}