#include <regressors.hpp>
Regulariser class for the LinearRegressor.
Produces a diagonal matrix with a regularisation value (lambda) on the diagonal that can be added to the data matrix. Lambda can either be fixed or calculated from the data matrix.
The method to calculate the regularisation factor lambda.
Enumerator |
---|
Manual |
Use the given param value as lambda.
|
MatrixNorm |
Use \( \text{lambda} = \text{param} * \frac{\|\text{data}\|_2}{\text{numTrainingElements}} \) A suitable default for param suggested by the SDM authors is 0.5.
|
Create a new regulariser. Created with default parameters, it will not do any regularisation. Regulariser::RegularisationType can be used to specify the choice of the regularisation parameter lambda.
regularise_last_row
is useful to specify the regularisation behaviour in the case the last row of the data matrix contains an affine (offset or bias) component. In that case, you might not want to regularise it (or maybe you do).
- Parameters
-
[in] | regularisation_type | Specifies how to calculate lambda. |
[in] | param | Lambda, or a factor, depending on regularisationType. |
[in] | regularise_last_row | Specifies if the last row should be regularised. |
cv::Mat superviseddescent::Regulariser::get_matrix |
( |
cv::Mat |
data, |
|
|
int |
num_training_elements |
|
) |
| |
|
inline |
Calculates a diagonal regularisation matrix, given the RegularisationType and param of the regulariser. It will have the same dimensions as the given data matrix.
- Parameters
-
[in] | data | Data matrix that might be used to calculate an automatic value for lambda. |
[in] | num_training_elements | Number of training elements. |
- Returns
- Returns a diagonal regularisation matrix with the same dimensions as the given data matrix.
The documentation for this class was generated from the following file: