#include <regressors.hpp>
Public Member Functions | |
cv::Mat | solve (cv::Mat data, cv::Mat labels, Regulariser regulariser) |
A solver that the LinearRegressor uses to solve its system of linear equations. It needs a solve function with the following signature: cv::Mat
solve(cv::Mat data, cv::Mat labels, Regulariser regulariser)
The ColPivHouseholderQRSolver
can check for invertibility, but it is much MUCH slower than a PartialPivLUSolver
.
|
inline |
Solves the linear system \( (\text{data}^t * \text{data} + \text{regulariser}) * X = \text{data}^t * \text{labels}\) where Regulariser
is a diagonal matrix. This results in a least-squares approximation of the original system. labels
can consist of multiple columns.
Note/Todo: we should leave the choice of inverting A or AtA to the solver. But this also means we need to pass through the regularisation params. We can't just pass a cv::Mat regularisation because the dimensions for regularising A and AtA are different.
[in] | data | Data matrix with each row being a data sample. |
[in] | labels | Labels for each data sample. |
[in] | regulariser | A regularisation. |