|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.linearsystem.OLSSolver
public class OLSSolver
This class solves a system of over-determined linear equations in the ordinary least square sense.
An over-determined system, which is represented by
Ax = y has more rows than columns.
That is, there are more equations than unknowns.
One application of this is linear regression, where A is the independent factors of a data set.
y is the dependent observation of the data set.
The solution x_hat is such that
|| Ax - y ||2 is minimized.
That is, it is the best approximation that
minimizes the sum of squared differences between the data values and their corresponding modeled values.
The approach is called "linear" least squares since the solution,
x_hat = (AtA)-1Aty,
depends linearly on the data.
Our implementations do not use the above formula to solve for x_hat
because of the numerical stability problem in computing AtA.
Instead, we use the orthogonal decomposition methods.
| Nested Class Summary | |
|---|---|
static class |
OLSSolver.Method
the methods available to solve an Ordinary Least Square problem |
| Field Summary | |
|---|---|
double |
epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0 |
| Constructor Summary | |
|---|---|
OLSSolver(Matrix A)
Construct an OLS solver for a matrix A, where
Ax = y. |
|
OLSSolver(Matrix A,
OLSSolver.Method method,
double epsilon)
Construct an OLS solver for a matrix A, where
Ax = y |
|
| Method Summary | |
|---|---|
Vector |
solve(Vector y)
In the ordinary least square sense, solve Ax = y. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final double epsilon
| Constructor Detail |
|---|
public OLSSolver(Matrix A,
OLSSolver.Method method,
double epsilon)
A, where
Ax = y
A - a matrixmethod - one of the OLSSolver.Method to useepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0public OLSSolver(Matrix A)
A, where
Ax = y.
A - a matrix| Method Detail |
|---|
public Vector solve(Vector y)
Ax = y.
y - a vector
x_hat such that
|| Ax - y ||2 is minimized.
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||