public class LinearRegression extends java.lang.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
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.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 parameterjava.lang.IllegalArgumentException
- 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 parameterjava.lang.IllegalArgumentException
- if the wrong number of weights were
provided.public final double[] getCoefficients()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler