SG++-Doxygen-Documentation
|
Base class for arbitrary machine learning models based on adaptive sparse grids. More...
#include <ModelFittingBase.hpp>
Public Member Functions | |
virtual double | evaluate (const DataVector &sample)=0 |
Evaluate the fitted model at a single data point. More... | |
virtual void | evaluate (DataMatrix &samples, DataVector &results)=0 |
Evaluate the fitted model on a set of data points. More... | |
virtual void | fit (Dataset &dataset)=0 |
Polymorphic clone pattern. More... | |
const FitterConfiguration & | getFitterConfiguration () const |
Get the configuration of the fitter object. More... | |
ModelFittingBase () | |
Default constructor. More... | |
ModelFittingBase (const ModelFittingBase &rhs)=delete | |
Copy constructor - we cannot deep copy all member variables yet. More... | |
ModelFittingBase (ModelFittingBase &&rhs)=default | |
Move constructor. More... | |
ModelFittingBase & | operator= (const ModelFittingBase &rhs)=delete |
Copy assign operator - we cannot deep copy all member variables yet. More... | |
ModelFittingBase & | operator= (ModelFittingBase &&rhs)=default |
Move assign operator. More... | |
virtual bool | refine ()=0 |
Improve accuracy of the model on the given training data by adaptive refinement of the grid. More... | |
virtual void | reset ()=0 |
Resets the state of the entire model. More... | |
virtual void | update (Dataset &dataset)=0 |
Train the grid of an existing model with new samples. More... | |
virtual | ~ModelFittingBase ()=default |
virtual destructor. More... | |
Public Attributes | |
bool | verboseSolver |
Whether the Solver produces output or not. More... | |
Protected Member Functions | |
Grid * | buildGrid (const RegularGridConfiguration &gridConfig) const |
Factory member function that generates a grid from configuration. More... | |
SLESolver * | buildSolver (const SLESolverConfiguration &config) const |
Factory member function to build the solver for the least squares regression problem according to the config. More... | |
void | reconfigureSolver (SLESolver &solver, const SLESolverConfiguration &config) const |
Configure solver based on the desired configuration. More... | |
Protected Attributes | |
std::unique_ptr< FitterConfiguration > | config |
Configuration object for the fitter. More... | |
Dataset * | dataset |
Pointer to sgpp::datadriven::Dataset. More... | |
std::unique_ptr< SLESolver > | solver |
Solver for the learning problem. More... | |
Base class for arbitrary machine learning models based on adaptive sparse grids.
A model tries to generalize high dimensional training data by using sparse grids. An underlying model can be trained using training data, its accuracy can be improved by using the adaptivity of sparse grids and the underlying grid(s) of a model can be retrained on other data. Once a model is trained it can be evaluated on unseen data.
sgpp::datadriven::ModelFittingBase::ModelFittingBase | ( | ) |
|
delete |
Copy constructor - we cannot deep copy all member variables yet.
rhs | const reference to the scorer object to copy from. |
|
default |
Move constructor.
rhs | R-value reference to a scorer object to moved from. |
|
virtualdefault |
virtual destructor.
|
protected |
Factory member function that generates a grid from configuration.
gridConfig | configuration for the grid object |
References sgpp::base::GeneralGridConfiguration::boundaryLevel_, sgpp::base::Grid::createLinearBoundaryGrid(), sgpp::base::Grid::createLinearGrid(), sgpp::base::Grid::createModLinearGrid(), sgpp::base::GeneralGridConfiguration::dim_, sgpp::base::Grid::getGenerator(), sgpp::base::GeneralGridConfiguration::level_, sgpp::base::GridGenerator::regular(), and sgpp::base::GeneralGridConfiguration::type_.
Referenced by sgpp::datadriven::ModelFittingLeastSquares::fit(), sgpp::datadriven::ModelFittingDensityEstimationCG::fit(), and sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit().
|
protected |
Factory member function to build the solver for the least squares regression problem according to the config.
config | configuratin for the solver object |
References python.painlesscg::BiCGStab(), sgpp::datadriven::CG, sgpp::solver::SLESolverConfiguration::eps_, sgpp::solver::SLESolverConfiguration::maxIterations_, and sgpp::solver::SLESolverConfiguration::type_.
Referenced by sgpp::datadriven::ModelFittingLeastSquares::ModelFittingLeastSquares().
|
pure virtual |
Evaluate the fitted model at a single data point.
sample | vector with the coordinates in all dimensions of that sample. |
Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
Referenced by sgpp::datadriven::Scorer::test().
|
pure virtual |
Evaluate the fitted model on a set of data points.
samples | matrix where each row represents a sample and the columns contain the coordinates in all dimensions of that sample. |
results | vector where each row will contain the evaluation of the respective sample on the current model. |
Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
|
pure virtual |
Polymorphic clone pattern.
dataset | the training dataset that is used to fit the model. |
Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
const FitterConfiguration & sgpp::datadriven::ModelFittingBase::getFitterConfiguration | ( | ) | const |
Get the configuration of the fitter object.
References config.
|
delete |
Copy assign operator - we cannot deep copy all member variables yet.
rhs | const reference to the scorer object to copy from. |
|
default |
Move assign operator.
rhs | R-value reference to an a scorer object to move from. |
|
protected |
Configure solver based on the desired configuration.
solver | the solver object to be modified. |
config | configuration updating the for the solver. |
References sgpp::solver::SLESolverConfiguration::eps_, sgpp::solver::SLESolverConfiguration::maxIterations_, sgpp::solver::SGSolver::setEpsilon(), and sgpp::solver::SGSolver::setMaxIterations().
Referenced by sgpp::datadriven::ModelFittingLeastSquares::reset().
|
pure virtual |
Improve accuracy of the model on the given training data by adaptive refinement of the grid.
Implemented in sgpp::datadriven::ModelFittingDensityEstimation, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
|
pure virtual |
Resets the state of the entire model.
Implemented in sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
|
pure virtual |
Train the grid of an existing model with new samples.
dataset | the training dataset that is used to fit the model. |
Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingClassification, and sgpp::datadriven::ModelFittingLeastSquares.
|
protected |
Configuration object for the fitter.
Referenced by sgpp::datadriven::ModelFittingClassification::evaluate(), sgpp::datadriven::ModelFittingLeastSquares::evaluate(), sgpp::datadriven::ModelFittingLeastSquares::fit(), sgpp::datadriven::ModelFittingClassification::fit(), sgpp::datadriven::ModelFittingDensityEstimationCG::fit(), sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit(), getFitterConfiguration(), sgpp::datadriven::ModelFittingDensityEstimation::getRefinementFunctor(), ModelFittingBase(), sgpp::datadriven::ModelFittingClassification::ModelFittingClassification(), sgpp::datadriven::ModelFittingDensityEstimationCG::ModelFittingDensityEstimationCG(), sgpp::datadriven::ModelFittingDensityEstimationOnOff::ModelFittingDensityEstimationOnOff(), sgpp::datadriven::ModelFittingLeastSquares::ModelFittingLeastSquares(), sgpp::datadriven::ModelFittingLeastSquares::refine(), sgpp::datadriven::ModelFittingClassification::refine(), sgpp::datadriven::ModelFittingDensityEstimationOnOff::refine(), sgpp::datadriven::ModelFittingLeastSquares::reset(), sgpp::datadriven::ModelFittingLeastSquares::update(), sgpp::datadriven::ModelFittingDensityEstimationCG::update(), and sgpp::datadriven::ModelFittingDensityEstimationOnOff::update().
|
protected |
Pointer to sgpp::datadriven::Dataset.
The initial grid is fitted on the given data. Adaptive refinement is then performed on the very same data. The used dataset used for refinement overwritten once either fit() or update() introduce a new dataset.
Referenced by sgpp::datadriven::ModelFittingLeastSquares::fit(), sgpp::datadriven::ModelFittingClassification::fit(), sgpp::datadriven::ModelFittingDensityEstimationCG::fit(), sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit(), ModelFittingBase(), sgpp::datadriven::ModelFittingLeastSquares::reset(), sgpp::datadriven::ModelFittingLeastSquares::update(), sgpp::datadriven::ModelFittingClassification::update(), sgpp::datadriven::ModelFittingDensityEstimationCG::update(), and sgpp::datadriven::ModelFittingDensityEstimationOnOff::update().
|
protected |
Solver for the learning problem.
Referenced by ModelFittingBase(), sgpp::datadriven::ModelFittingLeastSquares::ModelFittingLeastSquares(), and sgpp::datadriven::ModelFittingLeastSquares::reset().
bool sgpp::datadriven::ModelFittingBase::verboseSolver |
Whether the Solver produces output or not.
Referenced by sgpp::datadriven::ModelFittingLeastSquares::reset().