SG++-Doxygen-Documentation
sgpp::datadriven::ModelFittingDensityEstimation Class Referenceabstract

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>

Inheritance diagram for sgpp::datadriven::ModelFittingDensityEstimation:
sgpp::datadriven::ModelFittingBaseSingleGrid sgpp::datadriven::ModelFittingBase sgpp::datadriven::ModelFittingDensityEstimationCG sgpp::datadriven::ModelFittingDensityEstimationOnOff

Public Member Functions

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. More...
 
sgpp::base::RefinementFunctorgetRefinementFunctor ()
 Returns the refinement functor suitable for the model settings. More...
 
 ModelFittingDensityEstimation ()
 Default constructor. More...
 
virtual bool refine (size_t newNoPoints, std::list< size_t > *deletedGridPoints)=0
 Performs a refinement given the new grid size and the points to coarsened. More...
 
bool refine () override
 Improve accuracy of the fit on the given training data by adaptive refinement of the grid and recalculate weights. More...
 
virtual void update (DataMatrix &samples)=0
 Updates the model based on new data samples (streaming, batch learning). More...
 
- Public Member Functions inherited from sgpp::datadriven::ModelFittingBaseSingleGrid
GridgetGrid ()
 Get the underlying grid object for the current model. More...
 
DataVectorgetSurpluses ()
 Get the surpluses of the current grid. More...
 
 ModelFittingBaseSingleGrid ()
 Default constructor. More...
 
 ModelFittingBaseSingleGrid (const ModelFittingBaseSingleGrid &rhs)=delete
 Copy constructor - we cannot deep copy all member variables yet. More...
 
 ModelFittingBaseSingleGrid (ModelFittingBaseSingleGrid &&rhs)=default
 Move constructor. More...
 
ModelFittingBaseSingleGridoperator= (const ModelFittingBaseSingleGrid &rhs)=delete
 Copy assign operator - we cannot deep copy all member variables yet. More...
 
ModelFittingBaseSingleGridoperator= (ModelFittingBaseSingleGrid &&rhs)=default
 Move assign operator. More...
 
virtual ~ModelFittingBaseSingleGrid ()=default
 virtual destructor. More...
 
- Public Member Functions inherited from sgpp::datadriven::ModelFittingBase
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 FitterConfigurationgetFitterConfiguration () 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...
 
ModelFittingBaseoperator= (const ModelFittingBase &rhs)=delete
 Copy assign operator - we cannot deep copy all member variables yet. More...
 
ModelFittingBaseoperator= (ModelFittingBase &&rhs)=default
 Move assign operator. 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...
 

Protected Member Functions

virtual bool isRefinable ()=0
 Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement) More...
 
- Protected Member Functions inherited from sgpp::datadriven::ModelFittingBase
GridbuildGrid (const RegularGridConfiguration &gridConfig) const
 Factory member function that generates a grid from configuration. More...
 
SLESolverbuildSolver (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

size_t refinementsPerformed
 Count the amount of refinement operations performed on the current dataset. More...
 
- Protected Attributes inherited from sgpp::datadriven::ModelFittingBaseSingleGrid
DataVector alpha
 hierarchical surpluses of the grid. More...
 
std::unique_ptr< Gridgrid
 the sparse grid that approximates the data. More...
 
- Protected Attributes inherited from sgpp::datadriven::ModelFittingBase
std::unique_ptr< FitterConfigurationconfig
 Configuration object for the fitter. More...
 
Datasetdataset
 Pointer to sgpp::datadriven::Dataset. More...
 
std::unique_ptr< SLESolversolver
 Solver for the learning problem. More...
 

Additional Inherited Members

- Public Attributes inherited from sgpp::datadriven::ModelFittingBase
bool verboseSolver
 Whether the Solver produces output or not. More...
 

Detailed Description

Abstract super class to encapsulate density estimation models such as using offline/-online splitting or conjugate gradients in order to solve the system.

Constructor & Destructor Documentation

◆ ModelFittingDensityEstimation()

sgpp::datadriven::ModelFittingDensityEstimation::ModelFittingDensityEstimation ( )

Default constructor.

Member Function Documentation

◆ fit()

virtual void sgpp::datadriven::ModelFittingDensityEstimation::fit ( DataMatrix dataset)
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)

Parameters
datasetthe training dataset that is used to fit the model.

Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, and sgpp::datadriven::ModelFittingDensityEstimationOnOff.

◆ getRefinementFunctor()

RefinementFunctor * sgpp::datadriven::ModelFittingDensityEstimation::getRefinementFunctor ( )

Returns the refinement functor suitable for the model settings.

Returns
pointer to a refinement functor that suits the model settings

References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::config, and sgpp::base::AdaptivityConfiguration::refinementFunctorType.

Referenced by refine().

◆ isRefinable()

virtual bool sgpp::datadriven::ModelFittingDensityEstimation::isRefinable ( )
protectedpure virtual

Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement)

Returns
whether the model is refinable

Implemented in sgpp::datadriven::ModelFittingDensityEstimationOnOff.

Referenced by refine().

◆ refine() [1/2]

virtual bool sgpp::datadriven::ModelFittingDensityEstimation::refine ( size_t  newNoPoints,
std::list< size_t > *  deletedGridPoints 
)
pure virtual

Performs a refinement given the new grid size and the points to coarsened.

Parameters
newNoPointsthe grid size after refinement and coarsening
deletedGridPointsa list of indexes for grid points that will be removed
Returns
if the grid was refined (true)

Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, and sgpp::datadriven::ModelFittingDensityEstimationOnOff.

◆ refine() [2/2]

bool sgpp::datadriven::ModelFittingDensityEstimation::refine ( )
overridevirtual

Improve accuracy of the fit on the given training data by adaptive refinement of the grid and recalculate weights.

Returns
true if refinement could be performed based on the refinement configuration, else false.

Implements sgpp::datadriven::ModelFittingBase.

References getRefinementFunctor(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, isRefinable(), and refinementsPerformed.

◆ update()

virtual void sgpp::datadriven::ModelFittingDensityEstimation::update ( DataMatrix samples)
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)

Parameters
samplesthe new data samples

Implemented in sgpp::datadriven::ModelFittingDensityEstimationCG, and sgpp::datadriven::ModelFittingDensityEstimationOnOff.

Member Data Documentation

◆ refinementsPerformed

size_t sgpp::datadriven::ModelFittingDensityEstimation::refinementsPerformed
protected

Count the amount of refinement operations performed on the current dataset.

Referenced by refine(), sgpp::datadriven::ModelFittingDensityEstimationCG::reset(), and sgpp::datadriven::ModelFittingDensityEstimationOnOff::reset().


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