SG++-Doxygen-Documentation
sgpp::datadriven::DBMatDatabase Class Reference

A database class to store and retrieve online matrix decompositions for the sparse grid density estimation. More...

#include <DBMatDatabase.hpp>

Public Member Functions

 DBMatDatabase (const std::string &filepath)
 Initializes the database from a json filepath. More...
 
std::string & getDataMatrix (sgpp::base::GeneralGridConfiguration &gridConfig, sgpp::base::AdaptivityConfiguration &adaptivityConfig, sgpp::datadriven::RegularizationConfiguration &regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Scans the entire database and finds the first entry that matches the configurations. More...
 
bool hasDataMatrix (sgpp::base::GeneralGridConfiguration &gridConfig, sgpp::base::AdaptivityConfiguration &adaptivityConfig, sgpp::datadriven::RegularizationConfiguration &regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Scans the entire database and checks weather any entry matches the configuration. More...
 
void putDataMatrix (sgpp::base::GeneralGridConfiguration &gridConfig, sgpp::base::AdaptivityConfiguration &adaptivityConfig, sgpp::datadriven::RegularizationConfiguration &regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig, std::string filepath, bool overwriteEntry=false)
 Puts a filepath for a given configuration in the database. More...
 
virtual ~DBMatDatabase ()=default
 

Detailed Description

A database class to store and retrieve online matrix decompositions for the sparse grid density estimation.

The class works on a json file.

Constructor & Destructor Documentation

◆ DBMatDatabase()

sgpp::datadriven::DBMatDatabase::DBMatDatabase ( const std::string &  filepath)
explicit

Initializes the database from a json filepath.

Parameters
filepaththe path to the json database

◆ ~DBMatDatabase()

virtual sgpp::datadriven::DBMatDatabase::~DBMatDatabase ( )
virtualdefault

Member Function Documentation

◆ getDataMatrix()

std::string & sgpp::datadriven::DBMatDatabase::getDataMatrix ( sgpp::base::GeneralGridConfiguration gridConfig,
sgpp::base::AdaptivityConfiguration adaptivityConfig,
sgpp::datadriven::RegularizationConfiguration regularizationConfig,
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig 
)

Scans the entire database and finds the first entry that matches the configurations.

Parameters
gridConfigthe grid configuration the matrix must match
adaptivityConfigthe adaptivity configuration the matrix must match
regularizationConfigthe regularization configuration the matrix must match
densityEstimationConfigthe density estimation configuration the matrix must match
Returns
Returns the string of the datamatrix if any match was obtained and throws an exception otherwise

References json::Node::get(), and sgpp::datadriven::keyFilepath.

Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit(), and main().

◆ hasDataMatrix()

bool sgpp::datadriven::DBMatDatabase::hasDataMatrix ( sgpp::base::GeneralGridConfiguration gridConfig,
sgpp::base::AdaptivityConfiguration adaptivityConfig,
sgpp::datadriven::RegularizationConfiguration regularizationConfig,
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig 
)

Scans the entire database and checks weather any entry matches the configuration.

Parameters
gridConfigthe grid configuration the matrix must match
adaptivityConfigthe adaptivity configuration the matrix must match
regularizationConfigthe regularization configuration the matrix must match
densityEstimationConfigthe density estimation configuration the matrix must match
Returns
weather the configuration is held in the database

Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit().

◆ putDataMatrix()

void sgpp::datadriven::DBMatDatabase::putDataMatrix ( sgpp::base::GeneralGridConfiguration gridConfig,
sgpp::base::AdaptivityConfiguration adaptivityConfig,
sgpp::datadriven::RegularizationConfiguration regularizationConfig,
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig,
std::string  filepath,
bool  overwriteEntry = false 
)

Puts a filepath for a given configuration in the database.

The filepath refers to the matrix file. If for this configuration a filepath is already present in the database the filepath is updated if and only if the overwriteEntry parameter is set (default = false).

Parameters
gridConfigthe grid configuration the matrix matches
adaptivityConfigthe adaptivity configuration the matrix matches
regularizationConfigthe regularization configuration the matrix matches
densityEstimationConfigthe density estimation configuration the matrix matches
filepaththe path where the matrix decomposition is located at
overwriteEntryreplaces existing entries with the same configuration if and only if this parameter is set

References json::DictNode::addDictAttr(), json::ListNode::addDictValue(), json::DictNode::addIDAttr(), json::DictNode::addTextAttr(), sgpp::base::ComponentGrid, json::DictNode::contains(), sgpp::datadriven::DensityEstimationConfiguration::decomposition_, sgpp::base::GeneralGridConfiguration::dim_, sgpp::base::GeneralGridConfiguration::generalType_, json::Node::getInt(), python.statsfileInfo::i, sgpp::datadriven::keyDecompositionType, sgpp::datadriven::keyDensityEstimationConfiguration, sgpp::datadriven::keyGridConfiguration, sgpp::datadriven::keyGridDimension, sgpp::datadriven::keyGridLevel, sgpp::datadriven::keyGridType, sgpp::datadriven::keyRegularizationConfiguration, sgpp::datadriven::keyRegularizationStrength, lambda, sgpp::datadriven::RegularizationConfiguration::lambda_, sgpp::base::GeneralGridConfiguration::level_, sgpp::base::CombiGridConfiguration::levels, sgpp::datadriven::GeneralGridTypeParser::parse(), sgpp::datadriven::MatrixDecompositionTypeParser::parse(), json::DictNode::replaceTextAttr(), json::ListNode::size(), sgpp::datadriven::GeneralGridTypeParser::toString(), and sgpp::datadriven::MatrixDecompositionTypeParser::toString().

Referenced by main().


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