Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* SimpleLinearRegression.java
* Copyright (C) 2002-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.classifiers.functions;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import weka.classifiers.AbstractClassifier;
import weka.classifiers.evaluation.RegressionAnalysis;
import weka.core.Attribute;
import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.core.WeightedInstancesHandler;
/**
* Learns a simple linear regression model. Picks the
* attribute that results in the lowest squared error. Can only deal with
* numeric attributes.
*
*
* Valid options are:
*
*
*
* -output-debug-info
* If set, classifier is run in debug mode and
* may output additional info to the console
*
*
*
* -do-not-check-capabilities
* If set, classifier capabilities are not checked before classifier is built
* (use with caution).
*
*
*
* @author Eibe Frank ([email protected])
* @version $Revision: 15519 $
*/
public class SimpleLinearRegression extends AbstractClassifier implements
WeightedInstancesHandler {
/** for serialization */
static final long serialVersionUID = 1679336022895414137L;
/** The chosen attribute */
private Attribute m_attribute;
/** The index of the chosen attribute */
private int m_attributeIndex;
/** The slope */
private double m_slope;
/** The intercept */
private double m_intercept;
/** The class mean for missing values */
private double m_classMeanForMissing;
/**
* Whether to output additional statistics such as std. dev. of coefficients
* and t-stats
*/
protected boolean m_outputAdditionalStats;
/** Degrees of freedom, used in statistical calculations */
private int m_df;
/** standard error of the slope */
private double m_seSlope = Double.NaN;
/** standard error of the intercept */
private double m_seIntercept = Double.NaN;
/** t-statistic of the slope */
private double m_tstatSlope = Double.NaN;
/** t-statistic of the intercept */
private double m_tstatIntercept = Double.NaN;
/** R^2 value for the regression */
private double m_rsquared = Double.NaN;
/** Adjusted R^2 value for the regression */
private double m_rsquaredAdj = Double.NaN;
/** F-statistic for the regression */
private double m_fstat = Double.NaN;
/** If true, suppress error message if no useful attribute was found */
private boolean m_suppressErrorMessage = false;
/**
* Returns a string describing this classifier
*
* @return a description of the classifier suitable for displaying in the
* explorer/experimenter gui
*/
public String globalInfo() {
return "Learns a simple linear regression model. "
+ "Picks the attribute that results in the lowest squared error. "
+ "Can only deal with numeric attributes.";
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
@Override
public Enumeration