Result of a multivariate regularised regression with intercept.
More...
#include <LinearRegression.hpp>
|
Eigen::VectorXd | predict (Eigen::Ref< const Eigen::MatrixXd > X) const |
| Predicts Y given X. More...
|
|
double | predict_single (Eigen::Ref< const Eigen::VectorXd > x) const |
| Predicts Y given X. More...
|
|
double | var_y () const |
| Estimated variance of observations Y, equal to rss / dof .
|
|
double | r2 () const |
| R2 coefficient. More...
|
|
double | adjusted_r2 () const |
| Adjusted R2 coefficient. More...
|
|
Result of a multivariate regularised regression with intercept.
Regularisation is applied to everything except the intercept, which is the last coefficient in beta
.
Contrary to MultivariateOLSResult, it does not assume that inputs X
contain a row of 1s.
var_y is calculated using dof as the denominator.
◆ predict()
Eigen::VectorXd ml::LinearRegression::RegularisedRegressionResult::predict |
( |
Eigen::Ref< const Eigen::MatrixXd > |
X | ) |
const |
Predicts Y given X.
- Parameters
-
X | Matrix of independent variables with data points in columns. |
- Returns
- Vector of predicted Y(X) with size
X.cols()
.
- Exceptions
-
std::invalid_argument | If X.rows() + 1 != beta.size() . |
◆ predict_single()
double ml::LinearRegression::RegularisedRegressionResult::predict_single |
( |
Eigen::Ref< const Eigen::VectorXd > |
x | ) |
const |
Predicts Y given X.
- Parameters
-
x | Vector of independent variables. |
- Returns
- Predicted Y(X).
- Exceptions
-
std::invalid_argument | If X.size() + 1 != beta.size() . |
◆ beta
Eigen::VectorXd ml::LinearRegression::RegularisedRegressionResult::beta |
Fitted coefficients of the model \(\hat{y} = \vec{\beta'} \cdot \vec{x} + \beta_0 \), concatenated as \( (\vec{\beta'}, \beta_0) \).
◆ effective_dof
double ml::LinearRegression::RegularisedRegressionResult::effective_dof |
Effective number of residual degrees of freedom \( N - \mathrm{tr} [ X^T (X X^T + \lambda I)^{-1} X ] - 1 \).
The documentation for this struct was generated from the following file: