mlpack
a scalable c++ machine learning library
mlpack: mlpack::regression::LinearRegression Class Reference

mlpack::regression::LinearRegression Class Reference

A simple linear regression algorithm using ordinary least squares. More...

List of all members.

Public Member Functions

 LinearRegression (arma::mat &predictors, const arma::vec &responses)
 Creates the model.
 LinearRegression (const std::string &filename)
 Initialize the model from a file.
 LinearRegression ()
 Default constructor.
 LinearRegression (const LinearRegression &linearRegression)
 Copy constructor.
 ~LinearRegression ()
 Destructor - no work done.
arma::vec & Parameters ()
 Modify the parameters (the b vector).
const arma::vec & Parameters () const
 Return the parameters (the b vector).
void Predict (const arma::mat &points, arma::vec &predictions)
 Calculate y_i for each data point in points.

Private Attributes

arma::vec parameters
 The calculated B.

Detailed Description

A simple linear regression algorithm using ordinary least squares.

Definition at line 33 of file linear_regression.hpp.


Constructor & Destructor Documentation

mlpack::regression::LinearRegression::LinearRegression ( arma::mat &  predictors,
const arma::vec &  responses 
)

Creates the model.

Parameters:
predictors X, matrix of data points to create B with.
responses y, the measured data for each point in X
mlpack::regression::LinearRegression::LinearRegression ( const std::string &  filename  ) 

Initialize the model from a file.

Parameters:
filename the name of the file to load the model from.
mlpack::regression::LinearRegression::LinearRegression ( const LinearRegression linearRegression  ) 

Copy constructor.

Parameters:
linearRegression the other instance to copy parameters from.
mlpack::regression::LinearRegression::LinearRegression (  )  [inline]

Default constructor.

Definition at line 61 of file linear_regression.hpp.

mlpack::regression::LinearRegression::~LinearRegression (  ) 

Destructor - no work done.


Member Function Documentation

const arma::vec& mlpack::regression::LinearRegression::Parameters (  )  const [inline]

Return the parameters (the b vector).

Definition at line 78 of file linear_regression.hpp.

References parameters.

arma::vec& mlpack::regression::LinearRegression::Parameters (  )  [inline]

Modify the parameters (the b vector).

Definition at line 80 of file linear_regression.hpp.

References parameters.

void mlpack::regression::LinearRegression::Predict ( const arma::mat &  points,
arma::vec &  predictions 
)

Calculate y_i for each data point in points.

Parameters:
points the data points to calculate with.
predictions y, will contain calculated values on completion.

Member Data Documentation

The calculated B.

Initialized and filled by constructor to hold the least squares solution.

Definition at line 87 of file linear_regression.hpp.

Referenced by Parameters().


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