MLPACK  1.0.4
Public Member Functions | Private Attributes
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 (const LinearRegression &linearRegression)
 Copy constructor.
 LinearRegression ()
 Default constructor.
 ~LinearRegression ()
 Destructor - no work done.
const arma::vec & Parameters () const
 Return the parameters (the b vector).
arma::vec & Parameters ()
 Modify 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:
predictorsX, matrix of data points to create B with.
responsesy, the measured data for each point in X
mlpack::regression::LinearRegression::LinearRegression ( const std::string &  filename)

Initialize the model from a file.

Parameters:
filenamethe name of the file to load the model from.

Copy constructor.

Parameters:
linearRegressionthe other instance to copy parameters from.

Default constructor.

Definition at line 61 of file linear_regression.hpp.

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.

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:
pointsthe data points to calculate with.
predictionsy, 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: