SG++-Doxygen-Documentation
sgpp::base::ImpurityRefinementIndicator Class Reference

A refinement indicator for classification problems based on impurity measures (e.g. More...

#include <ImpurityRefinementIndicator.hpp>

Inheritance diagram for sgpp::base::ImpurityRefinementIndicator:
sgpp::base::RefinementFunctor

Public Types

typedef GridPoint counter_key_type
 
typedef std::pair< size_t, double > value_type
 
- Public Types inherited from sgpp::base::RefinementFunctor
typedef double value_type
 

Public Member Functions

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...
 
 ImpurityRefinementIndicator (Grid &grid, DataMatrix &dataset, DataVector *alphas, DataVector *w1, DataVector *w2, DataVector &classesComputed, double threshold=0.0, size_t refinementsNum=1)
 Constructor. More...
 
virtual double operator() (GridPoint &point) const
 This should be returning a refinement indicator for the specified grid point. More...
 
double operator() (GridStorage &storage, size_t seq) const override
 This should be returning a refinement value for every grid point. More...
 
double start () const override
 Returns the lower bound of refinement criterion (e.g., alpha or error) (lower bound). More...
 
void update (GridPoint &point)
 Update normal vector of SVM. More...
 
- 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...
 

Public Attributes

DataVectoralphas
 
DataVectorw1
 
DataVectorw2
 

Protected Attributes

DataVectorclassesComputed
 
DataMatrixdataset
 
size_t refinementsNum
 
double threshold
 

Detailed Description

A refinement indicator for classification problems based on impurity measures (e.g.

gini impurity, entropy impurity,...). It calculates local impurities based on the information from the provided data set. If the indicator is applied within the SVM learner, the normal vector needs to be extended after each refinement.

Member Typedef Documentation

typedef std::pair<size_t, double> sgpp::base::ImpurityRefinementIndicator::value_type

Constructor & Destructor Documentation

sgpp::base::ImpurityRefinementIndicator::ImpurityRefinementIndicator ( Grid grid,
DataMatrix dataset,
DataVector alphas,
DataVector w1,
DataVector w2,
DataVector classesComputed,
double  threshold = 0.0,
size_t  refinementsNum = 1 
)

Constructor.

Parameters
gridThe grid to refine.
datasetThe set of data points used to compute impurities
alphasThe weights corresponding to the support vectors (only required for SVM learner)
w1Normal vector (only required for SVM learner)
w2Normal vector computed with abs values (only required for SVM learner)
classesComputedThe predicted labels for the data points from dataset
thresholdThe refinement threshold; Only grid points with indicator values greater than this threshold will be refined
refinementsNumThe max amount of grid points to be refined

Member Function Documentation

size_t sgpp::base::ImpurityRefinementIndicator::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 refinementsNum.

double sgpp::base::ImpurityRefinementIndicator::getRefinementThreshold ( ) const
overridevirtual

Returns the threshold for refinement.

Only the grid points with absolute value of refinement criterion greater than this threshold will be refined.

Returns
Threshold value for refinement. Default value: 0.

Implements sgpp::base::RefinementFunctor.

References threshold.

Referenced by sgpp::base::ImpurityRefinement::getIndicator().

double sgpp::base::ImpurityRefinementIndicator::operator() ( GridPoint point) const
virtual

This should be returning a refinement indicator for the specified grid point.

The point with the highest value will be refined first.

Parameters
pointThe grid point for which to calculate an indicator value
Returns
The indicator value

References classesComputed, dataset, chess::dim, sgpp::base::DataVector::get(), sgpp::base::DataMatrix::get(), sgpp::base::HashGridPoint::getDimension(), sgpp::base::HashGridPoint::getIndex(), sgpp::base::HashGridPoint::getLevel(), sgpp::base::DataMatrix::getNrows(), h, python.statsfileInfo::i, level, sgpp::combigrid::pow(), sgpp::base::DataVector::set(), and sgpp::base::DataVector::setAll().

double sgpp::base::ImpurityRefinementIndicator::operator() ( 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.

double sgpp::base::ImpurityRefinementIndicator::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

DataVector* sgpp::base::ImpurityRefinementIndicator::alphas
DataVector& sgpp::base::ImpurityRefinementIndicator::classesComputed
protected

Referenced by operator()().

DataMatrix& sgpp::base::ImpurityRefinementIndicator::dataset
protected

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

size_t sgpp::base::ImpurityRefinementIndicator::refinementsNum
protected

Referenced by getRefinementsNum().

double sgpp::base::ImpurityRefinementIndicator::threshold
protected

Referenced by getRefinementThreshold().

DataVector* sgpp::base::ImpurityRefinementIndicator::w1
DataVector* sgpp::base::ImpurityRefinementIndicator::w2

Referenced by update().


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