SG++-Doxygen-Documentation
sgpp::datadriven::DBMatOnlineDE Class Referenceabstract

Class that stores, generates and manipulates a density function during online phase in on/off learning. More...

#include <DBMatOnlineDE.hpp>

Inheritance diagram for sgpp::datadriven::DBMatOnlineDE:
sgpp::datadriven::DBMatOnline sgpp::datadriven::DBMatOnlineDEChol sgpp::datadriven::DBMatOnlineDEOrthoAdapt

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
 
DBMatOfflinegetOfflineObject ()
 Returns a reference to the offline object. More...
 
const DBMatOfflinegetOfflineObject () const
 
DBMatOnlineoperator= (const DBMatOnline &rhs)=delete
 
DBMatOnlineoperator= (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
 
DataMatrixtestMat
 
DataMatrixtestMatRes
 
size_t totalPoints
 
- Protected Attributes inherited from sgpp::datadriven::DBMatOnline
DBMatOfflineofflineObject
 

Detailed Description

Class that stores, generates and manipulates a density function during online phase in on/off learning.

Constructor & Destructor Documentation

sgpp::datadriven::DBMatOnlineDE::DBMatOnlineDE ( DBMatOffline offline,
Grid grid,
double  lambda,
double  beta = 0. 
)
explicit

Constructor.

Parameters
offlineThe offline object we base our evaluations on.
gridThe underlying grid (TODO(fuchsgruber) do we need this?)
lambdaThe regularization strength (TODO(fuchsgruber) remove this)
betaThe 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.

Member Function Documentation

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)

Parameters
alphathe vector where surplusses for the density function will be stored
gridThe underlying grid
densityEstimationConfigConfiguration for the density estimation combined with the new right hand side (aka streaming)
do_cvIndicates 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.

Parameters
alphathe vector where surplusses for the density function will be stored
mthe matrix that contains the data points
gridThe underlying grid
densityEstimationConfigConfiguration for the density estimation
save_bIndicates whether the old right hand side should be saved and combined with the new right hand side (aka streaming)
do_cvIndicates whether crossvalidation should take place
deletedPointsindicates the indices of removed grid points due to coarsening
newPointsindicates 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().

double sgpp::datadriven::DBMatOnlineDE::eval ( DataVector alpha,
const DataVector p,
Grid grid,
bool  force = false 
)

Evaluates the density function at a certain point.

Parameters
alphathe vector of surplusses
pthe point at which the function is evaluated
gridthe underlying grid
forceif set, it will even try to evaluate if the internal state recommends otherwise
Returns
the result of the evaluation

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.

Parameters
alphathe vector of surplusses
valuesthe points at which the function is evaluated
resultsthe result of the evaluation
gridthe underlying grid
forceif 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.

Parameters
alphathe vector of surplusses
gridthe underlying grid
samplesnumber 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.

Parameters
alphathe vector of surplusses
gridthe underlying grid

References sgpp::op_factory::createOperationQuadrature(), sgpp::base::OperationQuadrature::doQuadrature(), and normFactor.

double sgpp::datadriven::DBMatOnlineDE::resDensity ( DataVector alpha,
Grid grid 
)
protected
void sgpp::datadriven::DBMatOnlineDE::setBeta ( double  beta)

Sets the weighting factor.

Parameters
betathe new weighting factor. If set to 0, no plasticity takes place.

References beta.

virtual void sgpp::datadriven::DBMatOnlineDE::solveSLE ( DataVector alpha,
DataVector b,
Grid grid,
DensityEstimationConfiguration densityEstimationConfig,
bool  do_cv 
)
protectedpure virtual
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).

Parameters
gridSizegrid size after coarsening and refinement (inherently gives the number of points added during refinement after coarsening)
deletedPointspointer 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().

Member Data Documentation

double sgpp::datadriven::DBMatOnlineDE::beta
protected
DataVector sgpp::datadriven::DBMatOnlineDE::bSave
protected
DataVector sgpp::datadriven::DBMatOnlineDE::bTotalPoints
protected
bool sgpp::datadriven::DBMatOnlineDE::functionComputed
protected
double sgpp::datadriven::DBMatOnlineDE::normFactor
protected
size_t sgpp::datadriven::DBMatOnlineDE::oDim
protected

Referenced by DBMatOnlineDE(), and normalize().

DataMatrix* sgpp::datadriven::DBMatOnlineDE::testMat
protected
DataMatrix * sgpp::datadriven::DBMatOnlineDE::testMatRes
protected

Referenced by computeL2Error(), and DBMatOnlineDE().

size_t sgpp::datadriven::DBMatOnlineDE::totalPoints
protected

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