example::LinearModel

example::LinearModel #

Linear Regression Model.
#include <linear_model.h>

Inherited by example::PoissonModel

Public Functions #

Name
LinearModel(const arma::mat & x, const arma::mat & z)
Constructs and fits a new LinearModel.
LinearModel(const arma::mat & C, const arma::vec & d, const arma::mat & R)
Constructs a new LinearModel.
auto C() const
get output matrix (C)
auto d() const
get output bias (d)
auto R() const
get measurement noise covariance (R)
auto simulate(const arma::mat & x, bool add_noise =false)
simulates linear model

Public Attributes #

Name
const size_t n_x
number of input channels
const size_t n_y
number of output channels

Protected Attributes #

Name
arma::mat C_
output matrix
arma::vec d_
output bias


Public Function Details #

LinearModel #

LinearModel(
    const arma::mat & x,
    const arma::mat & z
)

Parameters:

  • x Input data [n_x x n_t]
  • z Measured output data [n_y x n_t]

Given input/output data, constructs and fits a new LinearModel:

\[ \mathbf{y}_t = \mathbf{C} \mathbf{x}_{t} + \mathbf{d} \] \[ \mathbf{z}_t \sim \mathcal{N}\left(\mathbf{y}_t , \mathbf{R} \right) \]

where \( \mathbf{x}_{t} \) , \( \mathbf{y}_{t} \) , and \( \mathbf{z}_{t} \) the input, output, and measurement, respectively; \( \mathbf{C} \) is the output matrix; \( \mathbf{d} \) is the output bias; and \( \mathbf{R} \) is the covariance of the assumed Gaussian measurement noise.


LinearModel #

LinearModel(
    const arma::mat & C,
    const arma::vec & d,
    const arma::mat & R
)

Parameters:

  • C output matrix
  • d output bias
  • R measurement noise covariance

Constructs a new LinearModel from parameters:

\[ \mathbf{y}_t = \mathbf{C} \mathbf{x}_{t} + \mathbf{d} \] \[ \mathbf{z}_t \sim \mathcal{N}\left(\mathbf{y}_t , \mathbf{R} \right) \]

where \( \mathbf{x}_{t} \) , \( \mathbf{y}_{t} \) , and \( \mathbf{z}_{t} \) the input, output, and measurement, respectively; \( \mathbf{C} \) is the output matrix; \( \mathbf{d} \) is the output bias; and \( \mathbf{R} \) is the covariance of the assumed Gaussian measurement noise.


C #

inline auto C() const

d #

inline auto d() const

R #

inline auto R() const

simulate #

auto simulate(
    const arma::mat & x,
    bool add_noise =false
)

Parameters:

  • x input data
  • add_noise whether to add measurement noise

Return: model output


Public Attribute Details #

n_x #

const size_t n_x;

n_y #

const size_t n_y;

Protected Attribute Details #

**C_** #

arma::mat C_;

**d_** #

arma::vec d_;


Updated on 4 March 2021 at 09:51:17 CST