Example usage for weka.classifiers.functions LinearRegression SELECTION_NONE

List of usage examples for weka.classifiers.functions LinearRegression SELECTION_NONE

Introduction

In this page you can find the example usage for weka.classifiers.functions LinearRegression SELECTION_NONE.

Prototype

int SELECTION_NONE

To view the source code for weka.classifiers.functions LinearRegression SELECTION_NONE.

Click Source Link

Document

Attribute selection method: No attribute selection

Usage

From source file:br.com.ufu.lsi.rebfnetwork.RBFNetwork.java

License:Open Source License

/**
 * Builds the classifier/* w w  w  .j  a v  a 2 s.c o  m*/
 *
 * @param instances the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances instances) throws Exception {

    // can classifier handle the data?
    getCapabilities().testWithFail(instances);

    // remove instances with missing class
    instances = new Instances(instances);
    instances.deleteWithMissingClass();

    // only class? -> build ZeroR model
    if (instances.numAttributes() == 1) {
        System.err.println(
                "Cannot build model (only class attribute present in data!), " + "using ZeroR model instead!");
        m_ZeroR = new weka.classifiers.rules.ZeroR();
        m_ZeroR.buildClassifier(instances);
        return;
    } else {
        m_ZeroR = null;
    }

    m_standardize = new Standardize();
    m_standardize.setInputFormat(instances);
    instances = Filter.useFilter(instances, m_standardize);

    SimpleKMeans sk = new SimpleKMeans();
    sk.setNumClusters(m_numClusters);
    sk.setSeed(m_clusteringSeed);
    MakeDensityBasedClusterer dc = new MakeDensityBasedClusterer();
    dc.setClusterer(sk);
    dc.setMinStdDev(m_minStdDev);
    m_basisFilter = new ClusterMembership();
    m_basisFilter.setDensityBasedClusterer(dc);
    m_basisFilter.setInputFormat(instances);
    Instances transformed = Filter.useFilter(instances, m_basisFilter);

    if (instances.classAttribute().isNominal()) {
        m_linear = null;
        m_logistic = new Logistic();
        m_logistic.setRidge(m_ridge);
        m_logistic.setMaxIts(m_maxIts);
        m_logistic.buildClassifier(transformed);
    } else {
        m_logistic = null;
        m_linear = new LinearRegression();
        m_linear.setAttributeSelectionMethod(
                new SelectedTag(LinearRegression.SELECTION_NONE, LinearRegression.TAGS_SELECTION));
        m_linear.setRidge(m_ridge);
        m_linear.buildClassifier(transformed);
    }
}

From source file:edu.utexas.cs.tactex.utils.RegressionUtils.java

License:Open Source License

public static LinearRegression createLinearRegression() {
    LinearRegression linreg = new LinearRegression();
    linreg.setAttributeSelectionMethod(//from w  w w  .ja v a 2 s.c  o m
            new SelectedTag(LinearRegression.SELECTION_NONE, LinearRegression.TAGS_SELECTION));
    linreg.setEliminateColinearAttributes(false);
    // if wants debug info
    //linreg.setDebug(true);
    return linreg;
}

From source file:wekimini.learning.LinearRegressionModelBuilder.java

public LinearRegressionModelBuilder() {
    classifier = new LinearRegression();
    featureSelectionType = FeatureSelectionType.NONE;
    ((LinearRegression) classifier).setAttributeSelectionMethod(
            new SelectedTag(LinearRegression.SELECTION_NONE, LinearRegression.TAGS_SELECTION));
    ((LinearRegression) classifier).setEliminateColinearAttributes(removeColinear);
}

From source file:wekimini.learning.LinearRegressionModelBuilder.java

public void setFeatureSelectionType(FeatureSelectionType newType) {
    featureSelectionType = newType;/*  w w  w. jav a 2 s  .  c om*/
    switch (newType) {
    case NONE:
        ((LinearRegression) classifier).setAttributeSelectionMethod(
                new SelectedTag(LinearRegression.SELECTION_NONE, LinearRegression.TAGS_SELECTION));
        break;
    case M5:
        ((LinearRegression) classifier).setAttributeSelectionMethod(
                new SelectedTag(LinearRegression.SELECTION_M5, LinearRegression.TAGS_SELECTION));
        break;
    case GREEDY:
    default:
        ((LinearRegression) classifier).setAttributeSelectionMethod(
                new SelectedTag(LinearRegression.SELECTION_GREEDY, LinearRegression.TAGS_SELECTION));
    }
}