Example usage for weka.classifiers.meta Stacking setClassifiers

List of usage examples for weka.classifiers.meta Stacking setClassifiers

Introduction

In this page you can find the example usage for weka.classifiers.meta Stacking setClassifiers.

Prototype

public void setClassifiers(Classifier[] classifiers) 

Source Link

Document

Sets the list of possible classifers to choose from.

Usage

From source file:com.reactivetechnologies.platform.analytics.core.IncrementalClassifierBean.java

License:Open Source License

@Override
public RegressionModel ensembleModels(List<RegressionModel> models) {
    Stacking blend = new Stacking();
    //blend.setMetaClassifier(classifier);
    Classifier[] classifiers = new Classifier[models.size()];
    int i = 0;/* w w  w.j a v  a  2s.co  m*/
    for (RegressionModel model : models) {
        classifiers[i++] = model.getTrainedClassifier();
    }
    blend.setClassifiers(classifiers);
    RegressionModel m = new RegressionModel();
    m.setTrainedClassifier(blend);
    return m;
}

From source file:meddle.TrainModelByDomainOS.java

License:Open Source License

/**
 * Given the classifierName, return a classifier
 *
 * @param classifierName// w ww.j  a  v a 2s.c om
 *            e.g. J48, Bagging etc.
 */
public static Classifier getClassifier(String classifierName) {
    Classifier classifier = null;
    if (classifierName.equals("J48")) {
        J48 j48 = new J48();
        j48.setUnpruned(true);
        classifier = j48;
    } else if (classifierName.equals("AdaBoostM1")) {
        AdaBoostM1 adm = new AdaBoostM1();
        adm.setNumIterations(10);
        J48 j48 = new J48();
        adm.setClassifier(j48);
        classifier = adm;
    } else if (classifierName.equals("Bagging")) {
        Bagging bagging = new Bagging();
        bagging.setNumIterations(10);
        J48 j48 = new J48();
        bagging.setClassifier(j48);
        classifier = bagging;
    } else if (classifierName.equals("Stacking")) {
        Stacking stacking = new Stacking();
        stacking.setMetaClassifier(new Logistic());
        Classifier cc[] = new Classifier[2];
        cc[0] = new J48();
        cc[1] = new IBk();
        stacking.setClassifiers(cc);
        classifier = stacking;
    } else if (classifierName.equals("AdditiveRegression")) {
        AdditiveRegression ar = new AdditiveRegression();
        ar.setClassifier(new J48());
        classifier = ar;
    } else if (classifierName.equals("LogitBoost")) {
        LogitBoost lb = new LogitBoost();
        lb.setClassifier(new J48());
        classifier = lb;
    }
    return classifier;
}