Example usage for weka.classifiers.meta Bagging buildClassifier

List of usage examples for weka.classifiers.meta Bagging buildClassifier

Introduction

In this page you can find the example usage for weka.classifiers.meta Bagging buildClassifier.

Prototype

@Override
public void buildClassifier(Instances data) throws Exception 

Source Link

Document

Bagging method.

Usage

From source file:AaronTest.TransformEnsembleExperiments.java

public static void ensembleTest(Instances train, Instances test) {
    //create a bagging ensemble and give it 1-NN as a base.
    Bagging bag = new Bagging();
    bag.setClassifier(new IBk(1));

    //train our bag
    try {/*w  ww. j ava 2  s  .co  m*/
        bag.buildClassifier(train);
    } catch (Exception ex) {
        System.out.println("Ex: " + ex);
    }

    double average = utilities.ClassifierTools.accuracy(test, bag);

    System.out.println("Average correct = " + average);
}