Linear Regression. More...
#include <shark/Algorithms/Trainers/LinearRegression.h>
 Inheritance diagram for shark::LinearRegression:
 Inheritance diagram for shark::LinearRegression:| Public Member Functions | |
| SHARK_EXPORT_SYMBOL | LinearRegression (double regularization=0.0) | 
| std::string | name () const | 
| From INameable: return the class name. | |
| double | regularization () const | 
| void | setRegularization (double regularization) | 
| RealVector | parameterVector () const | 
| Return the parameter vector. | |
| void | setParameterVector (const RealVector ¶m) | 
| Set the parameter vector. | |
| size_t | numberOfParameters () const | 
| Return the number of parameters. | |
| 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. | |
|  Public Member Functions inherited from shark::INameable | |
| virtual | ~INameable () | 
|  Public Member Functions inherited from shark::ISerializable | |
| virtual | ~ISerializable () | 
| Virtual d'tor. | |
| virtual void | read (InArchive &archive) | 
| Read the component from the supplied archive. | |
| virtual void | write (OutArchive &archive) const | 
| Write the component to the supplied archive. | |
| void | load (InArchive &archive, unsigned int version) | 
| Versioned loading of components, calls read(...). | |
| void | save (OutArchive &archive, unsigned int version) const | 
| Versioned storing of components, calls write(...). | |
| BOOST_SERIALIZATION_SPLIT_MEMBER () | |
|  Public Member Functions inherited from shark::IParameterizable< VectorType > | |
| 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 Model::OutputType | LabelType | 
| typedef LabeledData< InputType, LabelType > | DatasetType | 
|  Public Types inherited from shark::IParameterizable< VectorType > | |
| typedef VectorType | 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 60 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 66 of file LinearRegression.h.
| 
 | inlinevirtual | 
Return the number of parameters.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 86 of file LinearRegression.h.
| 
 | inlinevirtual | 
Return the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 77 of file LinearRegression.h.
References m_regularization.
| 
 | inline | 
Definition at line 69 of file LinearRegression.h.
References m_regularization.
Referenced by setRegularization().
| 
 | inlinevirtual | 
Set the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 82 of file LinearRegression.h.
References m_regularization, and SIZE_CHECK.
| 
 | inline | 
Definition at line 72 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().
| 
 | protected | 
Definition at line 92 of file LinearRegression.h.
Referenced by parameterVector(), regularization(), setParameterVector(), and setRegularization().