public class RLS extends java.lang.Object implements OnlineRegression<double[]>
| Modifier and Type | Class and Description |
|---|---|
static class |
RLS.Trainer
Trainer for linear regression by recursive least squares.
|
| Constructor and Description |
|---|
RLS(double[][] x,
double[] y)
Constructor.
|
RLS(double[][] x,
double[] y,
double lambda)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
coefficients()
Returns the linear coefficients, of which the last element is the intercept.
|
double |
getForgettingFactor()
Get the forgetting factor
|
void |
learn(double[][] x,
double[] y)
Learn a new instance with online regression.
|
void |
learn(double[] x,
double y)
Learn a new instance with online regression.
|
double |
predict(double[] x)
Predicts the dependent variable of an instance.
|
void |
setForgettingFactor(double lambda)
Set the forgetting factor
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpredictpublic RLS(double[][] x,
double[] y)
x - a matrix containing the explanatory variables. NO NEED to include a constant column of 1s for bias.y - the response values.public RLS(double[][] x,
double[] y,
double lambda)
x - a matrix containing the explanatory variables. NO NEED to include a constant column of 1s for bias.y - the response values.lambda - the forgetting factor.public double[] coefficients()
public double predict(double[] x)
Regressionpredict in interface Regression<double[]>x - the instance.public void learn(double[][] x,
double[] y)
x - the training instances.y - the target values.public void learn(double[] x,
double y)
learn in interface OnlineRegression<double[]>x - the training instance.y - the target value.public double getForgettingFactor()
public void setForgettingFactor(double lambda)
lambda - the forgetting factor