mlpack  git-master
FuncSq Class Reference

Square loss function $ f(x) = 0.5 * ||Ax - b||_2^2 $. More...

Public Member Functions

 FuncSq (const arma::mat &A, const arma::vec &b)
 Construct the square loss function. More...

 
double Evaluate (const arma::mat &coords)
 Evaluation of the function. More...

 
void Gradient (const arma::mat &coords, arma::mat &gradient)
 Gradient of square loss function. More...

 
arma::mat MatrixA () const
 Get the matrix A. More...

 
arma::mat & MatrixA ()
 Modify the matrix A. More...

 
arma::vec Vectorb () const
 Get the vector b. More...

 
arma::vec & Vectorb ()
 Modify the vector b. More...

 

Detailed Description

Square loss function $ f(x) = 0.5 * ||Ax - b||_2^2 $.

Contains matrix $ A $ and vector $ b $.

Definition at line 25 of file func_sq.hpp.

Constructor & Destructor Documentation

◆ FuncSq()

FuncSq ( const arma::mat &  A,
const arma::vec &  b 
)
inline

Construct the square loss function.

Parameters
Amatrix A.
bvector b.

Definition at line 34 of file func_sq.hpp.

Member Function Documentation

◆ Evaluate()

double Evaluate ( const arma::mat &  coords)
inline

Evaluation of the function.

$ f(x) = 0.5 * ||Ax - b||_2^2 $

Parameters
coordsvector x.
Returns
$ f(x) $.

Definition at line 44 of file func_sq.hpp.

◆ Gradient()

void Gradient ( const arma::mat &  coords,
arma::mat &  gradient 
)
inline

Gradient of square loss function.

$ \nabla f(x) = A^T(Ax - b) $

Parameters
coordsinput vector x.
gradientoutput gradient vector.

Definition at line 57 of file func_sq.hpp.

◆ MatrixA() [1/2]

arma::mat MatrixA ( ) const
inline

Get the matrix A.

Definition at line 64 of file func_sq.hpp.

◆ MatrixA() [2/2]

arma::mat& MatrixA ( )
inline

Modify the matrix A.

Definition at line 66 of file func_sq.hpp.

◆ Vectorb() [1/2]

arma::vec Vectorb ( ) const
inline

Get the vector b.

Definition at line 69 of file func_sq.hpp.

◆ Vectorb() [2/2]

arma::vec& Vectorb ( )
inline

Modify the vector b.

Definition at line 71 of file func_sq.hpp.


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