public class LinearRegression extends Object implements RevisionHandler
Modifier and Type | Field and Description |
---|---|
protected double[] |
m_Coefficients
the coefficients
|
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 |
---|---|
protected void |
calculate(Matrix a,
Matrix y,
double ridge)
performs the actual regression.
|
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.protected void calculate(Matrix a, Matrix y, double ridge)
a
- the matrix to perform the regression ony
- the dependent variable vectorridge
- the ridge parameterIllegalArgumentException
- if not successfulpublic final double[] getCoefficients()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.