Package weka.core.matrix
Class LinearRegression
java.lang.Object
weka.core.matrix.LinearRegression
- All Implemented Interfaces:
RevisionHandler
Class for performing (ridged) linear regression using Tikhonov
regularization.
- Version:
- $Revision: 9768 $
- Author:
- Fracpete (fracpete at waikato dot ac dot nz)
-
Constructor Summary
ConstructorDescriptionLinearRegression
(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
Modifier and TypeMethodDescriptionfinal double[]
returns the calculated coefficientsReturns the revision string.toString()
returns the coefficients in a string representation
-
Constructor Details
-
LinearRegression
Performs a (ridged) linear regression.- Parameters:
a
- the matrix to perform the regression ony
- the dependent variable vectorridge
- the ridge parameter- Throws:
IllegalArgumentException
- if not successful
-
LinearRegression
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:
IllegalArgumentException
- if the wrong number of weights were provided.
-
-
Method Details
-
getCoefficients
public final double[] getCoefficients()returns the calculated coefficients- Returns:
- the coefficients
-
toString
returns the coefficients in a string representation -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-