SG++
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 (DataMatrix &m, 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, double beta=0.)
 Constructor. More...
 
double eval (const DataVector &p, bool force=false)
 Evaluates the density function at a certain point. More...
 
void eval (DataMatrix &values, DataVector &results, bool force=false)
 Evaluates the density function on multiple points. More...
 
DataVectorgetAlpha ()
 Return a reference to alpha. More...
 
double getBestLambda ()
 Returns the last best lamda. More...
 
double getBeta ()
 Returns the current weighting factor. More...
 
bool isComputed ()
 Returns if the surplus has already been computed. More...
 
double normalize (size_t samples=1000)
 Normalize the Density. More...
 
double normalizeQuadrature ()
 Normalize the Density using Quadrature. More...
 
void setBeta (double beta)
 Sets the weighting factor. More...
 
void setCrossValidationParameters (int lambda_step, double lambda_start, double lambda_end, DataMatrix *test, DataMatrix *test_cc, bool logscale)
 Sets the crossvalidation parameters. More...
 
void updateAlpha (std::list< size_t > *deletedPoints, size_t newPoints)
 Update alpha vector, i.e. 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 (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 ()
 
double resDensity (DataVector &alpha)
 
virtual void solveSLE (DataVector &b, bool do_cv)=0
 

Protected Attributes

DataVector alpha
 
double beta
 
DataVector bSave
 
DataVector bTotalPoints
 
bool canCV
 
bool cvLogscale
 
bool functionComputed
 
double lambda
 
double lambdaEnd
 
double lambdaStart
 
int lambdaStep
 
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

Member Function Documentation

void sgpp::datadriven::DBMatOnlineDE::computeDensityFunction ( DataMatrix m,
bool  save_b = false,
bool  do_cv = false,
std::list< size_t > *  deletedPoints = nullptr,
size_t  newPoints = 0 
)
double sgpp::datadriven::DBMatOnlineDE::eval ( const DataVector p,
bool  force = false 
)

Evaluates the density function at a certain point.

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

References alpha, sgpp::op_factory::createOperationEval(), sgpp::base::OperationEval::eval(), functionComputed, sgpp::datadriven::DBMatOffline::getGrid(), normFactor, and sgpp::datadriven::DBMatOnline::offlineObject.

Referenced by computeL2Error(), and normalize().

void sgpp::datadriven::DBMatOnlineDE::eval ( DataMatrix values,
DataVector results,
bool  force = false 
)

Evaluates the density function on multiple points.

Parameters
valuesthe points at which the function is evaluated
resultsthe result of the evaluation
forceif set, it will even try to evaluate if the internal state recommends otherwise

References alpha, sgpp::op_factory::createOperationMultipleEval(), sgpp::op_factory::createOperationMultipleEvalInter(), sgpp::base::OperationMultipleEval::eval(), functionComputed, sgpp::datadriven::DBMatOffline::getGrid(), sgpp::datadriven::DBMatOffline::interactions, sgpp::base::DataVector::mult(), normFactor, and sgpp::datadriven::DBMatOnline::offlineObject.

DataVector & sgpp::datadriven::DBMatOnlineDE::getAlpha ( )
double sgpp::datadriven::DBMatOnlineDE::getBestLambda ( )

Returns the last best lamda.

References lambda.

Referenced by sgpp::datadriven::LearnerSGDEOnOffParallel::computeNewSystemMatrixDecomposition().

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 ( size_t  samples = 1000)

Normalize the Density.

References eval(), normFactor, and oDim.

double sgpp::datadriven::DBMatOnlineDE::normalizeQuadrature ( )
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.

void sgpp::datadriven::DBMatOnlineDE::setCrossValidationParameters ( int  lambda_step,
double  lambda_start,
double  lambda_end,
DataMatrix test,
DataMatrix test_cc,
bool  logscale 
)

Sets the crossvalidation parameters.

Parameters
lambda_stephow many different lambdas are tried out
lambda_startThe smallest possible lambda
lambda_endThe biggest possible lambda
testThe test matrix. If NULL, the value old is not overwritten.
test_ccThe results of the points in the test matrix. If NULL, the value old is not overwritten.
logscaleIndicates whether the values between lambda_start and lambda_end are searched using logscale or not

References canCV, cvLogscale, lambdaEnd, lambdaStart, lambdaStep, python.convergence::test(), testMat, and testMatRes.

virtual void sgpp::datadriven::DBMatOnlineDE::solveSLE ( DataVector b,
bool  do_cv 
)
protectedpure virtual
void sgpp::datadriven::DBMatOnlineDE::updateAlpha ( std::list< size_t > *  deletedPoints,
size_t  newPoints 
)

Update alpha vector, i.e.

delete entries specified by 'deletedPoints' and/or add 'newPoints' new entries

Parameters
deletedPointsindices of entries corresponding to deleted grid points
newPointsnumber of added grid points

References alpha, sgpp::base::DataVector::get(), sgpp::base::DataVector::getSize(), and sgpp::base::DataVector::resizeZero().

Referenced by sgpp::datadriven::RefinementHandler::updateClassVariablesAfterRefinement().

Member Data Documentation

double sgpp::datadriven::DBMatOnlineDE::beta
protected

Referenced by DBMatOnlineDE(), getBeta(), and setBeta().

DataVector sgpp::datadriven::DBMatOnlineDE::bSave
protected
DataVector sgpp::datadriven::DBMatOnlineDE::bTotalPoints
protected
bool sgpp::datadriven::DBMatOnlineDE::canCV
protected
bool sgpp::datadriven::DBMatOnlineDE::cvLogscale
protected
bool sgpp::datadriven::DBMatOnlineDE::functionComputed
protected
double sgpp::datadriven::DBMatOnlineDE::lambdaEnd
protected
double sgpp::datadriven::DBMatOnlineDE::lambdaStart
protected
int sgpp::datadriven::DBMatOnlineDE::lambdaStep
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
size_t sgpp::datadriven::DBMatOnlineDE::totalPoints
protected

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