![]() |
SG++-Doxygen-Documentation
|
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>
Public Member Functions | |
virtual void | buildMatrix (Grid *grid, const RegularizationConfiguration ®ularizationConfig) |
Builds the right hand side matrix with or without the regularization term depending on the type of decomposition. | |
virtual DBMatOffline * | clone () const =0 |
Interface for the clone idiom. | |
virtual void | compute_inverse () |
virtual void | compute_inverse_parallel (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig) |
parallel/distributed version of compute_inverse() | |
void | compute_L2_refine_vectors (DataMatrix *mat_refine, Grid *grid, size_t newPoints) |
computes vectors of L2 products of grid points for refinement | |
DBMatOffline (const DBMatOffline &rhs) | |
Copy Constructor. | |
DBMatOffline (const std::string &fileName) | |
Constructor Create offline object from serialized offline object. | |
DBMatOffline (DBMatOffline &&rhs)=default | |
Default move constructor. | |
virtual void | decomposeMatrix (const RegularizationConfiguration ®ularizationConfig, const DensityEstimationConfiguration &densityEstimationConfig)=0 |
Decomposes the matrix according to the chosen decomposition type. | |
virtual void | decomposeMatrixParallel (RegularizationConfiguration ®ularizationConfig, DensityEstimationConfiguration &densityEstimationConfig, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig) |
The parallel/distributed version of decomposeMatrix(...) | |
DataMatrixDistributed & | getDecomposedInverseDistributed () |
Get a reference to the distributed decomposed matrix, analogously to getDecomposedMatrixDistributed() | |
DataMatrix & | getDecomposedMatrix () |
Get a reference to the decomposed matrix. | |
DataMatrixDistributed & | getDecomposedMatrixDistributed () |
Get a reference to the distributed decomposed matrix. | |
virtual sgpp::datadriven::MatrixDecompositionType | getDecompositionType ()=0 |
Returns the decomposition type of the DBMatOffline object. | |
virtual size_t | getGridSize () |
Returns the dimensionality of the quadratic lhs matrix (i.e. | |
DataMatrix & | getInverseMatrix () |
Get a reference to the inverse matrix. | |
DataMatrix & | getLhsMatrix_ONLY_FOR_TESTING () |
Allows access to lhs matrix, which is meant ONLY FOR TESTING. | |
virtual const DataMatrix & | getUnmodifiedR ()=0 |
Get the unmodified (without added lambda) system matrix R. | |
virtual const DataMatrixDistributed & | getUnmodifiedRDistributed (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig)=0 |
Get the distributed version of the unmodified (without added lambda) system matrix R. | |
virtual bool | isRefineable ()=0 |
Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined. | |
DBMatOffline & | operator= (const DBMatOffline &rhs) |
Default copy assign operator. | |
DBMatOffline & | operator= (DBMatOffline &&rhs)=default |
Default move assign operator. | |
void | printMatrix () |
Prints the matrix onto standard output. | |
virtual void | store (const std::string &fileName) |
Serialize the DBMatOffline Object. | |
virtual void | syncDistributedDecomposition (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig) |
Synchronizes the decomposed matrix. | |
virtual void | syncDistributedInverse (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig) |
Synchronizes the inverse matrix. | |
virtual void | updateRegularization (double lambda)=0 |
Modifies the decomposition to update the regularization parameter lambda. | |
virtual void | updateRegularizationParallel (double lambda, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig)=0 |
Modifies the parallel decomposition to update the regularization parameter lambda. | |
virtual | ~DBMatOffline ()=default |
Default virtual destructor. | |
Public Attributes | |
std::set< std::set< size_t > > | interactions |
Protected Member Functions | |
DBMatOffline () | |
void | parseInter (const std::string &fileName, std::set< std::set< size_t > > &interactions) const |
Read the Interactionsterms from a serialized DBMatOfflibe object. | |
Protected Attributes | |
bool | isConstructed |
bool | isDecomposed |
DataMatrixDistributed | lhsDistributed |
DataMatrixDistributed | lhsDistributedInverse |
DataMatrix | lhsInverse |
DataMatrix | lhsMatrix |
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).
|
explicit |
Constructor Create offline object from serialized offline object.
fileName | path to the file that stores serialized offline object |
References interactions, and parseInter().
sgpp::datadriven::DBMatOffline::DBMatOffline | ( | const DBMatOffline & | rhs | ) |
Copy Constructor.
rhs | Object to copy |
|
default |
Default move constructor.
|
virtualdefault |
Default virtual destructor.
|
protected |
|
virtual |
Builds the right hand side matrix with or without the regularization term depending on the type of decomposition.
grid | The grid object the matrix is based on |
regularizationConfig | Configures the regularization which is incorporated into the lhs |
Reimplemented in sgpp::datadriven::DBMatOfflineGE, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
References sgpp::op_factory::createOperationLTwoDotExplicit(), grid(), isConstructed, and lhsMatrix.
Referenced by sgpp::datadriven::DBMatOfflineGE::buildMatrix(), sgpp::datadriven::DBMatOfflineOrthoAdapt::buildMatrix(), sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::fit(), sgpp::datadriven::DBMatPermutationFactory::getPermutedObject(), and main().
|
pure virtual |
Interface for the clone idiom.
Implemented in sgpp::datadriven::DBMatOfflineChol, sgpp::datadriven::DBMatOfflineDenseIChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit(), and sgpp::datadriven::DBMatPermutationFactory::getPermutedObject().
|
virtual |
Reimplemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
|
virtual |
parallel/distributed version of compute_inverse()
processGrid | process grid to distribute the matrix on |
parallelConfig |
Reimplemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::fit().
void sgpp::datadriven::DBMatOffline::compute_L2_refine_vectors | ( | DataMatrix * | mat_refine, |
Grid * | grid, | ||
size_t | newPoints | ||
) |
computes vectors of L2 products of grid points for refinement
mat_refine | matrix to store L2 vectors |
grid | underlying grid |
newPoints | amount of points to refine |
References grid(), sgpp::base::Linear, and sgpp::base::ModLinear.
Referenced by sgpp::datadriven::DBMatOfflineChol::choleskyModification().
|
pure virtual |
Decomposes the matrix according to the chosen decomposition type.
The number of rows of the stored result depends on the decomposition type.
regularizationConfig | the regularization configuration |
densityEstimationConfig | the density estimation configuration |
Implemented in sgpp::datadriven::DBMatOfflineChol, sgpp::datadriven::DBMatOfflineDenseIChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::fit(), sgpp::datadriven::DBMatPermutationFactory::getPermutedObject(), and main().
|
virtual |
The parallel/distributed version of decomposeMatrix(...)
regularizationConfig | the regularization configuration |
densityEstimationConfig | the density estimation configuration |
processGrid | process grid to distribute the matrix on |
parallelConfig |
Reimplemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::fit().
DataMatrixDistributed & sgpp::datadriven::DBMatOffline::getDecomposedInverseDistributed | ( | ) |
Get a reference to the distributed decomposed matrix, analogously to getDecomposedMatrixDistributed()
References isDecomposed, and lhsDistributedInverse.
Referenced by sgpp::datadriven::DBMatOnlineDE_SMW::smw_adapt_parallel(), and sgpp::datadriven::DBMatOnlineDE_SMW::solveSLEParallel().
DataMatrix & sgpp::datadriven::DBMatOffline::getDecomposedMatrix | ( | ) |
Get a reference to the decomposed matrix.
Throws if matrix has not yet been decomposed.
References isDecomposed, and lhsMatrix.
Referenced by sgpp::datadriven::DBMatOnlineDE::computeDensityDifferenceFunction(), sgpp::datadriven::DBMatOnlineDE::computeDensityFunction(), sgpp::datadriven::DBMatOnlineDE::computeDensityFunctionParallel(), sgpp::datadriven::LearnerSGDEOnOffParallel::computeNewSystemMatrixDecomposition(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatch(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchParallel(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchTwoDatasets(), and sgpp::datadriven::DBMatOnlineDEChol::solveSLE().
DataMatrixDistributed & sgpp::datadriven::DBMatOffline::getDecomposedMatrixDistributed | ( | ) |
Get a reference to the distributed decomposed matrix.
Throws if matrix has not yet been decomposed. In order to return valid data, syncDistributedDecomposition() has to be called if the decomposition was changed (after refinements).
References isDecomposed, and lhsDistributed.
Referenced by sgpp::datadriven::DBMatOnlineDEChol::solveSLEParallel().
|
pure virtual |
Returns the decomposition type of the DBMatOffline object.
Implemented in sgpp::datadriven::DBMatOfflineChol, sgpp::datadriven::DBMatOfflineDenseIChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
Referenced by sgpp::datadriven::DBMatOnlineDEChol::buildCholSolver(), sgpp::datadriven::DBMatOnlineDE_SMW::DBMatOnlineDE_SMW(), sgpp::datadriven::DBMatOnlineDEOrthoAdapt::DBMatOnlineDEOrthoAdapt(), and store().
|
virtual |
Returns the dimensionality of the quadratic lhs matrix (i.e.
the number of rows)
References sgpp::base::DataMatrix::getNrows(), and lhsMatrix.
Referenced by python.learner.TrainingStopPolicy.TrainingStopPolicy::hasGridSizeChanged(), python.learner.TrainingStopPolicy.TrainingStopPolicy::isTrainingComplete(), sgpp::datadriven::DBMatOnlineDEOrthoAdapt::sherman_morrison_adapt(), sgpp::datadriven::DBMatOnlineDE_SMW::smw_adapt(), sgpp::datadriven::DBMatOnlineDE_SMW::smw_adapt_parallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::store(), sgpp::datadriven::DBMatOnlineDE_SMW::updateSystemMatrixDecomposition(), sgpp::datadriven::DBMatOnlineDEOrthoAdapt::updateSystemMatrixDecomposition(), and sgpp::datadriven::DBMatOnlineDE_SMW::updateSystemMatrixDecompositionParallel().
DataMatrix & sgpp::datadriven::DBMatOffline::getInverseMatrix | ( | ) |
Get a reference to the inverse matrix.
References lhsInverse.
Referenced by sgpp::datadriven::DBMatOnlineDE_SMW::smw_adapt(), and sgpp::datadriven::DBMatOnlineDE_SMW::solveSLE().
sgpp::base::DataMatrix & sgpp::datadriven::DBMatOffline::getLhsMatrix_ONLY_FOR_TESTING | ( | ) |
Allows access to lhs matrix, which is meant ONLY FOR TESTING.
References lhsMatrix.
|
pure virtual |
Get the unmodified (without added lambda) system matrix R.
Implemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
|
pure virtual |
Get the distributed version of the unmodified (without added lambda) system matrix R.
Only possible in the ScaLAPACK version.
processGrid | BLACS process grid |
parallelConfig | config options for ScaLAPACK |
Implemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
|
pure virtual |
Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined.
Implemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
DBMatOffline & sgpp::datadriven::DBMatOffline::operator= | ( | const DBMatOffline & | rhs | ) |
Default copy assign operator.
References interactions, isConstructed, isDecomposed, lhsInverse, and lhsMatrix.
|
default |
Default move assign operator.
|
protected |
Read the Interactionsterms from a serialized DBMatOfflibe object.
fileName | path of the serialized DBMatOffline object |
interactions | the interactions to populate |
References fileName, and sgpp::base::StringTokenizer::tokenize().
Referenced by DBMatOffline().
void sgpp::datadriven::DBMatOffline::printMatrix | ( | ) |
Prints the matrix onto standard output.
References sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), isDecomposed, lhsMatrix, and sgpp::base::DataMatrix::toString().
|
virtual |
Serialize the DBMatOffline Object.
fileName | path where to store the file. |
Reimplemented in sgpp::datadriven::DBMatOfflineOrthoAdapt.
References fileName, getDecompositionType(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getPointer(), interactions, isDecomposed, and lhsMatrix.
Referenced by main(), and sgpp::datadriven::DBMatOfflineOrthoAdapt::store().
|
virtual |
Synchronizes the decomposed matrix.
Override if more matrices have to be synched.
processGrid | process grid to distribute the matrix on |
parallelConfig |
Reimplemented in sgpp::datadriven::DBMatOfflineOrthoAdapt.
References sgpp::datadriven::ParallelConfiguration::columnBlockSize_, sgpp::datadriven::DataMatrixDistributed::fromSharedData(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), isDecomposed, lhsDistributed, lhsMatrix, and sgpp::datadriven::ParallelConfiguration::rowBlockSize_.
Referenced by sgpp::datadriven::DBMatOnlineDE::syncDistributedDecomposition(), and sgpp::datadriven::DBMatOnlineDEOrthoAdapt::syncDistributedDecomposition().
|
virtual |
Synchronizes the inverse matrix.
processGrid | process grid to distribute the matrix on |
parallelConfig |
References sgpp::datadriven::ParallelConfiguration::columnBlockSize_, sgpp::datadriven::DataMatrixDistributed::fromSharedData(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), isDecomposed, lhsDistributedInverse, lhsInverse, and sgpp::datadriven::ParallelConfiguration::rowBlockSize_.
|
pure virtual |
Modifies the decomposition to update the regularization parameter lambda.
lambda | New lambda value |
Implemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
|
pure virtual |
Modifies the parallel decomposition to update the regularization parameter lambda.
lambda | New lambda value |
processGrid | ScaLAPACK process grid |
parallelConfig | Configuration for ScaLAPACK |
Implemented in sgpp::datadriven::DBMatOfflineChol, and sgpp::datadriven::DBMatOfflineOrthoAdapt.
std::set<std::set<size_t> > sgpp::datadriven::DBMatOffline::interactions |
Referenced by sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatch(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchParallel(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchTwoDatasets(), DBMatOffline(), sgpp::datadriven::DBMatOnlineDE::eval(), sgpp::datadriven::DBMatOnlineDE::evalParallel(), operator=(), and store().
|
protected |
Referenced by buildMatrix(), sgpp::datadriven::DBMatOfflineGE::buildMatrix(), sgpp::datadriven::DBMatOfflineOrthoAdapt::DBMatOfflineOrthoAdapt(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineDenseIChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrix(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrixParallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrixParallel(), and operator=().
|
protected |
Referenced by sgpp::datadriven::DBMatOfflineChol::choleskyAddPoint(), sgpp::datadriven::DBMatOfflineChol::choleskyPermutation(), sgpp::datadriven::DBMatOfflineChol::compute_inverse(), sgpp::datadriven::DBMatOfflineOrthoAdapt::compute_inverse(), sgpp::datadriven::DBMatOfflineChol::compute_inverse_parallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::compute_inverse_parallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::DBMatOfflineOrthoAdapt(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineDenseIChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrix(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrixParallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrixParallel(), getDecomposedInverseDistributed(), getDecomposedMatrix(), getDecomposedMatrixDistributed(), operator=(), printMatrix(), store(), syncDistributedDecomposition(), sgpp::datadriven::DBMatOfflineOrthoAdapt::syncDistributedDecomposition(), and syncDistributedInverse().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by buildMatrix(), sgpp::datadriven::DBMatOfflineGE::buildMatrix(), sgpp::datadriven::DBMatOfflineChol::choleskyAddPoint(), sgpp::datadriven::DBMatOfflineChol::choleskyModification(), sgpp::datadriven::DBMatOfflineDenseIChol::choleskyModification(), sgpp::datadriven::DBMatOfflineChol::choleskyPermutation(), sgpp::datadriven::DBMatOfflineChol::compute_inverse(), sgpp::datadriven::DBMatOfflineOrthoAdapt::compute_inverse(), sgpp::datadriven::DBMatOfflineChol::compute_inverse_parallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::compute_inverse_parallel(), sgpp::datadriven::DBMatOfflineGE::DBMatOfflineGE(), sgpp::datadriven::DBMatOfflineOrthoAdapt::DBMatOfflineOrthoAdapt(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineDenseIChol::decomposeMatrix(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrix(), sgpp::datadriven::DBMatOfflineChol::decomposeMatrixParallel(), sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrixParallel(), getDecomposedMatrix(), getGridSize(), getLhsMatrix_ONLY_FOR_TESTING(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getUnmodifiedR(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getUnmodifiedRDistributed(), sgpp::datadriven::DBMatOfflineOrthoAdapt::hessenberg_decomposition(), sgpp::datadriven::DBMatOfflineOrthoAdapt::invert_symmetric_tridiag(), operator=(), sgpp::datadriven::DBMatOfflinePermutable::permuteLhsMatrix(), printMatrix(), store(), syncDistributedDecomposition(), sgpp::datadriven::DBMatOfflineOrthoAdapt::updateRegularization(), and sgpp::datadriven::DBMatOfflineOrthoAdapt::updateRegularizationParallel().