MLpp
ml::LinearRegression::RecursiveMultivariateOLS Class Reference

Recursive multivariate Ordinary Least Squares. More...

#include <RecursiveMultivariateOLS.hpp>

Public Member Functions

 RecursiveMultivariateOLS ()
 Initialises without data.
 
 RecursiveMultivariateOLS (Eigen::Ref< const Eigen::MatrixXd > X, Eigen::Ref< const Eigen::VectorXd > y)
 Initialises with the first sample and calculates the first beta estimate. More...
 
void update (Eigen::Ref< const Eigen::MatrixXd > X, Eigen::Ref< const Eigen::VectorXd > y)
 Updates the beta estimate with a new sample. More...
 
unsigned int n () const
 Returns the number of data points seen so far.
 
unsigned int d () const
 Returns the dimension of data points. If n() == 0, returs 0.
 
const Eigen::VectorXd & beta () const
 Returns the current estimate of beta. If n() == 0, returns an empty vector.
 

Detailed Description

Recursive multivariate Ordinary Least Squares.

Given a stream of pairs \((X_i, \vec{y}_i)\), updates the least-squares estimate for \(\vec{\beta}\) using the model

\( \vec{y}_0 = X_0^T \vec{\beta} + \vec{e}_0 \)

\( \vec{y}_1 = X_1^T \vec{\beta} + \vec{e}_1 \)

...

where \(\vec{e}_i\) are i.i.d. Gaussian.

Based on https://cpb-us-w2.wpmucdn.com/sites.gatech.edu/dist/2/436/files/2017/07/22-notes-6250-f16.pdf

Constructor & Destructor Documentation

◆ RecursiveMultivariateOLS()

ml::LinearRegression::RecursiveMultivariateOLS::RecursiveMultivariateOLS ( Eigen::Ref< const Eigen::MatrixXd >  X,
Eigen::Ref< const Eigen::VectorXd >  y 
)

Initialises with the first sample and calculates the first beta estimate.

Parameters
[in]XD x N matrix of X values, with data points in columns.
[in]yY vector with length N.
Exceptions
std::invalid_argumentIf y.size() != X.cols() or X.cols() < X.rows().

Member Function Documentation

◆ update()

void ml::LinearRegression::RecursiveMultivariateOLS::update ( Eigen::Ref< const Eigen::MatrixXd >  X,
Eigen::Ref< const Eigen::VectorXd >  y 
)

Updates the beta estimate with a new sample.

Parameters
[in]XD x N matrix of X values, with data points in columns.
[in]yY vector with length N.
Exceptions
std::invalid_argumentIf (X, y) is the first sample (i.e., n() == 0) and X.cols() < X.rows(), or y.size() != X.cols().

The documentation for this class was generated from the following file: