public class LinearRegression extends Object implements RevisionHandler
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getCoefficients()
returns the calculated coefficients
|
String |
getRevision()
Returns the revision string.
|
String |
toString()
returns the coefficients in a string representation
|
public LinearRegression(Matrix a, Matrix y, double ridge)
a
- the matrix to perform the regression ony
- the dependent variable vectorridge
- the ridge parameterIllegalArgumentException
- if not successfulpublic LinearRegression(Matrix a, Matrix y, double[] w, double ridge)
a
- the matrix to perform the regression ony
- the dependent variable vectorw
- the array of data point weightsridge
- the ridge parameterIllegalArgumentException
- if the wrong number of weights were
provided.public final double[] getCoefficients()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2018 University of Waikato, Hamilton, NZ. All Rights Reserved.