SG++-Doxygen-Documentation
sgpp::datadriven::GridPointBasedRefinementFunctor Class Reference

Grid Point based refinement for classification problems solved by a SG density estimation approach. More...

#include <GridPointBasedRefinementFunctor.hpp>

Inheritance diagram for sgpp::datadriven::GridPointBasedRefinementFunctor:
sgpp::datadriven::MultiGridRefinementFunctor sgpp::base::RefinementFunctor

Public Member Functions

size_t getNumGrids () override
 Returns the number of grids the functor can / does refine. More...
 
size_t getRefinementsNum () const override
 Returns the maximal number of points that should be refined. More...
 
double getRefinementThreshold () const override
 Returns the threshold for refinement. More...
 
 GridPointBasedRefinementFunctor (std::vector< base::Grid *> grids, std::vector< base::DataVector *> alphas, size_t refinements_num=1, bool level_penalize=false, bool pre_compute=false, double threshold=0.0)
 Constructor. More...
 
double operator() (base::GridStorage &storage, size_t seq) const override
 This should be returning a refinement value for every grid point. More...
 
void preComputeEvaluations () override
 Precomputes grid evaluations for all grids. More...
 
void setGridIndex (size_t grid_index) override
 Sets the index (into the vector of grids) of the grid to be refined. More...
 
double start () const override
 Returns the lower bound of refinement criterion (e.g., alpha or error) (lower bound). More...
 
virtual ~GridPointBasedRefinementFunctor ()
 
- Public Member Functions inherited from sgpp::datadriven::MultiGridRefinementFunctor
virtual ~MultiGridRefinementFunctor ()
 
- Public Member Functions inherited from sgpp::base::RefinementFunctor
virtual double getTotalRefinementValue (GridStorage &storage) const
 Returns the total sum of local (error) indicators used for refinement. More...
 
 RefinementFunctor ()
 Constructor. More...
 
virtual ~RefinementFunctor ()
 Destructor. More...
 

Protected Attributes

std::vector< base::DataVector * > alphas
 
size_t current_grid_index
 
std::vector< base::Grid * > grids
 
bool level_penalize
 
std::vector< std::map< std::string, double > > pre_comp_evals
 Stores grid evaluations at all grids (vector) at the union of grid point coordinates over all grids (hashed by string representation in the map) More...
 
bool pre_compute
 
size_t refinements_num
 
double threshold
 

Additional Inherited Members

- Public Types inherited from sgpp::base::RefinementFunctor
typedef double value_type
 

Detailed Description

Grid Point based refinement for classification problems solved by a SG density estimation approach.

The scoring is only based on function values of the respective PDF at grid points.

Constructor & Destructor Documentation

◆ GridPointBasedRefinementFunctor()

sgpp::datadriven::GridPointBasedRefinementFunctor::GridPointBasedRefinementFunctor ( std::vector< base::Grid *>  grids,
std::vector< base::DataVector *>  alphas,
size_t  refinements_num = 1,
bool  level_penalize = false,
bool  pre_compute = false,
double  threshold = 0.0 
)

Constructor.

Parameters
gridsVector of grids. current_grid_index specifies the grid to be refined
alphasVector of surpluses related to the grids
refinements_numMaximum number of refinements done
level_penalizeIf a level penalizing is multiplied to the score (2^{|l|_1})
pre_computeFlag for precomputation of necessary grid evals. If true preComputeEvaluations needs to be called before each refinement step
thresholdThreshold for refinement scores

References python.statsfileInfo::i, and pre_comp_evals.

◆ ~GridPointBasedRefinementFunctor()

virtual sgpp::datadriven::GridPointBasedRefinementFunctor::~GridPointBasedRefinementFunctor ( )
inlinevirtual

Member Function Documentation

◆ getNumGrids()

size_t sgpp::datadriven::GridPointBasedRefinementFunctor::getNumGrids ( )
overridevirtual

Returns the number of grids the functor can / does refine.

Implements sgpp::datadriven::MultiGridRefinementFunctor.

References grids.

Referenced by ~GridPointBasedRefinementFunctor().

◆ getRefinementsNum()

size_t sgpp::datadriven::GridPointBasedRefinementFunctor::getRefinementsNum ( ) const
overridevirtual

Returns the maximal number of points that should be refined.

The maximal number of points to refine is set in the constructor of the implementing class.

Returns
number of points that should refined. Default value: 1.

Reimplemented from sgpp::base::RefinementFunctor.

References refinements_num.

◆ getRefinementThreshold()

double sgpp::datadriven::GridPointBasedRefinementFunctor::getRefinementThreshold ( ) const
overridevirtual

Returns the threshold for refinement.

Only the grid points with absolute value of refinement criterion (e.g., alpha or error) greater or equal to this threshold will be refined.

Returns
threshold value for refinement. Default value: 0.

Implements sgpp::base::RefinementFunctor.

References threshold.

◆ operator()()

double sgpp::datadriven::GridPointBasedRefinementFunctor::operator() ( base::GridStorage storage,
size_t  seq 
) const
overridevirtual

This should be returning a refinement value for every grid point.

The point with the highest value will be refined first.

Parameters
storagereference to the grids storage object
seqsequence number in the coefficients array
Returns
refinement value

Implements sgpp::base::RefinementFunctor.

References alphas, sgpp::op_factory::createOperationEval(), current_grid_index, sgpp::base::HashGridStorage::getDimension(), sgpp::base::HashGridPoint::getLevelSum(), sgpp::base::HashGridStorage::getPoint(), sgpp::base::HashGridPoint::getStandardCoordinates(), grids, python.statsfileInfo::i, level_penalize, friedman::p, sgpp::combigrid::pow(), pre_comp_evals, and pre_compute.

◆ preComputeEvaluations()

void sgpp::datadriven::GridPointBasedRefinementFunctor::preComputeEvaluations ( )
overridevirtual

Precomputes grid evaluations for all grids.

Used in combination with pre_compute flag = true. Should be called before refinement is done and needs to be re-called after a refinement step is over ie. the surplus vectors got recomputed

Reimplemented from sgpp::datadriven::MultiGridRefinementFunctor.

References alphas, sgpp::op_factory::createOperationEval(), grids, python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, friedman::p, and pre_comp_evals.

Referenced by ~GridPointBasedRefinementFunctor().

◆ setGridIndex()

void sgpp::datadriven::GridPointBasedRefinementFunctor::setGridIndex ( size_t  grid_index)
overridevirtual

Sets the index (into the vector of grids) of the grid to be refined.

Parameters
grid_indexThe index of the grid to be refined

Implements sgpp::datadriven::MultiGridRefinementFunctor.

References current_grid_index.

Referenced by ~GridPointBasedRefinementFunctor().

◆ start()

double sgpp::datadriven::GridPointBasedRefinementFunctor::start ( ) const
overridevirtual

Returns the lower bound of refinement criterion (e.g., alpha or error) (lower bound).

The refinement value of grid points to be refined have to be larger than this value

Returns
lower bound

Implements sgpp::base::RefinementFunctor.

Member Data Documentation

◆ alphas

std::vector<base::DataVector*> sgpp::datadriven::GridPointBasedRefinementFunctor::alphas
protected

◆ current_grid_index

size_t sgpp::datadriven::GridPointBasedRefinementFunctor::current_grid_index
protected

Referenced by operator()(), and setGridIndex().

◆ grids

std::vector<base::Grid*> sgpp::datadriven::GridPointBasedRefinementFunctor::grids
protected

◆ level_penalize

bool sgpp::datadriven::GridPointBasedRefinementFunctor::level_penalize
protected

Referenced by operator()().

◆ pre_comp_evals

std::vector<std::map<std::string, double> > sgpp::datadriven::GridPointBasedRefinementFunctor::pre_comp_evals
protected

Stores grid evaluations at all grids (vector) at the union of grid point coordinates over all grids (hashed by string representation in the map)

Referenced by GridPointBasedRefinementFunctor(), operator()(), and preComputeEvaluations().

◆ pre_compute

bool sgpp::datadriven::GridPointBasedRefinementFunctor::pre_compute
protected

Referenced by operator()().

◆ refinements_num

size_t sgpp::datadriven::GridPointBasedRefinementFunctor::refinements_num
protected

Referenced by getRefinementsNum().

◆ threshold

double sgpp::datadriven::GridPointBasedRefinementFunctor::threshold
protected

Referenced by getRefinementThreshold().


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