SG++-Doxygen-Documentation
|
Fitter object that encapsulates the usage of sparse grid density estimation with identity as regularization. More...
#include <ModelFittingDensityEstimationCG.hpp>
Public Member Functions | |
double | evaluate (const DataVector &sample) override |
Evaluate the fitted density at a single data point - requires a trained grid. More... | |
void | evaluate (DataMatrix &samples, DataVector &results) override |
Evaluate the fitted density on a set of data points - requires a trained grid. More... | |
void | fit (Dataset &dataset) override |
Fit the grid to the given dataset by determining the weights of the initial grid by the SGDE approach. More... | |
void | fit (DataMatrix &dataset) |
Fit the grid to the given dataset by determining the weights of the initial grid by the SGDE approach. More... | |
ModelFittingDensityEstimationCG (const FitterConfigurationDensityEstimation &config) | |
Constructor. More... | |
bool | refine (size_t newNoPoints, std::list< size_t > *deletedGridPoints) |
Performs a refinement given the new grid size and the points to coarsened. More... | |
void | reset () override |
Resets the state of the entire model. More... | |
void | update (Dataset &dataset) override |
Train the grid of an existing model with new samples. More... | |
void | update (DataMatrix &samples) |
Updates the model based on new data samples (streaming, batch learning). More... | |
Public Member Functions inherited from sgpp::datadriven::ModelFittingDensityEstimation | |
sgpp::base::RefinementFunctor * | getRefinementFunctor () |
Returns the refinement functor suitable for the model settings. More... | |
ModelFittingDensityEstimation () | |
Default constructor. More... | |
bool | refine () override |
Improve accuracy of the fit on the given training data by adaptive refinement of the grid and recalculate weights. More... | |
Public Member Functions inherited from sgpp::datadriven::ModelFittingBaseSingleGrid | |
Grid & | getGrid () |
Get the underlying grid object for the current model. More... | |
DataVector & | getSurpluses () |
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... | |
ModelFittingBaseSingleGrid & | operator= (const ModelFittingBaseSingleGrid &rhs)=delete |
Copy assign operator - we cannot deep copy all member variables yet. More... | |
ModelFittingBaseSingleGrid & | operator= (ModelFittingBaseSingleGrid &&rhs)=default |
Move assign operator. More... | |
virtual | ~ModelFittingBaseSingleGrid ()=default |
virtual destructor. More... | |
Public Member Functions inherited from sgpp::datadriven::ModelFittingBase | |
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 | ~ModelFittingBase ()=default |
virtual destructor. More... | |
Additional Inherited Members | |
Public Attributes inherited from sgpp::datadriven::ModelFittingBase | |
bool | verboseSolver |
Whether the Solver produces output or not. More... | |
Protected Member Functions inherited from sgpp::datadriven::ModelFittingBase | |
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 inherited from sgpp::datadriven::ModelFittingDensityEstimation | |
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< Grid > | grid |
the sparse grid that approximates the data. More... | |
Protected Attributes inherited from sgpp::datadriven::ModelFittingBase | |
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... | |
Fitter object that encapsulates the usage of sparse grid density estimation with identity as regularization.
Allows usage of different grids, different solvers and different regularization techniques based on the provided configuration objects.
|
explicit |
Constructor.
config | configuration object that specifies grid, refinement, and regularization |
References sgpp::datadriven::ModelFittingBase::config.
|
overridevirtual |
Evaluate the fitted density at a single data point - requires a trained grid.
sample | vector with the coordinates in all dimensions of that sample. |
Implements sgpp::datadriven::ModelFittingBase.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::op_factory::createOperationEval(), and sgpp::datadriven::ModelFittingBaseSingleGrid::grid.
|
overridevirtual |
Evaluate the fitted density on a set of data points - requires a trained grid.
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.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::op_factory::createOperationMultipleEval(), sgpp::base::OperationMultipleEval::eval(), and sgpp::datadriven::ModelFittingBaseSingleGrid::grid.
|
overridevirtual |
Fit the grid to the given dataset by determining the weights of the initial grid by the SGDE approach.
dataset | the training dataset that is used to fit the model. |
Implements sgpp::datadriven::ModelFittingBase.
References sgpp::datadriven::ModelFittingBase::dataset, and sgpp::datadriven::Dataset::getData().
Referenced by update().
|
virtual |
Fit the grid to the given dataset by determining the weights 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. |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::buildGrid(), sgpp::datadriven::ModelFittingBase::config, sgpp::base::DataMatrix::getNcols(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, reset(), sgpp::base::DataVector::setAll(), and update().
|
virtual |
Performs a refinement 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 |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::base::DataVector::remove(), and sgpp::base::DataVector::resizeZero().
|
overridevirtual |
Resets the state of the entire model.
Implements sgpp::datadriven::ModelFittingBase.
References sgpp::datadriven::ModelFittingDensityEstimation::refinementsPerformed.
Referenced by fit().
|
overridevirtual |
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.
References python.utils.pca_normalize_dataset::C, sgpp::datadriven::ModelFittingBase::config, sgpp::op_factory::createOperationIdentity(), sgpp::op_factory::createOperationLaplace(), sgpp::datadriven::ModelFittingBase::dataset, sgpp::datadriven::Dataset::getData(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, sgpp::datadriven::Identity, and sgpp::datadriven::Laplace.
Referenced by fit().
|
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 |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::base::DataVector::add(), sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, python.utils.pca_normalize_dataset::C, sgpp::datadriven::ModelFittingBase::config, fit(), sgpp::base::DataMatrix::getNrows(), sgpp::base::Grid::getSize(), sgpp::base::DataVector::mult(), and sgpp::solver::ConjugateGradients::solve().