List of usage examples for weka.attributeSelection AttributeSelection CrossValidateAttributes
public String CrossValidateAttributes() throws Exception
From source file:old.CFS.java
/** * uses the low level approach//from ww w . ja v a 2 s. com * @param data */ protected static void useLowLevel(Instances data) throws Exception { System.out.println("\n3. Low-level"); AttributeSelection attsel = new AttributeSelection(); ChiSquaredAttributeEval eval = new ChiSquaredAttributeEval(); Ranker search = new Ranker(); search.setThreshold(-1.7976931348623157E308); search.setNumToSelect(1000); attsel.setEvaluator(eval); attsel.setSearch(search); attsel.setFolds(10); attsel.setXval(true); attsel.SelectAttributes(data); // System.out.println(data.toSummaryString()); // attsel.selectAttributesCVSplit(data); // attsel.SelectAttributes(data); System.out.println(attsel.CrossValidateAttributes()); // attsel.SelectAttributes(data); // attsel.selectAttributesCVSplit(data); Instances newData = attsel.reduceDimensionality(data); int[] indices = attsel.selectedAttributes(); System.out.println(newData); System.out.println("selected attribute indices (starting with 0):\n" + Utils.arrayToString(indices)); }