Package weka.core.matrix
Class LinearRegression
- java.lang.Object
-
- weka.core.matrix.LinearRegression
-
- All Implemented Interfaces:
RevisionHandler
public class LinearRegression extends java.lang.Object implements RevisionHandler
Class for performing (ridged) linear regression using Tikhonov regularization.- Version:
- $Revision: 9768 $
- Author:
- Fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description LinearRegression(Matrix a, Matrix y, double ridge)Performs a (ridged) linear regression.LinearRegression(Matrix a, Matrix y, double[] w, double ridge)Performs a weighted (ridged) linear regression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]getCoefficients()returns the calculated coefficientsjava.lang.StringgetRevision()Returns the revision string.java.lang.StringtoString()returns the coefficients in a string representation
-
-
-
Constructor Detail
-
LinearRegression
public LinearRegression(Matrix a, Matrix y, double ridge)
Performs a (ridged) linear regression.- Parameters:
a- the matrix to perform the regression ony- the dependent variable vectorridge- the ridge parameter- Throws:
java.lang.IllegalArgumentException- if not successful
-
LinearRegression
public LinearRegression(Matrix a, Matrix y, double[] w, double ridge)
Performs a weighted (ridged) linear regression.- Parameters:
a- the matrix to perform the regression ony- the dependent variable vectorw- the array of data point weightsridge- the ridge parameter- Throws:
java.lang.IllegalArgumentException- if the wrong number of weights were provided.
-
-
Method Detail
-
getCoefficients
public final double[] getCoefficients()
returns the calculated coefficients- Returns:
- the coefficients
-
toString
public java.lang.String toString()
returns the coefficients in a string representation- Overrides:
toStringin classjava.lang.Object
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
-