template<class Solver = PartialPivLUSolver>
class superviseddescent::LinearRegressor< Solver >
A simple LinearRegressor that learns coefficients x for the linear relationship \( Ax = b \). This class handles learning, testing, and predicting single examples.
A Regulariser can be specified to make the least squares problem more well-behaved (or invertible, in case it is not).
Works with multi-dimensional label data. In that case, the coefficients for each label will be learned independently.
template<class Solver = PartialPivLUSolver>
Learns a linear predictor from the given data and labels.
In case the problem is not invertible, the function will return false and will most likely have learned garbage.
Note/Todo: We probably want to change the interface to return void. Not all solvers can return a bool, it's kind of optional, so we can't rely on it.
- Parameters
-
[in] | data | Training data matrix, one example per row. |
[in] | labels | Labels corresponding to the training data. |
- Returns
- Returns whether \( \text{data}^t * \text{data} \) was invertible. (Note: Always returns true at the moment.)
Implements superviseddescent::Regressor.