SG++-Doxygen-Documentation
|
Class that stores, generates and manipulates a density function during online phase in on/off learning. More...
#include <DBMatOnlineDE.hpp>
Public Member Functions | |
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) More... | |
void | computeDensityFunction (DataVector &alpha, DataMatrix &m, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, 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. More... | |
DBMatOnlineDE (DBMatOffline &offline, Grid &grid, double lambda, double beta=0.) | |
Constructor. More... | |
double | eval (DataVector &alpha, const DataVector &p, Grid &grid, bool force=false) |
Evaluates the density function at a certain point. More... | |
void | eval (DataVector &alpha, DataMatrix &values, DataVector &results, Grid &grid, bool force=false) |
Evaluates the density function on multiple points. More... | |
double | getBeta () |
Returns the current weighting factor. More... | |
bool | isComputed () |
Returns if the surplus has already been computed. More... | |
double | normalize (DataVector &alpha, Grid &grid, size_t samples=1000) |
Normalize the Density. More... | |
double | normalizeQuadrature (DataVector &alpha, Grid &grid) |
Normalize the Density using Quadrature. More... | |
void | setBeta (double beta) |
Sets the weighting factor. More... | |
void | updateRhs (size_t gridSize, std::list< size_t > *deletedPoints) |
Restructures the rhs (b vector) of the system matrix. More... | |
Public Member Functions inherited from sgpp::datadriven::DBMatOnline | |
DBMatOnline (DBMatOffline &o) | |
Constructor. More... | |
DBMatOnline (const DBMatOnline &rhs)=delete | |
DBMatOnline (DBMatOnline &&rhs)=default | |
DBMatOffline & | getOfflineObject () |
Returns a reference to the offline object. More... | |
const DBMatOffline & | getOfflineObject () const |
DBMatOnline & | operator= (const DBMatOnline &rhs)=delete |
DBMatOnline & | operator= (DBMatOnline &&rhs)=default |
void | setLambda (double lambda) |
Changes the weighting factor for the regularization term, if possible (might depend on the kind of decomposition for classification) More... | |
virtual std::vector< size_t > | updateSystemMatrixDecomposition (DensityEstimationConfiguration &densityEstimationConfig, Grid &grid, size_t numAddedGridPoints, std::list< size_t > deletedGridPointIndices, double lambda) |
Update the system matrix decomposition after the grid has been modified. More... | |
virtual | ~DBMatOnline ()=default |
Destructor. More... | |
Protected Member Functions | |
double | computeL2Error (DataVector &alpha, Grid &grid) |
double | resDensity (DataVector &alpha, Grid &grid) |
virtual void | solveSLE (DataVector &alpha, DataVector &b, Grid &grid, DensityEstimationConfiguration &densityEstimationConfig, bool do_cv)=0 |
Protected Attributes | |
double | beta |
DataVector | bSave |
DataVector | bTotalPoints |
bool | functionComputed |
double | lambda |
double | normFactor |
size_t | oDim |
DataMatrix * | testMat |
DataMatrix * | testMatRes |
size_t | totalPoints |
Protected Attributes inherited from sgpp::datadriven::DBMatOnline | |
DBMatOffline & | offlineObject |
Class that stores, generates and manipulates a density function during online phase in on/off learning.
|
explicit |
Constructor.
offline | The offline object we base our evaluations on. |
grid | The underlying grid (TODO(fuchsgruber) do we need this?) |
lambda | The regularization strength (TODO(fuchsgruber) remove this) |
beta | The initial weighting factor |
References beta, bSave, bTotalPoints, functionComputed, sgpp::datadriven::DBMatOffline::getDecomposedMatrix(), sgpp::base::DataMatrix::getNcols(), grid(), lambda, normFactor, oDim, sgpp::datadriven::DBMatOnline::offlineObject, testMat, testMatRes, and totalPoints.
void sgpp::datadriven::DBMatOnlineDE::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)
alpha | the vector where surplusses for the density function will be stored |
grid | The underlying grid |
densityEstimationConfig | Configuration for the density estimation combined with the new right hand side (aka streaming) |
do_cv | Indicates whether crossvalidation should take place |
References chess::b, bSave, bTotalPoints, functionComputed, sgpp::base::DataVector::get(), python.statsfileInfo::i, and solveSLE().
void sgpp::datadriven::DBMatOnlineDE::computeDensityFunction | ( | DataVector & | alpha, |
DataMatrix & | m, | ||
Grid & | grid, | ||
DensityEstimationConfiguration & | densityEstimationConfig, | ||
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.
alpha | the vector where surplusses for the density function will be stored |
m | the matrix that contains the data points |
grid | The underlying grid |
densityEstimationConfig | Configuration for the density estimation |
save_b | Indicates whether the old right hand side should be saved and combined with the new right hand side (aka streaming) |
do_cv | Indicates whether crossvalidation should take place |
deletedPoints | indicates the indices of removed grid points due to coarsening |
newPoints | indicates the amount of added points due to refinement |
References chess::b, beta, bSave, bTotalPoints, sgpp::op_factory::createOperationMultipleEval(), sgpp::op_factory::createOperationMultipleEvalInter(), sgpp::datadriven::DensityEstimationConfiguration::decomposition_, functionComputed, sgpp::base::DataVector::get(), sgpp::datadriven::DBMatOnlineDEOrthoAdapt::getB(), sgpp::datadriven::DBMatOffline::getDecomposedMatrix(), sgpp::datadriven::DBMatOffline::getGridSize(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::Grid::getSize(), python.statsfileInfo::i, sgpp::datadriven::DBMatOffline::interactions, sgpp::datadriven::LU, sgpp::base::DataVector::mult(), sgpp::base::OperationMultipleEval::multTranspose(), sgpp::datadriven::DBMatOnline::offlineObject, sgpp::datadriven::OrthoAdapt, sgpp::base::DataVector::set(), solveSLE(), totalPoints, and updateRhs().
|
protected |
double sgpp::datadriven::DBMatOnlineDE::eval | ( | DataVector & | alpha, |
const DataVector & | p, | ||
Grid & | grid, | ||
bool | force = false |
||
) |
Evaluates the density function at a certain point.
alpha | the vector of surplusses |
p | the point at which the function is evaluated |
grid | the underlying grid |
force | if set, it will even try to evaluate if the internal state recommends otherwise |
References sgpp::op_factory::createOperationEval(), sgpp::base::OperationEval::eval(), functionComputed, and normFactor.
Referenced by computeL2Error(), and normalize().
void sgpp::datadriven::DBMatOnlineDE::eval | ( | DataVector & | alpha, |
DataMatrix & | values, | ||
DataVector & | results, | ||
Grid & | grid, | ||
bool | force = false |
||
) |
Evaluates the density function on multiple points.
alpha | the vector of surplusses |
values | the points at which the function is evaluated |
results | the result of the evaluation |
grid | the underlying grid |
force | if set, it will even try to evaluate if the internal state recommends otherwise |
References sgpp::op_factory::createOperationMultipleEval(), sgpp::op_factory::createOperationMultipleEvalInter(), sgpp::base::OperationMultipleEval::eval(), functionComputed, sgpp::datadriven::DBMatOffline::interactions, sgpp::base::DataVector::mult(), normFactor, and sgpp::datadriven::DBMatOnline::offlineObject.
double sgpp::datadriven::DBMatOnlineDE::getBeta | ( | ) |
Returns the current weighting factor.
References beta.
bool sgpp::datadriven::DBMatOnlineDE::isComputed | ( | ) |
Returns if the surplus has already been computed.
References functionComputed.
double sgpp::datadriven::DBMatOnlineDE::normalize | ( | DataVector & | alpha, |
Grid & | grid, | ||
size_t | samples = 1000 |
||
) |
Normalize the Density.
alpha | the vector of surplusses |
grid | the underlying grid |
samples | number of samples to be used for MC quadrature |
References eval(), python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, normFactor, oDim, friedman::p, and parabolasimple::samples.
double sgpp::datadriven::DBMatOnlineDE::normalizeQuadrature | ( | DataVector & | alpha, |
Grid & | grid | ||
) |
Normalize the Density using Quadrature.
alpha | the vector of surplusses |
grid | the underlying grid |
References sgpp::op_factory::createOperationQuadrature(), sgpp::base::OperationQuadrature::doQuadrature(), and normFactor.
|
protected |
void sgpp::datadriven::DBMatOnlineDE::setBeta | ( | double | beta | ) |
Sets the weighting factor.
beta | the new weighting factor. If set to 0, no plasticity takes place. |
References beta.
|
protectedpure virtual |
Implemented in sgpp::datadriven::DBMatOnlineDEOrthoAdapt, and sgpp::datadriven::DBMatOnlineDEChol.
Referenced by computeDensityFunction().
void sgpp::datadriven::DBMatOnlineDE::updateRhs | ( | size_t | gridSize, |
std::list< size_t > * | deletedPoints | ||
) |
Restructures the rhs (b vector) of the system matrix.
This is only availible for streaming, i.e. when computeDensityFunction was called with save_b = true. First b is coarsened, then extended according to the new grid size (refinement).
gridSize | grid size after coarsening and refinement (inherently gives the number of points added during refinement after coarsening) |
deletedPoints | pointer to list of indexes that will be removed from b |
References bSave, bTotalPoints, functionComputed, sgpp::base::DataVector::remove(), and sgpp::base::DataVector::resizeZero().
Referenced by computeDensityFunction().
|
protected |
Referenced by computeDensityFunction(), DBMatOnlineDE(), getBeta(), and setBeta().
|
protected |
Referenced by computeDensityFunction(), DBMatOnlineDE(), and updateRhs().
|
protected |
Referenced by computeDensityFunction(), DBMatOnlineDE(), and updateRhs().
|
protected |
Referenced by computeDensityFunction(), DBMatOnlineDE(), eval(), isComputed(), and updateRhs().
|
protected |
|
protected |
Referenced by DBMatOnlineDE(), eval(), normalize(), and normalizeQuadrature().
|
protected |
Referenced by DBMatOnlineDE(), and normalize().
|
protected |
Referenced by computeL2Error(), DBMatOnlineDE(), and resDensity().
|
protected |
Referenced by computeL2Error(), and DBMatOnlineDE().
|
protected |
Referenced by computeDensityFunction(), and DBMatOnlineDE().