List of usage examples for weka.attributeSelection CfsSubsetEval setLocallyPredictive
public void setLocallyPredictive(boolean b)
From source file:RunBestFirstSearch.java
License:Open Source License
protected static void runAttributeSelection(Instances data, int n) throws Exception { AttributeSelection attsel = new AttributeSelection(); CfsSubsetEval cost_function = new CfsSubsetEval(); // CFS cost function. BestFirst algorithm = new BestFirst(); // BFS algorithm. cost_function.buildEvaluator(data);//from w w w .ja va 2 s. c o m algorithm.setLookupCacheSize(n); // BFS with forward direction and terminating search after five // non-improving nodes. // String[] parameters = { "-D 1", "-N 5" }; algorithm.setOptions(parameters); cost_function.setLocallyPredictive(false); attsel.setEvaluator(cost_function); attsel.setSearch(algorithm); attsel.SelectAttributes(data); int[] indices = attsel.selectedAttributes(); System.out.println("Selected features:\n" + Utils.arrayToString(indices)); }