![]() |
SG++-Doxygen-Documentation
|
Fitter object that encapsulates the usage of sparse grid density estimation with identity as regularization. More...
#include <ModelFittingDensityEstimationOnOffParallel.hpp>
Public Member Functions | |
bool | adapt (size_t newNoPoints, std::vector< size_t > &deletedGridPoints) override |
Performs refinement and coarsening given the new grid size and the points to coarsened. | |
double | computeResidual (DataMatrix &validationData) const override |
Should compute some kind of Residual to evaluate the fit of the model. | |
double | evaluate (const DataVector &sample) override |
Evaluate the fitted density at a single data point - requires a trained grid. | |
void | evaluate (DataMatrix &samples, DataVector &results) override |
Evaluate the fitted density on a set of data points - requires a trained grid. | |
void | fit (DataMatrix &dataset) override |
Fit the grid to the given dataset by determining the weights of the initial grid by the SGDE approach. | |
void | fit (DataMatrix &datasetP, DataMatrix &datasetQ) override |
void | fit (Dataset &dataset) override |
Fit the grid to the given dataset by determining the weights of the initial grid by the SGDE approach. | |
void | fit (Dataset &datasetP, Dataset &datasetQ) override |
std::shared_ptr< BlacsProcessGrid > | getProcessGrid () const override |
bool | isRefinable () override |
Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement) | |
ModelFittingDensityEstimationOnOffParallel (const FitterConfigurationDensityEstimation &config) | |
Constructor. | |
ModelFittingDensityEstimationOnOffParallel (const FitterConfigurationDensityEstimation &config, std::shared_ptr< BlacsProcessGrid > processGrid) | |
Constructor. | |
void | reset () override |
Resets the state of the entire model. | |
void | resetTraining () override |
Resets any trained representations of the model, but does not reset the entire state. | |
void | update (DataMatrix &samples) override |
Updates the model based on new data samples (streaming, batch learning). | |
void | update (DataMatrix &samplesP, DataMatrix &samplesQ) override |
void | update (Dataset &dataset) override |
Update the density estimation with new data. | |
void | update (Dataset &datasetP, Dataset &datasetQ) override |
void | updateRegularization (double lambda) override |
Updates the regularization parameter lambda of the underlying model. | |
![]() | |
bool | adapt () override |
Improve accuracy of the fit on the given training data by adaptive refinement or coarsening of the grid and recalculate weights. | |
ModelFittingDensityEstimation () | |
Default constructor. | |
![]() | |
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. | |
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 | ~ModelFittingBase ()=default |
virtual destructor. | |
Additional Inherited Members | |
![]() | |
bool | verboseSolver |
Whether the Solver produces output or not. | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
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. | |
Fitter object that encapsulates the usage of sparse grid density estimation with identity as regularization.
Based on ModelFittingDensityEstimationOnOff, but uses ScaLAPACK for parallelization.
|
explicit |
Constructor.
config | configuration object that specifies grid, refinement, and regularization |
References sgpp::datadriven::ModelFittingBase::config.
sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::ModelFittingDensityEstimationOnOffParallel | ( | const FitterConfigurationDensityEstimation & | config, |
std::shared_ptr< BlacsProcessGrid > | processGrid | ||
) |
Constructor.
config | configuration object that specifies grid, refinement, and regularization |
processGrid | BLACS process grid for parallelization with ScaLAPACK |
References sgpp::datadriven::ModelFittingBase::config.
|
overridevirtual |
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 |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::config, sgpp::datadriven::ModelFittingBaseSingleGrid::grid, sgpp::base::DataVector::remove(), sgpp::datadriven::DataVectorDistributed::resize(), sgpp::base::DataVector::resizeZero(), sgpp::datadriven::SMW_chol, sgpp::datadriven::SMW_ortho, and sgpp::datadriven::DBMatOnlineDE_SMW::updateSystemMatrixDecompositionParallel().
|
overridevirtual |
Should compute some kind of Residual to evaluate the fit of the model.
In the case of density estimation, this is || R * alpha_lambda - b_val ||_2
This is useful for unsupervised learning models, where normal evaluation cannot be used as there are no targets.
validationData | Matrix for validation data |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBase::config, sgpp::datadriven::ModelFittingBaseSingleGrid::grid, sgpp::base::DataVector::l2Norm(), sgpp::datadriven::DataMatrixDistributed::mult(), and sgpp::datadriven::DataVectorDistributed::toLocalDataVectorBroadcast().
|
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::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, 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::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::config, sgpp::datadriven::ModelFittingBaseSingleGrid::grid, and sgpp::datadriven::DataVectorDistributed::toLocalDataVector().
|
overridevirtual |
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). This method makes use of parallelization using ScaLAPACK.
dataset | the training dataset that is used to fit the model. |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::DBMatOnlineDEFactory::buildDBMatOnlineDE(), sgpp::datadriven::DBMatOfflineFactory::buildFromFile(), sgpp::datadriven::ModelFittingBase::buildGrid(), sgpp::datadriven::DBMatOffline::buildMatrix(), sgpp::datadriven::DBMatOfflineFactory::buildOfflineObject(), sgpp::datadriven::DBMatOffline::compute_inverse_parallel(), sgpp::datadriven::ModelFittingBase::config, sgpp::datadriven::DBMatOffline::decomposeMatrix(), sgpp::datadriven::DBMatOffline::decomposeMatrixParallel(), sgpp::datadriven::DBMatDatabase::getDataMatrix(), sgpp::base::DataMatrix::getNcols(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, sgpp::datadriven::DBMatDatabase::hasDataMatrix(), reset(), sgpp::datadriven::SMW_chol, sgpp::datadriven::SMW_ortho, and sgpp::datadriven::DataVectorDistributed::toLocalDataVectorBroadcast().
|
inlineoverridevirtual |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
|
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::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBase::dataset, fit(), and sgpp::datadriven::Dataset::getData().
|
inlineoverridevirtual |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
|
overridevirtual |
Reimplemented from sgpp::datadriven::ModelFittingBase.
|
overridevirtual |
Function that indicates whether a model is refinable at all (certain on/off settings do not allow for refinement)
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::grid.
|
overridevirtual |
Resets the state of the entire model.
Implements sgpp::datadriven::ModelFittingBase.
References sgpp::datadriven::ModelFittingBaseSingleGrid::grid, and sgpp::datadriven::ModelFittingDensityEstimation::refinementsPerformed.
Referenced by fit().
|
overridevirtual |
Resets any trained representations of the model, but does not reset the entire state.
Does not reset the decomposition and the grid.
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, and sgpp::datadriven::ModelFittingBaseSingleGrid::grid.
|
overridevirtual |
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). This method makes use of parallelization using ScaLAPACK.
samples | the new data samples |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBaseSingleGrid::alpha, sgpp::datadriven::ModelFittingBase::config, fit(), sgpp::datadriven::ModelFittingBaseSingleGrid::grid, and sgpp::datadriven::DataVectorDistributed::toLocalDataVectorBroadcast().
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), and python.learner.LearnedKnowledge.LearnedKnowledge::setMemento().
|
inlineoverridevirtual |
|
overridevirtual |
Update the density estimation with new data.
dataset |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBase::dataset, sgpp::datadriven::Dataset::getData(), and update().
Referenced by python.uq.refinement.RefinementStrategy.Ranking::rank(), python.learner.LearnedKnowledge.LearnedKnowledge::setMemento(), and update().
|
overridevirtual |
Updates the regularization parameter lambda of the underlying model.
lambda | the new lambda parameter |
Implements sgpp::datadriven::ModelFittingDensityEstimation.
References sgpp::datadriven::ModelFittingBase::config, sgpp::datadriven::ModelFittingBaseSingleGrid::grid, lambda, sgpp::datadriven::SMW_chol, and sgpp::datadriven::SMW_ortho.