SG++-Doxygen-Documentation
|
Data based refinement uses data points to find refinement candidates. More...
#include <DataBasedRefinementFunctor.hpp>
Public Member Functions | |
void | computeH () |
Recomputes the set of relevant data (the set H). More... | |
DataBasedRefinementFunctor (std::vector< base::Grid *> grids, std::vector< base::DataVector *> alphas, base::DataMatrix *data, base::DataVector *targets, size_t refinements_num=1, bool level_penalize=false, std::vector< double > coeff_a=std::vector< double >(), double threshold=0.0) | |
Constructor. More... | |
base::DataMatrix & | getHk (size_t index) |
Returns a ref to the specified H_k, used for debugging /plotting. More... | |
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 | setData (base::DataMatrix *data, base::DataVector *targets) |
Set the training data + targets which is the basis for determining relevant data points. 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 | ~DataBasedRefinementFunctor () |
Public Member Functions inherited from sgpp::datadriven::MultiGridRefinementFunctor | |
virtual void | preComputeEvaluations () |
Used if expensive computations (eg. More... | |
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 Member Functions | |
void | computeHkl (base::DataMatrix &inters, size_t cl_ind1, size_t cl_ind2) |
Computes the "intersection data points" of class k and l. More... | |
bool | isWithinSupport (base::HashGridPoint &gp, base::DataVector &point) const |
Is point in support of basis function at gp. More... | |
Protected Attributes | |
std::vector< base::DataVector * > | alphas |
std::vector< double > | coeff_a |
The scaling coefficients for this->means. More... | |
size_t | current_grid_index |
base::DataMatrix * | data |
Pointer to the training data used for determining H. More... | |
base::DataMatrix | evals |
Evaluations of data points are cached here. More... | |
std::vector< base::Grid * > | grids |
std::vector< base::DataMatrix > | h |
Each H_k contains a set of "intersection data points" between class k and all other classes. More... | |
bool | level_penalize |
std::vector< double > | means |
The mean values of the PDFs given by grids, alphas Approximated using this->data. More... | |
size_t | refinements_num |
base::DataVector * | targets |
Pointer to targets related to this->data. More... | |
double | threshold |
Additional Inherited Members | |
Public Types inherited from sgpp::base::RefinementFunctor | |
typedef double | value_type |
Data based refinement uses data points to find refinement candidates.
For the given data sets class-intersection sets H_k are computed. A grid points is included in H_k if for at least on class l PDF_k(point) > coeff_a_k * mu_k AND PDF_l(point) > coeff_a_l * mu_l. To determine the score of a grid point, the number of data points from H_k within the support of this grid point is taken
sgpp::datadriven::DataBasedRefinementFunctor::DataBasedRefinementFunctor | ( | std::vector< base::Grid *> | grids, |
std::vector< base::DataVector *> | alphas, | ||
base::DataMatrix * | data, | ||
base::DataVector * | targets, | ||
size_t | refinements_num = 1 , |
||
bool | level_penalize = false , |
||
std::vector< double > | coeff_a = std::vector<double>() , |
||
double | threshold = 0.0 |
||
) |
Constructor.
grids | Vector of grids. current_grid_index specifies the grid to be refined |
alphas | Vector of surpluses related to the grids |
data | The data used to compute the sets H_k |
targets | The classes for data |
refinements_num | Maximum number of refinements done |
level_penalize | If a level penalizing is multiplied to the score (2^{|l|_1}) |
coeff_a | Scaling coefficients for the computation of H_k. Per default 1.0 |
threshold | Threshold for refinement scores |
References computeH().
|
inlinevirtual |
References computeH(), getHk(), getNumGrids(), setData(), and setGridIndex().
void sgpp::datadriven::DataBasedRefinementFunctor::computeH | ( | ) |
Recomputes the set of relevant data (the set H).
If the training data is changed, call this method to actually re-compute H. Might require a lot of time depending on the size of the training data.
References alphas, computeHkl(), sgpp::op_factory::createOperationMultipleEval(), data, evals, sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), grids, h, python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, means, sgpp::base::DataMatrix::resize(), and sgpp::base::DataMatrix::setColumn().
Referenced by DataBasedRefinementFunctor(), and ~DataBasedRefinementFunctor().
|
protected |
Computes the "intersection data points" of class k and l.
References sgpp::base::DataMatrix::appendRow(), coeff_a, data, evals, sgpp::base::DataMatrix::get(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), python.statsfileInfo::i, means, and friedman::p.
Referenced by computeH().
base::DataMatrix & sgpp::datadriven::DataBasedRefinementFunctor::getHk | ( | size_t | index | ) |
Returns a ref to the specified H_k, used for debugging /plotting.
index | The index k for H_k |
References h.
Referenced by ~DataBasedRefinementFunctor().
|
overridevirtual |
Returns the number of grids the functor can / does refine.
Implements sgpp::datadriven::MultiGridRefinementFunctor.
References grids.
Referenced by ~DataBasedRefinementFunctor().
|
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.
Reimplemented from sgpp::base::RefinementFunctor.
References refinements_num.
|
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.
Implements sgpp::base::RefinementFunctor.
References threshold.
|
protected |
Is point in support of basis function at gp.
References sgpp::base::DataVector::get(), sgpp::base::HashGridPoint::getLevel(), sgpp::base::DataVector::getSize(), sgpp::base::HashGridPoint::getStandardCoordinate(), level, and sgpp::combigrid::pow().
Referenced by operator()().
|
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 current_grid_index, data, sgpp::base::HashGridPoint::getLevelSum(), sgpp::base::DataMatrix::getNcols(), sgpp::base::HashGridStorage::getPoint(), h, isWithinSupport(), python.utils.statsfile2gnuplot::j, level_penalize, friedman::p, and sgpp::combigrid::pow().
void sgpp::datadriven::DataBasedRefinementFunctor::setData | ( | base::DataMatrix * | data, |
base::DataVector * | targets | ||
) |
Set the training data + targets which is the basis for determining relevant data points.
This method is only necessary in data-streaming scenarios where the training data changes overall.
data | Pointer to the (subset of) training data used |
targets | Pointer to the related targets |
Referenced by ~DataBasedRefinementFunctor().
|
overridevirtual |
Sets the index (into the vector of grids) of the grid to be refined.
grid_index | The index of the grid to be refined |
Implements sgpp::datadriven::MultiGridRefinementFunctor.
References current_grid_index.
Referenced by ~DataBasedRefinementFunctor().
|
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
Implements sgpp::base::RefinementFunctor.
|
protected |
Referenced by computeH().
|
protected |
The scaling coefficients for this->means.
Referenced by computeHkl().
|
protected |
Referenced by operator()(), and setGridIndex().
|
protected |
Pointer to the training data used for determining H.
Referenced by computeH(), computeHkl(), operator()(), and setData().
|
protected |
Evaluations of data points are cached here.
Referenced by computeH(), and computeHkl().
|
protected |
Referenced by computeH(), and getNumGrids().
|
protected |
Each H_k contains a set of "intersection data points" between class k and all other classes.
These sets are the basis for the scoring process
Referenced by computeH(), getHk(), and operator()().
|
protected |
Referenced by operator()().
|
protected |
The mean values of the PDFs given by grids, alphas Approximated using this->data.
Referenced by computeH(), and computeHkl().
|
protected |
Referenced by getRefinementsNum().
|
protected |
Pointer to targets related to this->data.
Referenced by setData().
|
protected |
Referenced by getRefinementThreshold().