SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
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.
 
std::string & getBaseDataMatrix (const sgpp::base::GeneralGridConfiguration &gridConfig, const sgpp::base::AdaptivityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig, sgpp::base::GeneralGridConfiguration &baseGridConfig)
 Scans the entire database and returns the first entry that can be permutated to match the configurations.
 
std::string & getDataMatrix (const sgpp::base::GeneralGridConfiguration &gridConfig, const sgpp::base::AdaptivityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Scans the entire database and finds the first entry that matches the configurations.
 
bool hasBaseDataMatrix (const sgpp::base::GeneralGridConfiguration &gridConfig, const sgpp::base::AdaptivityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Scans the entire database and checks whether there exists an entry that can be permutated to match the configurations.
 
bool hasDataMatrix (const sgpp::base::GeneralGridConfiguration &gridConfig, const sgpp::base::AdaptivityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Scans the entire database and checks weather any entry matches the configuration.
 
void putDataMatrix (const sgpp::base::GeneralGridConfiguration &gridConfig, const sgpp::base::AdaptivityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig, const std::string filepath, bool overwriteEntry=false)
 Puts a filepath for a given configuration in the database.
 
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

◆ getBaseDataMatrix()

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

Scans the entire database and returns the first entry that can be permutated to match the configurations.

A entry matches if all config properties except the gridConfig's level vector are equal and level vector elements unequal 1 are set equal.

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
baseGridConfigis overriten with the entry's grid config
Returns
Returns the string of the datamatrix if any match was obtained and throws an exception otherwise

References adaptivityConfig, sgpp::base::GeneralGridConfiguration::dim_, json::Node::get(), json::Node::getUInt(), sgpp::datadriven::keyFilepath, sgpp::datadriven::keyGridConfiguration, sgpp::datadriven::keyGridDimension, sgpp::datadriven::keyGridLevel, and sgpp::base::GeneralGridConfiguration::levelVector_.

Referenced by sgpp::datadriven::DBMatPermutationFactory::getPermutedObject().

◆ getDataMatrix()

std::string & sgpp::datadriven::DBMatDatabase::getDataMatrix ( const sgpp::base::GeneralGridConfiguration gridConfig,
const sgpp::base::AdaptivityConfiguration adaptivityConfig,
const sgpp::datadriven::RegularizationConfiguration regularizationConfig,
const 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 adaptivityConfig, json::Node::get(), and sgpp::datadriven::keyFilepath.

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

◆ hasBaseDataMatrix()

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

Scans the entire database and checks whether there exists an entry that can be permutated to match the configurations.

A entry matches if all config properties except the gridConfig's level vector are equal and level vector elements unequal 1 are set equal.

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

References adaptivityConfig.

Referenced by sgpp::datadriven::DBMatPermutationFactory::getPermutedObject().

◆ hasDataMatrix()

bool sgpp::datadriven::DBMatDatabase::hasDataMatrix ( const sgpp::base::GeneralGridConfiguration gridConfig,
const sgpp::base::AdaptivityConfiguration adaptivityConfig,
const sgpp::datadriven::RegularizationConfiguration regularizationConfig,
const 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

References adaptivityConfig.

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

◆ putDataMatrix()

void sgpp::datadriven::DBMatDatabase::putDataMatrix ( const sgpp::base::GeneralGridConfiguration gridConfig,
const sgpp::base::AdaptivityConfiguration adaptivityConfig,
const sgpp::datadriven::RegularizationConfiguration regularizationConfig,
const sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig,
const 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 adaptivityConfig, json::DictNode::addDictAttr(), json::ListNode::addDictValue(), json::DictNode::addIDAttr(), json::ListNode::addIdValue(), json::DictNode::addListAttr(), json::DictNode::addTextAttr(), sgpp::base::ComponentGrid, sgpp::datadriven::DensityEstimationConfiguration::decomposition_, sgpp::base::GeneralGridConfiguration::dim_, sgpp::base::GeneralGridConfiguration::generalType_, sgpp::datadriven::keyDecompositionType, sgpp::datadriven::keyDensityEstimationConfiguration, sgpp::datadriven::keyFilepath, sgpp::datadriven::keyGridConfiguration, sgpp::datadriven::keyGridDimension, sgpp::datadriven::keyGridLevel, sgpp::datadriven::keyGridType, sgpp::datadriven::keyRegularizationConfiguration, sgpp::datadriven::keyRegularizationStrength, sgpp::datadriven::RegularizationConfiguration::lambda_, level, sgpp::base::GeneralGridConfiguration::level_, sgpp::base::GeneralGridConfiguration::levelVector_, json::DictNode::replaceTextAttr(), sgpp::datadriven::MatrixDecompositionTypeParser::toString(), and sgpp::base::GeneralGridTypeParser::toString().

Referenced by main().


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