Linear Regression. More...
#include <shark/Algorithms/Trainers/LinearRegression.h>
Public Member Functions | |
SHARK_EXPORT_SYMBOL | LinearRegression (double regularization=0.0) |
std::string | name () const |
From INameable: return the class name. More... | |
double | regularization () const |
void | setRegularization (double regularization) |
RealVector | parameterVector () const |
Return the parameter vector. More... | |
void | setParameterVector (const RealVector ¶m) |
Set the parameter vector. More... | |
size_t | numberOfParameters () const |
Return the number of parameters. More... | |
SHARK_EXPORT_SYMBOL void | train (LinearModel<> &model, LabeledData< RealVector, RealVector > const &dataset) |
Public Member Functions inherited from shark::AbstractTrainer< LinearModel<> > | |
virtual void | train (ModelType &model, DatasetType const &dataset)=0 |
Core of the Trainer interface. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. More... | |
virtual void | read (InArchive &archive) |
Read the component from the supplied archive. More... | |
virtual void | write (OutArchive &archive) const |
Write the component to the supplied archive. More... | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). More... | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). More... | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Public Member Functions inherited from shark::IParameterizable<> | |
virtual | ~IParameterizable () |
Protected Attributes | |
double | m_regularization |
Additional Inherited Members | |
Public Types inherited from shark::AbstractTrainer< LinearModel<> > | |
typedef LinearModel<> | ModelType |
typedef ModelType::InputType | InputType |
typedef typename LinearModel<> ::OutputType | LabelType |
typedef LabeledData< InputType, LabelType > | DatasetType |
Public Types inherited from shark::IParameterizable<> | |
typedef RealVector | ParameterVectorType |
Linear Regression.
Linear Regression builds an affine linear model \( f(x) = A x + b \) minimizing the squared error from a dataset of pairs of vectors (x, y). That is, the error \( \sum_i (f(x_i) - y_i)^2 \) is minimized. The solution to this problem is found analytically.
Definition at line 61 of file LinearRegression.h.
SHARK_EXPORT_SYMBOL shark::LinearRegression::LinearRegression | ( | double | regularization = 0.0 | ) |
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 67 of file LinearRegression.h.
|
inlinevirtual |
Return the number of parameters.
Reimplemented from shark::IParameterizable<>.
Definition at line 87 of file LinearRegression.h.
References SHARK_EXPORT_SYMBOL, and train().
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::IParameterizable<>.
Definition at line 78 of file LinearRegression.h.
References m_regularization.
|
inline |
Definition at line 70 of file LinearRegression.h.
References m_regularization.
Referenced by setRegularization().
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::IParameterizable<>.
Definition at line 83 of file LinearRegression.h.
References m_regularization, and SIZE_CHECK.
|
inline |
Definition at line 73 of file LinearRegression.h.
References m_regularization, RANGE_CHECK, and regularization().
SHARK_EXPORT_SYMBOL void shark::LinearRegression::train | ( | LinearModel<> & | model, |
LabeledData< RealVector, RealVector > const & | dataset | ||
) |
Referenced by main(), and numberOfParameters().
|
protected |
Definition at line 93 of file LinearRegression.h.
Referenced by parameterVector(), regularization(), setParameterVector(), and setRegularization().