List of usage examples for weka.classifiers.rules JRip distributionForInstance
@Override public double[] distributionForInstance(Instance datum)
From source file:br.com.edu.partition.Tranning.java
public static Double Tranning_JRIP(String test, String tranning) throws IOException, Exception { Double result_ = null;/* w w w .j ava 2 s.c om*/ ArffLoader loader; loader = new ArffLoader(); loader.setFile(new File(tranning)); loader.getStructure(); Instances trainingset = loader.getDataSet(); int classIndex = trainingset.numAttributes() - 1; trainingset.setClassIndex(classIndex); //J48 j48 = new J48(); JRip jRip = new JRip(); //String[] options2 = {"-F", "3", "-N", "2.0", "-O", "2", "-S", "1"}; //jRip.setOptions(options2); //jRip.buildClassifier(trainingset); jRip.buildClassifier(trainingset); loader = new ArffLoader(); loader.setFile(new File(test)); loader.getStructure(); Instances testset = loader.getDataSet(); testset.setClassIndex(testset.numAttributes() - 1); for (Instance instance : testset) { //double[] result = jRip.distributionForInstance(instance); double[] result = jRip.distributionForInstance(instance); result_ = result[1]; //System.out.println(test + " " + result[1] + " " + tranning); } return result_; }