![]() |
SG++-Doxygen-Documentation
|
#include <DBMatOnlineDEOrthoAdapt.hpp>
Public Member Functions | |
void | add_new_refine_point (sgpp::base::DataVector &x) |
Adds new DataVector to list of refined points For testing purposes only. | |
DBMatOnlineDEOrthoAdapt (DBMatOffline &offline, Grid &grid, double lambda, double beta=0.) | |
Constructor. | |
sgpp::base::DataMatrix & | getB () |
Returns the additive component of the sherman-morrison-formula, which yields all the information about the refined points. | |
DataMatrixDistributed & | getBDistributed () |
std::vector< sgpp::base::DataVector > * | getRefinedPointsPointer () |
Gets pointer to the container of refined points, only for testing purposes. | |
void | sherman_morrison_adapt (size_t newPoints, bool refine, std::vector< size_t > coarsen_indices={}) |
Rank-one updates/downdates the system matrix, based on the Sherman-Morrison-formula In the current version of the function, the refinePts already are adapted to the regularization parameter lambda. | |
void | syncDistributedDecomposition (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration ¶llelConfig) override |
Synchronizes the distributed decomposition, only has an effect if scalapack is used. | |
std::vector< size_t > | updateSystemMatrixDecomposition (DensityEstimationConfiguration &densityEstimationConfig, Grid &grid, size_t numAddedGridPoints, std::vector< size_t > &deletedGridPointIndices, double lambda) override |
![]() | |
void | computeDensityDifferenceFunction (DataVector &alpha, DataMatrix &mp, DataMatrix &mq, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool save_b=false, bool do_cv=false) |
Computes the density difference function for two data matrix instances. | |
void | computeDensityDifferenceFunction (DataVector &alpha, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool do_cv=false) |
Computes the density difference function again based on the saved b's (only applicable for streaming) | |
void | computeDensityFunction (DataVector &alpha, DataMatrix &m, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool save_b=false, bool do_cv=false) |
Computes the density function for a certain data matrix. | |
void | computeDensityFunction (DataVector &alpha, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool do_cv=false) |
Computes the density function again based on the saved b's (only applicable for streaming) | |
void | computeDensityFunctionParallel (DataVectorDistributed &alpha, DataMatrix &m, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, const ParallelConfiguration ¶llelConfig, std::shared_ptr< BlacsProcessGrid > processGrid, bool save_b=false, bool do_cv=false, std::list< size_t > *deletedPoints=nullptr, size_t newPoints=0) |
Computes the density function for a certain data matrix in parallel using ScaLAPACK. | |
void | computeDensityFunctionParallel (DataVectorDistributed &alpha, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, const ParallelConfiguration ¶llelConfig, std::shared_ptr< BlacsProcessGrid > processGrid, bool do_cv=false) |
Computes the density function again based on the saved b's (only applicable for streaming) in parallel on a cluster using ScaLAPACK. | |
DataVector | computeWeightedBFromBatch (DataMatrix &m, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool weighted) |
Computes/updates the b vector for the given batch of data. | |
DataVectorDistributed | computeWeightedBFromBatchParallel (DataMatrix &m, Grid &grid, const DensityEstimationConfiguration &densityEstimationConfig, const ParallelConfiguration ¶llelConfig, std::shared_ptr< BlacsProcessGrid > processGrid, bool weighted) |
Computes/updates the b vector for the given batch of data in parallel using ScaLAPACK. | |
std::vector< DataVector > | computeWeightedBFromBatchTwoDatasets (DataMatrix &mp, DataMatrix &mq, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool weighted) |
Initializes the b vector for the given batch of data in two datasets scenarios. | |
DBMatOnlineDE (DBMatOffline &offline, Grid &grid, double lambda, double beta=0.) | |
Constructor. | |
double | eval (DataVector &alpha, const DataVector &p, Grid &grid, bool force=false) |
Evaluates the density function at a certain point. | |
void | eval (DataVector &alpha, DataMatrix &values, DataVector &results, Grid &grid, bool force=false) |
Evaluates the density function on multiple points. | |
void | evalParallel (DataVector &alpha, DataMatrix &values, DataVectorDistributed &results, Grid &grid, bool force=false) |
Evaluates the density function on multiple points using parallelization. | |
double | getBeta () |
Returns the current weighting factor. | |
bool | isComputed () |
Returns if the surplus has already been computed. | |
double | normalize (DataVector &alpha, Grid &grid, size_t samples=1000) |
Normalize the Density. | |
double | normalizeQuadrature (DataVector &alpha, Grid &grid) |
Normalize the Density using Quadrature. | |
void | resetTraining () |
Resets the training state of the model. | |
void | setBeta (double beta) |
Sets the weighting factor. | |
void | updateRhs (size_t gridSize, std::vector< size_t > &deletedPoints) |
Restructures the rhs (b vector) of the system matrix. | |
![]() | |
DBMatOnline (const DBMatOnline &rhs)=delete | |
DBMatOnline (DBMatOffline &o) | |
Constructor. | |
DBMatOnline (DBMatOnline &&rhs)=default | |
DBMatOffline & | getOfflineObject () |
Returns a reference to the offline object. | |
const DBMatOffline & | getOfflineObject () const |
DBMatOnline & | operator= (const DBMatOnline &rhs)=delete |
DBMatOnline & | operator= (DBMatOnline &&rhs)=delete |
void | setLambda (double lambda) |
virtual | ~DBMatOnline ()=default |
Destructor. | |
Protected Member Functions | |
void | solveSLE (DataVector &alpha, DataVector &b, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool do_cv) override |
Solves the system (R + lambda*I) * alpha = b, and obtains alpha The solving is done after offline and online phase and works as follows: (R + lambda*I)^{-1} * b = ((Q*T^{-1}*Q^{t} + B) * b = alpha, where B holds the refine/coarsen information. | |
void | solveSLEParallel (DataVectorDistributed &alpha, DataVectorDistributed &b, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool do_cv) override |
Solves the distributed system (R + lambda*I) * alpha = b in parallel and obtains alpha. | |
![]() | |
double | computeL2Error (DataVector &alpha, Grid &grid) |
double | resDensity (DataVector &alpha, Grid &grid) |
Protected Attributes | |
sgpp::base::DataMatrix | b_adapt_matrix_ |
DataMatrixDistributed | b_adapt_matrix_distributed_ |
bool | b_is_refined |
size_t | current_refine_index |
std::vector< sgpp::base::DataVector > | refined_points_ |
![]() | |
double | beta |
DataVector | bSave |
std::unique_ptr< DataVectorDistributed > | bSaveDistributed |
DataVector | bSaveExtra |
DataVector | bTotalPoints |
std::unique_ptr< DataVectorDistributed > | bTotalPointsDistributed |
DataVector | bTotalPointsExtra |
bool | distributedVectorsInitialized |
bool | functionComputed |
double | lambda |
bool | localVectorsInitialized |
double | normFactor |
size_t | oDim |
DataMatrix * | testMat |
DataMatrix * | testMatRes |
bool | useExtraLocalVectors |
![]() | |
DBMatOffline & | offlineObject |
|
explicit |
Constructor.
offline | The offline object we base our evaluations on. |
lambda | The regularization strength (TODO(fuchsgruber) remove this) |
grid | The underlying grid (TODO(fuchsgruber) do we need this?) |
beta | The initial weighting factor |
References b_adapt_matrix_, b_is_refined, current_refine_index, sgpp::datadriven::DBMatOffline::getDecompositionType(), sgpp::datadriven::OrthoAdapt, and refined_points_.
|
inline |
Adds new DataVector to list of refined points For testing purposes only.
x | The DataVector to add |
References refined_points_.
|
inline |
Returns the additive component of the sherman-morrison-formula, which yields all the information about the refined points.
References b_adapt_matrix_.
Referenced by sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatch(), sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchParallel(), and sgpp::datadriven::DBMatOnlineDE::computeWeightedBFromBatchTwoDatasets().
|
inline |
References b_adapt_matrix_distributed_.
Referenced by solveSLEParallel().
|
inline |
Gets pointer to the container of refined points, only for testing purposes.
References refined_points_.
void sgpp::datadriven::DBMatOnlineDEOrthoAdapt::sherman_morrison_adapt | ( | size_t | newPoints, |
bool | refine, | ||
std::vector< size_t > | coarsen_indices = {} |
||
) |
Rank-one updates/downdates the system matrix, based on the Sherman-Morrison-formula In the current version of the function, the refinePts already are adapted to the regularization parameter lambda.
newPoints | number of refined points |
refine | decides: true for refine, false for coarsen |
coarsen_indices | the indices of points to coarsen |
References b_adapt_matrix_, b_is_refined, current_refine_index, sgpp::base::DataVector::get(), sgpp::base::DataMatrix::get(), sgpp::base::DataMatrix::getColumn(), sgpp::datadriven::DBMatOffline::getGridSize(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getPointer(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getQ(), sgpp::base::DataMatrix::getRow(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getTinv(), sgpp::datadriven::DBMatOnline::offlineObject, refined_points_, sgpp::base::DataMatrix::resizeQuadratic(), sgpp::base::DataVector::set(), sgpp::base::DataMatrix::set(), sgpp::base::DataMatrix::setColumn(), and sgpp::base::DataMatrix::setRow().
Referenced by updateSystemMatrixDecomposition().
|
overrideprotectedvirtual |
Solves the system (R + lambda*I) * alpha = b, and obtains alpha The solving is done after offline and online phase and works as follows: (R + lambda*I)^{-1} * b = ((Q*T^{-1}*Q^{t} + B) * b = alpha, where B holds the refine/coarsen information.
alpha | the datavetor where surplusses will be stored |
b | The right hand side of the system |
grid | the underlying grid |
densityEstimationConfig | configuration for the density estimation |
do_cv | Specifies, if cross-validation should be done (todo: currently not implemented) |
Implements sgpp::datadriven::DBMatOnlineDE.
References alpha, sgpp::datadriven::DBMatOfflineOrthoAdapt::getQ(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getTinv(), sgpp::datadriven::DBMatOnline::offlineObject, and sgpp::base::DataVector::resizeZero().
|
overrideprotectedvirtual |
Solves the distributed system (R + lambda*I) * alpha = b in parallel and obtains alpha.
For more information, see solveSLE.
alpha | distributed datavector for surplusses |
b | distributed right hand side |
grid | the underlying grid |
densityEstimationConfig | configuration for the density estimation |
do_cv | cross-validation (currently not implemented) |
Implements sgpp::datadriven::DBMatOnlineDE.
References alpha, getBDistributed(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getQDistributed(), sgpp::datadriven::DBMatOfflineOrthoAdapt::getTinvDistributed(), and sgpp::datadriven::DBMatOnline::offlineObject.
|
overridevirtual |
Synchronizes the distributed decomposition, only has an effect if scalapack is used.
Reimplemented from sgpp::datadriven::DBMatOnlineDE.
References b_adapt_matrix_, b_adapt_matrix_distributed_, sgpp::datadriven::ParallelConfiguration::columnBlockSize_, sgpp::datadriven::DataMatrixDistributed::fromSharedData(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::DBMatOnline::offlineObject, sgpp::datadriven::ParallelConfiguration::rowBlockSize_, and sgpp::datadriven::DBMatOffline::syncDistributedDecomposition().
|
overridevirtual |
densityEstimationConfig | configuration for the density estimation |
grid | the underlying grid |
numAddedGridPoints | Number of grid points inserted at the end of the grid storage |
deletedGridPointIndices | Indices of grid points that were deleted |
lambda | The last best lambda value |
Reimplemented from sgpp::datadriven::DBMatOnline.
References sgpp::datadriven::DBMatOffline::getGridSize(), grid(), sgpp::datadriven::DBMatOnlineDE::lambda, sgpp::datadriven::DBMatOnline::offlineObject, and sherman_morrison_adapt().
|
protected |
Referenced by DBMatOnlineDEOrthoAdapt(), getB(), sherman_morrison_adapt(), and syncDistributedDecomposition().
|
protected |
Referenced by getBDistributed(), and syncDistributedDecomposition().
|
protected |
Referenced by DBMatOnlineDEOrthoAdapt(), and sherman_morrison_adapt().
|
protected |
Referenced by DBMatOnlineDEOrthoAdapt(), and sherman_morrison_adapt().
|
protected |
Referenced by add_new_refine_point(), DBMatOnlineDEOrthoAdapt(), getRefinedPointsPointer(), and sherman_morrison_adapt().