SG++
sgpp::datadriven::DBMatOffline Class Referenceabstract

Class that is used to decompose and store the left-hand-side matrix for the density based classification approach (The classification is divided into two parts: the offline step that does not depend on the actual data and the online step that depends on the data). More...

#include <DBMatOffline.hpp>

Inheritance diagram for sgpp::datadriven::DBMatOffline:
sgpp::datadriven::DBMatOfflineGE sgpp::datadriven::DBMatOfflineOrthoAdapt sgpp::datadriven::DBMatOfflineChol sgpp::datadriven::DBMatOfflineDenseIChol

Public Member Functions

virtual void buildMatrix ()
 Builds the right hand side matrix with or without the regularization term depending on the type of decomposition. More...
 
virtual DBMatOfflineclone ()=0
 Interface for the clone idiom. More...
 
 DBMatOffline (const sgpp::base::RegularGridConfiguration &gridConfig, const sgpp::base::AdpativityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Constructor Build DBMatOffline Object from configuration. More...
 
 DBMatOffline (const std::string &fileName)
 Constructor Create offline object from serialized offline object. More...
 
 DBMatOffline (const DBMatOffline &rhs)
 Copy Constructor. More...
 
 DBMatOffline (DBMatOffline &&rhs)=default
 Default move constructor. More...
 
virtual void decomposeMatrix ()=0
 Decomposes the matrix according to the chosen decomposition type. More...
 
sgpp::base::AdpativityConfigurationgetAdaptivityConfig ()
 Get a reference to the grid adaptivity configuration object. More...
 
DataMatrixgetDecomposedMatrix ()
 Get a reference to the decomposed matrix. More...
 
sgpp::datadriven::DensityEstimationConfigurationgetDensityEstimationConfig ()
 Get a reference to the matrix decomposition configuration object. More...
 
GridgetGrid ()
 Returns a reference to the sparse grid. More...
 
sgpp::base::RegularGridConfigurationgetGridConfig ()
 Get a reference to the grid configuration object. More...
 
DataMatrixgetLhsMatrix_ONLY_FOR_TESTING ()
 Allows access to lhs matrix, which is meant ONLY FOR TESTING. More...
 
sgpp::datadriven::RegularizationConfigurationgetRegularizationConfig ()
 Get a reference to the grid regularization configuration object. More...
 
virtual bool isRefineable ()=0
 Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined. More...
 
DBMatOfflineoperator= (const DBMatOffline &rhs)
 Default copy assign operator. More...
 
DBMatOfflineoperator= (DBMatOffline &&rhs)=default
 Default move assign operator. More...
 
void printMatrix ()
 Prints the matrix onto standard output. More...
 
void setInter (std::vector< std::vector< size_t >> interactions)
 Sets interaction Term. More...
 
virtual void store (const std::string &fileName)
 Serialize the DBMatOffline Object. More...
 
virtual ~DBMatOffline ()=default
 Default virtual destructor. More...
 

Public Attributes

std::vector< std::vector< size_t > > interactions
 

Protected Member Functions

 DBMatOffline ()
 
void InitializeGrid ()
 Build the initial sparse grid. More...
 
void parseConfig (const std::string &fileName, sgpp::base::RegularGridConfiguration &gridConfig, sgpp::base::AdpativityConfiguration &adaptivityConfig, sgpp::datadriven::RegularizationConfiguration &regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig) const
 Read the configuration from a serialized DBMatOffline object. More...
 
void parseInter (const std::string &fileName, std::vector< std::vector< size_t >> &interactions) const
 Read the Interactionsterms from a serialized DBMatOfflibe object. More...
 

Protected Attributes

sgpp::base::AdpativityConfiguration adaptivityConfig
 
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig
 
std::unique_ptr< Gridgrid
 An offline object works on a hierarchical basis grid. More...
 
sgpp::base::RegularGridConfiguration gridConfig
 
bool isConstructed
 
bool isDecomposed
 
DataMatrix lhsMatrix
 
sgpp::datadriven::RegularizationConfiguration regularizationConfig
 

Detailed Description

Class that is used to decompose and store the left-hand-side matrix for the density based classification approach (The classification is divided into two parts: the offline step that does not depend on the actual data and the online step that depends on the data).

Uses Gnu Scientific Library (GSL).

Constructor & Destructor Documentation

sgpp::datadriven::DBMatOffline::DBMatOffline ( const sgpp::base::RegularGridConfiguration gridConfig,
const sgpp::base::AdpativityConfiguration adaptivityConfig,
const sgpp::datadriven::RegularizationConfiguration regularizationConfig,
const sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig 
)
explicit

Constructor Build DBMatOffline Object from configuration.

Parameters
gridConfigThe configuration of the grid
adaptivityConfigThe configuration of the grid adaptivity
regularizationConfigThe configuration of the grid regularization
densityEstimationConfigThe configuration of the matrix decomposition

References interactions.

sgpp::datadriven::DBMatOffline::DBMatOffline ( const std::string &  fileName)
explicit

Constructor Create offline object from serialized offline object.

Parameters
fileNamepath to the file that stores serialized offline object

References adaptivityConfig, densityEstimationConfig, gridConfig, InitializeGrid(), interactions, parseConfig(), parseInter(), and regularizationConfig.

sgpp::datadriven::DBMatOffline::DBMatOffline ( const DBMatOffline rhs)

Copy Constructor.

Parameters
rhsObject to copy

References grid.

sgpp::datadriven::DBMatOffline::DBMatOffline ( DBMatOffline &&  rhs)
default

Default move constructor.

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

Default virtual destructor.

sgpp::datadriven::DBMatOffline::DBMatOffline ( )
protected

References interactions.

Member Function Documentation

void sgpp::datadriven::DBMatOffline::buildMatrix ( )
virtual

Builds the right hand side matrix with or without the regularization term depending on the type of decomposition.

Reimplemented in sgpp::datadriven::DBMatOfflineOrthoAdapt, and sgpp::datadriven::DBMatOfflineGE.

References sgpp::op_factory::createOperationLTwoDotExplicit(), grid, InitializeGrid(), isConstructed, and lhsMatrix.

Referenced by sgpp::datadriven::DBMatOfflineGE::buildMatrix(), and sgpp::datadriven::DBMatOfflineOrthoAdapt::buildMatrix().

virtual DBMatOffline* sgpp::datadriven::DBMatOffline::clone ( )
pure virtual

Interface for the clone idiom.

Returns
a copy of this very object as a pointer to a new DBMatOffline object which is owned by the caller.

Implemented in sgpp::datadriven::DBMatOfflineOrthoAdapt, sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineDenseIChol.

virtual void sgpp::datadriven::DBMatOffline::decomposeMatrix ( )
pure virtual

Decomposes the matrix according to the chosen decomposition type.

The number of rows of the stored result depends on the decomposition type.

Implemented in sgpp::datadriven::DBMatOfflineOrthoAdapt, sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineDenseIChol.

sgpp::base::AdpativityConfiguration & sgpp::datadriven::DBMatOffline::getAdaptivityConfig ( )

Get a reference to the grid adaptivity configuration object.

Returns
Grid adaptivity configuration object

References adaptivityConfig.

DataMatrix & sgpp::datadriven::DBMatOffline::getDecomposedMatrix ( )
sgpp::base::RegularGridConfiguration & sgpp::datadriven::DBMatOffline::getGridConfig ( )

Get a reference to the grid configuration object.

Returns
Grid configuration object

References gridConfig.

Referenced by sgpp::datadriven::DBMatOnlineDE::DBMatOnlineDE().

sgpp::base::DataMatrix & sgpp::datadriven::DBMatOffline::getLhsMatrix_ONLY_FOR_TESTING ( )

Allows access to lhs matrix, which is meant ONLY FOR TESTING.

References lhsMatrix.

sgpp::datadriven::RegularizationConfiguration & sgpp::datadriven::DBMatOffline::getRegularizationConfig ( )

Get a reference to the grid regularization configuration object.

Returns
Grid regularization configuration object

References regularizationConfig.

Referenced by sgpp::datadriven::DBMatOnlineDEChol::buildCholSolver(), sgpp::datadriven::DBMatOnlineDE::DBMatOnlineDE(), and sgpp::datadriven::DBMatOnline::setLambda().

virtual bool sgpp::datadriven::DBMatOffline::isRefineable ( )
pure virtual

Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined.

Returns
true if object can be refined, else false;

Implemented in sgpp::datadriven::DBMatOfflineOrthoAdapt, and sgpp::datadriven::DBMatOfflineChol.

DBMatOffline & sgpp::datadriven::DBMatOffline::operator= ( const DBMatOffline rhs)
DBMatOffline& sgpp::datadriven::DBMatOffline::operator= ( DBMatOffline &&  rhs)
default

Default move assign operator.

void sgpp::datadriven::DBMatOffline::parseConfig ( const std::string &  fileName,
sgpp::base::RegularGridConfiguration gridConfig,
sgpp::base::AdpativityConfiguration adaptivityConfig,
sgpp::datadriven::RegularizationConfiguration regularizationConfig,
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig 
) const
protected

Read the configuration from a serialized DBMatOffline object.

Parameters
fileNamepath of the serialized DBMatOffline object
gridConfigThe configuration of the grid of the file to populate
adaptivityConfigThe configuration of the grid adaptivity of the file to populate
regularizationConfigThe configuration of the grid regularization of the file to populate
densityEstimationConfigThe configuration of the matrix decomposition of the file to populate

References sgpp::datadriven::DensityEstimationConfiguration::decomposition_, sgpp::base::RegularGridConfiguration::dim_, analyse_erg::file, sgpp::datadriven::RegularizationConfiguration::lambda_, sgpp::base::RegularGridConfiguration::level_, sgpp::datadriven::StringTokenizer::tokenize(), sgpp::datadriven::RegularizationConfiguration::type_, and sgpp::base::RegularGridConfiguration::type_.

Referenced by DBMatOffline().

void sgpp::datadriven::DBMatOffline::parseInter ( const std::string &  fileName,
std::vector< std::vector< size_t >> &  interactions 
) const
protected

Read the Interactionsterms from a serialized DBMatOfflibe object.

Parameters
fileNamepath of the serialized DBMatOffline object
interactionsthe interactions to populate

References analyse_erg::file, interactions, analyse_erg::tmp, and sgpp::datadriven::StringTokenizer::tokenize().

Referenced by DBMatOffline().

void sgpp::datadriven::DBMatOffline::printMatrix ( )
void sgpp::datadriven::DBMatOffline::setInter ( std::vector< std::vector< size_t >>  interactions)

Sets interaction Term.

Parameters
interactionsInteraction terms used for geometrically aware grids

References interactions.

Member Data Documentation

sgpp::base::AdpativityConfiguration sgpp::datadriven::DBMatOffline::adaptivityConfig
protected
sgpp::base::RegularGridConfiguration sgpp::datadriven::DBMatOffline::gridConfig
protected
std::vector<std::vector <size_t> > sgpp::datadriven::DBMatOffline::interactions

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