SG++-Doxygen-Documentation
|
Multiple class refinement is based on the zero-crossing based refinement. More...
#include <MultipleClassRefinementFunctor.hpp>
Public Member Functions | |
double | getBorderPenalty () |
Gets the factor, the borders are penalized with. More... | |
double | getTopPercent () |
Gets the range in which densities are considered to be close. More... | |
MultipleClassRefinementFunctor (std::vector< base::Grid *> grids, std::vector< base::DataVector *> alphas, size_t refinements_num, size_t partCombined, double thresh) | |
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 | refine () |
Organizes the refinement of the classes uses set parameter to execute the refinement step. More... | |
void | setBorderPenalty (double newPenalty) |
Sets the factor, used to penalize the borders. More... | |
void | setTopPercent (double newPercent) |
Sets the range in which densities are considered to be close. More... | |
Public Member Functions inherited from sgpp::datadriven::ZeroCrossingRefinementFunctor | |
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... | |
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... | |
ZeroCrossingRefinementFunctor (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... | |
virtual | ~ZeroCrossingRefinementFunctor () |
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... | |
Additional Inherited Members | |
Public Types inherited from sgpp::base::RefinementFunctor | |
typedef double | value_type |
Protected Member Functions inherited from sgpp::datadriven::ZeroCrossingRefinementFunctor | |
void | getChild (const base::HashGridPoint &gp, size_t d, bool left, base::HashGridPoint &child) const |
std::vector< double > | getEvalVector (size_t ind, size_t seq) const |
Gets the evaluations of all grids at the coords of seq. More... | |
void | getParent (const base::HashGridPoint &gp, size_t d, base::HashGridPoint &par) const |
void | goDown (base::HashGridPoint &gp, base::HashGridPoint &down, size_t d, bool left) const |
Used for non-leaf grid points. More... | |
void | goUp (base::HashGridPoint &gp, base::HashGridPoint &up, size_t d, bool left) const |
Used for leaf grid points. More... | |
bool | hasChild (const base::HashGridPoint &gp, size_t d, bool left) const |
bool | isLeftChild (const base::HashGridPoint &gp, size_t d) const |
int | sgn (double d) const |
Protected Attributes inherited from sgpp::datadriven::ZeroCrossingRefinementFunctor | |
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 |
Multiple class refinement is based on the zero-crossing based refinement.
The zero-crossings are not determinate by pairwise comparing the sings of PDFS f_1 - f_2, but by comparing the dominating class at geometric neighbors, determined for each dimension separately.
Finer levels are penalized by 2^{-|l|}.
sgpp::datadriven::MultipleClassRefinementFunctor::MultipleClassRefinementFunctor | ( | std::vector< base::Grid *> | grids, |
std::vector< base::DataVector *> | alphas, | ||
size_t | refinements_num, | ||
size_t | partCombined, | ||
double | thresh | ||
) |
Constructor.
grids | Vector of grids. current_grid_index specifies the grid to be refined |
alphas | Vector of surpluses related to the grids |
refinements_num | Maximum number of refinements done |
partCombined | Number of refinement done in the combined grid |
thresh | Threshold for refinement scores |
double sgpp::datadriven::MultipleClassRefinementFunctor::getBorderPenalty | ( | ) |
Gets the factor, the borders are penalized with.
double sgpp::datadriven::MultipleClassRefinementFunctor::getTopPercent | ( | ) |
Gets the range in which densities are considered to be close.
Gives a percentage [0,1].
|
overridevirtual |
This should be returning a refinement value for every grid point.
The point with the highest value will be refined first.
storage | reference to the grids storage object |
seq | sequence number in the coefficients array |
Implements sgpp::base::RefinementFunctor.
References sgpp::datadriven::ZeroCrossingRefinementFunctor::alphas, sgpp::base::Grid::createLinearGrid(), sgpp::datadriven::ZeroCrossingRefinementFunctor::current_grid_index, chess::dim, sgpp::base::MultipleClassPoint::getBorderScore(), sgpp::datadriven::ZeroCrossingRefinementFunctor::getChild(), sgpp::base::MultipleClassPoint::getDensity(), sgpp::base::HashGridStorage::getDimension(), sgpp::base::MultipleClassPoint::getDominateClass(), sgpp::base::HashGridPoint::getIndex(), sgpp::base::HashGridPoint::getLevel(), sgpp::base::MultipleClassPoint::getNeighbors(), sgpp::base::HashGridStorage::getPoint(), sgpp::base::HashGridStorage::getSequenceNumber(), sgpp::base::Grid::getStorage(), sgpp::base::MultipleClassPoint::getTopClasses(), sgpp::datadriven::ZeroCrossingRefinementFunctor::grids, sgpp::base::Grid::insertPoint(), sgpp::base::HashGridStorage::isContaining(), sgpp::base::HashGridPoint::isLeaf(), level, sgpp::combigrid::pow(), and sgpp::base::HashGridStorage::recalcLeafProperty().
void sgpp::datadriven::MultipleClassRefinementFunctor::refine | ( | ) |
Organizes the refinement of the classes uses set parameter to execute the refinement step.
Creates the combined grid and starts the refinement.
References sgpp::base::HashRefinement::free_refine(), sgpp::base::Grid::getStorage(), sgpp::datadriven::ZeroCrossingRefinementFunctor::grids, python.statsfileInfo::i, sgpp::datadriven::ZeroCrossingRefinementFunctor::refinements_num, sgpp::datadriven::ZeroCrossingRefinementFunctor::setGridIndex(), and analyse_erg::tmp.
Referenced by sgpp::datadriven::ModelFittingClassification::refine().
void sgpp::datadriven::MultipleClassRefinementFunctor::setBorderPenalty | ( | double | newPenalty | ) |
Sets the factor, used to penalize the borders.
The border score is multiplied with the factor before beeing added to the overall score.
newPenalty | Factor to penalize the borders |
References sgpp::base::Grid::getStorage(), and sgpp::base::HashGridIterator::set().
void sgpp::datadriven::MultipleClassRefinementFunctor::setTopPercent | ( | double | newPercent | ) |
Sets the range in which densities are considered to be close.
Set the percentage [0,1] the densities need to have, compared to the density of the dominating class.
newPercent | Set the new range |