![]() |
SG++-Doxygen-Documentation
|
Abstract super class to encapsulate density estimation models such as using offline/-online splitting or conjugate gradients in order to solve the system. More...
#include <ModelFittingDensityEstimation.hpp>
Public Member Functions | |
bool | adapt () override |
Improve accuracy of the fit on the given training data by adaptive refinement or coarsening of the grid and recalculate weights. | |
virtual bool | adapt (size_t newNoPoints, std::vector< size_t > &deletedGridPoints)=0 |
Performs refinement and coarsening given the new grid size and the points to coarsened. | |
double | computeResidual (DataMatrix &validationData) const override=0 |
Computes a residual to evaluate the fit of the model. | |
double | evaluate (const DataVector &sample) override=0 |
Evaluate the fitted model at a single data point. | |
void | evaluate (DataMatrix &samples, DataVector &results) override=0 |
Evaluate the fitted model on a set of data points. | |
virtual void | fit (DataMatrix &dataset)=0 |
Fit the grid to the given dataset by determining the surpluses of the initial grid by the SGDE approach. | |
virtual void | fit (DataMatrix &datasetP, DataMatrix &datasetQ)=0 |
void | fit (Dataset &dataset) override=0 |
Fit the grid to the dataset by determining the weights of an initial grid. | |
void | fit (Dataset &datasetP, Dataset &datasetQ) override=0 |
ModelFittingDensityEstimation () | |
Default constructor. | |
void | resetTraining () override=0 |
Resets any trained representations of the model, but does not reset the entire state. | |
virtual void | update (DataMatrix &samples)=0 |
Updates the model based on new data samples (streaming, batch learning). | |
virtual void | update (DataMatrix &samplesP, DataMatrix &samplesQ)=0 |
void | update (Dataset &dataset) override=0 |
Train the grid of an existing model with new samples. | |
void | update (Dataset &datasetP, Dataset &datasetQ) override=0 |
void | updateRegularization (double lambda) override=0 |
Updates the regularization parameter lambda of the underlying model. | |
![]() | |
Grid & | getGrid () |
Get the underlying grid object for the current model. | |
DataVector & | getSurpluses () |
Get the surpluses of the current grid. | |
ModelFittingBaseSingleGrid () | |
Default constructor. | |
ModelFittingBaseSingleGrid (const ModelFittingBaseSingleGrid &rhs)=delete | |
Copy constructor - we cannot deep copy all member variables yet. | |
ModelFittingBaseSingleGrid (ModelFittingBaseSingleGrid &&rhs)=default | |
Move constructor. | |
ModelFittingBaseSingleGrid & | operator= (const ModelFittingBaseSingleGrid &rhs)=delete |
Copy assign operator - we cannot deep copy all member variables yet. | |
ModelFittingBaseSingleGrid & | operator= (ModelFittingBaseSingleGrid &&rhs)=default |
Move assign operator. | |
std::string | storeFitter () |
virtual | ~ModelFittingBaseSingleGrid ()=default |
virtual destructor. | |
![]() | |
Dataset * | getDataset () |
FitterConfiguration & | getFitterConfiguration () |
Get or set the configuration of the fitter object. | |
const FitterConfiguration & | getFitterConfiguration () const |
Get the configuration of the fitter object. | |
virtual std::shared_ptr< BlacsProcessGrid > | getProcessGrid () const |
ModelFittingBase () | |
Default constructor. | |
ModelFittingBase (const ModelFittingBase &rhs)=delete | |
Copy constructor - we cannot deep copy all member variables yet. | |
ModelFittingBase (ModelFittingBase &&rhs)=default | |
Move constructor. | |
ModelFittingBase & | operator= (const ModelFittingBase &rhs)=delete |
Copy assign operator - we cannot deep copy all member variables yet. | |
ModelFittingBase & | operator= (ModelFittingBase &&rhs)=default |
Move assign operator. | |
virtual void | reset ()=0 |
Resets the state of the entire model. | |
virtual | ~ModelFittingBase ()=default |
virtual destructor. | |
Protected Member Functions | |
std::unique_ptr< sgpp::base::CoarseningFunctor > | getCoarseningFunctor () |
Returns the refinement functor suitable for the model settings. | |
std::unique_ptr< sgpp::base::RefinementFunctor > | getRefinementFunctor () |
Returns the refinement functor suitable for the model settings. | |
virtual bool | isRefinable ()=0 |
Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement) | |
![]() | |
Grid * | buildGrid (const sgpp::base::GeneralGridConfiguration &gridConfig) const |
Factory member function that generates a grid from configuration. | |
Grid * | buildGrid (const sgpp::base::GeneralGridConfiguration &gridConfig, const GeometryConfiguration &geometryConfig) const |
Factory member function that generates a grid from configuration. | |
SLESolver * | buildSolver (const SLESolverConfiguration &config) const |
Factory member function to build the solver for the least squares regression problem according to the config. | |
std::set< std::set< size_t > > | getInteractions (const GeometryConfiguration &geometryConfig) |
void | reconfigureSolver (SLESolver &solver, const SLESolverConfiguration &config) const |
Configure solver based on the desired configuration. | |
Protected Attributes | |
size_t | initialGridSize |
Initial number of grid points. | |
size_t | refinementsPerformed |
Count the amount of refinement operations performed on the current dataset. | |
![]() | |
DataVector | alpha |
hierarchical surpluses of the grid. | |
std::unique_ptr< Grid > | grid |
the sparse grid that approximates the data. | |
![]() | |
std::unique_ptr< FitterConfiguration > | config |
Configuration object for the fitter. | |
Dataset * | dataset |
Pointer to sgpp::datadriven::Dataset. | |
Dataset * | extraDataset |
std::unique_ptr< std::set< std::set< size_t > > > | interactions |
std::unique_ptr< SLESolver > | solver |
Solver for the learning problem. | |
Additional Inherited Members | |
![]() | |
bool | verboseSolver |
Whether the Solver produces output or not. | |
Abstract super class to encapsulate density estimation models such as using offline/-online splitting or conjugate gradients in order to solve the system.
sgpp::datadriven::ModelFittingDensityEstimation::ModelFittingDensityEstimation | ( | ) |
Default constructor.
|
overridevirtual |
Improve accuracy of the fit on the given training data by adaptive refinement or coarsening of the grid and recalculate weights.
Implements sgpp::datadriven::ModelFittingBase.
Reimplemented in sgpp::datadriven::ModelFittingDensityEstimationCombi.
References adapt(), sgpp::datadriven::ModelFittingBase::config, getCoarseningFunctor(), sgpp::datadriven::GridFactory::getInteractions(), getRefinementFunctor(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, initialGridSize, isRefinable(), refinementsPerformed, and sgpp::datadriven::GeometryConfiguration::stencils_.
Referenced by adapt().
|
pure virtual |
Performs refinement and coarsening given the new grid size and the points to coarsened.
newNoPoints | the grid size after refinement and coarsening |
deletedGridPoints | a list of indexes for grid points that will be removed |
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
overridepure virtual |
Computes a residual to evaluate the fit of the model.
This is useful for density estimation, because other Scores cannot be used as there are no targets.
validationData | Matrix for validation data |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
overridepure virtual |
Evaluate the fitted model at a single data point.
sample | vector with the coordinates in all dimensions of that sample. |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
overridepure 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. |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
pure virtual |
Fit the grid to the given dataset by determining the surpluses of the initial grid by the SGDE approach.
Requires only data samples and no targets (since those are irrelevant for the density estimation whatsoever)
dataset | the training dataset that is used to fit the model. |
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel, and sgpp::datadriven::ModelFittingDensityEstimationCombi.
|
pure virtual |
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel, and sgpp::datadriven::ModelFittingDensityEstimationCombi.
|
overridepure virtual |
Fit the grid to the dataset by determining the weights of an initial grid.
dataset | the training dataset that is used to fit the model. |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel, and sgpp::datadriven::ModelFittingDensityEstimationCombi.
|
overridepure virtual |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel, and sgpp::datadriven::ModelFittingDensityEstimationCombi.
|
protected |
Returns the refinement functor suitable for the model settings.
References adaptivityConfig, sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::base::AdaptivityConfiguration::coarseningFunctorType_, and sgpp::datadriven::ModelFittingBase::config.
Referenced by adapt().
|
protected |
Returns the refinement functor suitable for the model settings.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::config, and sgpp::base::AdaptivityConfiguration::refinementFunctorType_.
Referenced by adapt().
|
protectedpure virtual |
Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement)
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
Referenced by adapt().
|
overridepure virtual |
Resets any trained representations of the model, but does not reset the entire state.
The decomposition from the offline phase is kept so that it can be reused.
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
pure virtual |
Updates the model based on new data samples (streaming, batch learning).
Requires only the data samples and no targets (since those are irrelevant for the density estimation whatsoever)
samples | the new data samples |
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), and python.learner.LearnedKnowledge.LearnedKnowledge::setMemento().
|
pure virtual |
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), and python.learner.LearnedKnowledge.LearnedKnowledge::setMemento().
|
overridepure virtual |
Train the grid of an existing model with new samples.
dataset | the training dataset that is used to fit the model. |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), and python.learner.LearnedKnowledge.LearnedKnowledge::setMemento().
|
overridepure virtual |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), and python.learner.LearnedKnowledge.LearnedKnowledge::setMemento().
|
overridepure virtual |
Updates the regularization parameter lambda of the underlying model.
lambda | the new lambda parameter |
Implements sgpp::datadriven::ModelFittingBase.
Implemented in sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG, sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff, sgpp::datadriven::ModelFittingDensityEstimationCG, sgpp::datadriven::ModelFittingDensityEstimationCombi, sgpp::datadriven::ModelFittingDensityEstimationOnOff, and sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel.
|
protected |
Initial number of grid points.
Referenced by adapt().
|
protected |
Count the amount of refinement operations performed on the current dataset.
Referenced by adapt(), sgpp::datadriven::ModelFittingDensityEstimationCombi::adapt(), sgpp::datadriven::ModelFittingDensityDifferenceEstimationCG::reset(), sgpp::datadriven::ModelFittingDensityDifferenceEstimationOnOff::reset(), sgpp::datadriven::ModelFittingDensityEstimationCG::reset(), sgpp::datadriven::ModelFittingDensityEstimationCombi::reset(), sgpp::datadriven::ModelFittingDensityEstimationOnOff::reset(), sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::reset(), sgpp::datadriven::ModelFittingDensityEstimationCombi::update(), and sgpp::datadriven::ModelFittingDensityEstimationCombi::update().