SG++
sgpp::datadriven::LearnerDensityBased Class Reference

#include <LearnerDensityBased.hpp>

Inheritance diagram for sgpp::datadriven::LearnerDensityBased:
sgpp::datadriven::LearnerBase

Public Member Functions

std::unique_ptr< datadriven::DMSystemMatrixBasecreateDMSystem (base::DataMatrix &trainDataset, double lambda) override
 construct system matrix More...
 
size_t getNrClasses ()
 Get number of classes. More...
 
size_t getNrGridPoints ()
 Returns number of grid points for the density with the maximum number of grid points. More...
 
bool getWithPrior ()
 Get Prior. More...
 
void InitializeGrid (const base::RegularGridConfiguration &GridConfig) override
 Create a grid for each class. More...
 
 LearnerDensityBased (datadriven::RegularizationType &, const bool isRegression, const bool isVerbose=true)
 
virtual base::DataVector predict (base::DataMatrix &testDataset)
 
size_t setNrClasses (size_t c)
 Set number of classes. More...
 
bool setWithPrior (bool p)
 Set prior. More...
 
virtual LearnerTiming train (base::DataMatrix &testDataset, base::DataVector &classes, const base::RegularGridConfiguration &GridConfig, const solver::SLESolverConfiguration &SolverConfigRefine, const solver::SLESolverConfiguration &SolverConfigFinal, const base::AdpativityConfiguration &AdaptConfig, bool testAccDuringAdapt, const double lambda)
 Learning a dataset with spatially adaptive sparse grids. More...
 
virtual ~LearnerDensityBased ()
 
- Public Member Functions inherited from sgpp::datadriven::LearnerBase
void dumpFunction (std::string tFilename, size_t resolution)
 simple dump of sparse grid function into file, e.g. More...
 
void dumpGrid (std::string tFilename)
 simple dump of grid points into file, e.g. More...
 
virtual double getAccuracy (sgpp::base::DataMatrix &testDataset, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the accuracy for given testDataset. More...
 
virtual double getAccuracy (const sgpp::base::DataVector &classesComputed, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the accuracy for given testDataset. More...
 
sgpp::base::DataVectorgetAlpha ()
 
virtual ClassificatorQuality getCassificatorQuality (sgpp::base::DataMatrix &testDataset, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the quality for given testDataset, classification ONLY! test is automatically called in order to determine the regression values of the current learner More...
 
virtual ClassificatorQuality getCassificatorQuality (const sgpp::base::DataVector &classesComputed, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the quality for given testDataset, classification ONLY! More...
 
sgpp::base::GridgetGrid ()
 
bool getIsRegression () const
 determines the current mode More...
 
bool getIsVerbose () const
 determines the current verbose mode of learner More...
 
std::vector< std::pair< size_t, double > > getRefinementExecTimes ()
 
 LearnerBase (const bool isRegression, const bool isVerbose=true)
 Constructor. More...
 
 LearnerBase (const LearnerBase &copyMe)
 Copy-Constructor. More...
 
virtual void multTranspose (sgpp::base::DataMatrix &dataset, sgpp::base::DataVector &multiplier, sgpp::base::DataVector &result)
 
virtual void predict (sgpp::base::DataMatrix &testDataset, sgpp::base::DataVector &classesComputed)
 executes a Regression test for a given dataset and returns the result More...
 
void setIsVerbose (const bool isVerbose)
 sets the current verbose mode of learner More...
 
void setReuseCoefficients (bool reuseCoefficients)
 
void setSolverVerbose (bool solverVerbose)
 
void store (std::string tGridFilename, std::string tAlphaFilename)
 store the grid and its current coefficients into files for further usage. More...
 
virtual LearnerTiming train (sgpp::base::DataMatrix &trainDataset, sgpp::base::DataVector &classes, const sgpp::base::RegularGridConfiguration &GridConfig, const sgpp::solver::SLESolverConfiguration &SolverConfigRefine, const sgpp::solver::SLESolverConfiguration &SolverConfigFinal, const sgpp::base::AdpativityConfiguration &AdaptConfig, bool testAccDuringAdapt, const double lambdaRegularization, sgpp::base::DataMatrix *testDataset=nullptr, sgpp::base::DataVector *testClasses=nullptr)
 Learning a dataset with spatially adaptive sparse grids. More...
 
LearnerTiming train (sgpp::base::DataMatrix &trainDataset, sgpp::base::DataVector &classes, const sgpp::base::RegularGridConfiguration &GridConfig, const sgpp::solver::SLESolverConfiguration &SolverConfig, const double lambdaRegularization)
 Learning a dataset with regular sparse grids. More...
 
virtual ~LearnerBase ()
 Destructor. More...
 

Protected Attributes

std::vector< base::DataVectoralphaVec
 
datadriven::RegularizationType CMode
 regularization mode More...
 
std::vector< std::unique_ptr< base::OperationMatrix > > CVec
 
std::vector< std::unique_ptr< base::Grid > > gridVec
 
std::map< int, double > indexToClass
 
size_t nrClasses
 
std::vector< double > prior
 
bool withPrior
 
- Protected Attributes inherited from sgpp::datadriven::LearnerBase
std::unique_ptr< sgpp::base::DataVectoralpha
 the grid's coefficients More...
 
size_t currentRefinementStep
 the current refinment step during training More...
 
double execTime
 execution time More...
 
std::vector< std::pair< size_t, double > > ExecTimeOnStep
 
double GByte
 number of transferred Gbytes More...
 
double GFlop
 number of executed Floating Point operations More...
 
std::unique_ptr< sgpp::base::Gridgrid
 sparse grid object More...
 
bool isRegression
 is regression selected More...
 
bool isTrained
 is the grid trained More...
 
bool isVerbose
 is verbose output enabled More...
 
bool reuseCoefficients
 shall the coefficients be reused between refinement steps More...
 
bool solverVerbose
 sets the verbose option for the solver More...
 
double stepExecTime
 execution time for current refinement to calculate the GFlops at the current timestep only otherwise accumulated GFlops (all refinement steps) are calculated More...
 
double stepGByte
 number of transferred Gbytes in the current refinement step More...
 
double stepGFlop
 number of executed Floating Point operations in the current refinement step More...
 

Additional Inherited Members

- Protected Member Functions inherited from sgpp::datadriven::LearnerBase
virtual void postProcessing (const sgpp::base::DataMatrix &trainDataset, const sgpp::solver::SLESolverType &solver, const size_t numNeededIterations)
 Hook-Method for post-processing after each refinement learning. More...
 
virtual void preProcessing ()
 Hook-Method for pre-processing before starting learning. More...
 

Constructor & Destructor Documentation

sgpp::datadriven::LearnerDensityBased::LearnerDensityBased ( datadriven::RegularizationType regularization,
const bool  isRegression,
const bool  isVerbose = true 
)

References nrClasses, and withPrior.

sgpp::datadriven::LearnerDensityBased::~LearnerDensityBased ( )
virtual

References alphaVec, CVec, and gridVec.

Member Function Documentation

std::unique_ptr< datadriven::DMSystemMatrixBase > sgpp::datadriven::LearnerDensityBased::createDMSystem ( base::DataMatrix trainDataset,
double  lambda 
)
overridevirtual

construct system matrix

Implements sgpp::datadriven::LearnerBase.

size_t sgpp::datadriven::LearnerDensityBased::getNrClasses ( )
inline

Get number of classes.

References nrClasses.

size_t sgpp::datadriven::LearnerDensityBased::getNrGridPoints ( )

Returns number of grid points for the density with the maximum number of grid points.

References gridVec.

bool sgpp::datadriven::LearnerDensityBased::getWithPrior ( )
inline

Get Prior.

References withPrior.

void sgpp::datadriven::LearnerDensityBased::InitializeGrid ( const base::RegularGridConfiguration GridConfig)
overridevirtual
size_t sgpp::datadriven::LearnerDensityBased::setNrClasses ( size_t  c)
inline

Set number of classes.

Parameters
cset number of classes

References nrClasses.

Referenced by train().

bool sgpp::datadriven::LearnerDensityBased::setWithPrior ( bool  p)
inline

Set prior.

Parameters
pprior

References withPrior.

LearnerTiming sgpp::datadriven::LearnerDensityBased::train ( base::DataMatrix testDataset,
base::DataVector classes,
const base::RegularGridConfiguration GridConfig,
const solver::SLESolverConfiguration SolverConfigRefine,
const solver::SLESolverConfiguration SolverConfigFinal,
const base::AdpativityConfiguration AdaptConfig,
bool  testAccDuringAdapt,
const double  lambda 
)
virtual

Learning a dataset with spatially adaptive sparse grids.

Parameters
testDatasetthe training dataset
classesclasses corresponding to the training dataset
GridConfigconfiguration of the regular start grid
SolverConfigRefineconfiguration of the SLE solver during the adaptive refinements of the grid
SolverConfigFinalconfiguration of the final SLE solving step on the refined grid
AdaptConfigconfiguration of the adaptivity strategy
testAccDuringAdaptset to true if the training accuracy should be determined in evert refinement step
lambdaregularization parameter lambda

References sgpp::datadriven::LearnerBase::alpha, alphaVec, sgpp::solver::BiCGSTAB, sgpp::solver::CG, CMode, sgpp::op_factory::createOperationIdentity(), sgpp::op_factory::createOperationLaplace(), CVec, sgpp::solver::SLESolverConfiguration::eps_, sgpp::datadriven::LearnerBase::execTime, sgpp::datadriven::LearnerBase::GByte, sgpp::datadriven::LearnerTiming::GByte_, sgpp::datadriven::DensitySystemMatrix::generateb(), sgpp::base::DataVector::get(), sgpp::datadriven::LearnerBase::getAccuracy(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), sgpp::base::DataVector::getSize(), sgpp::datadriven::LearnerBase::GFlop, sgpp::datadriven::LearnerTiming::GFlop_, gridVec, sgpp::datadriven::Identity, indexToClass, InitializeGrid(), sgpp::datadriven::LearnerBase::isRegression, sgpp::datadriven::LearnerBase::isTrained, sgpp::datadriven::LearnerBase::isVerbose, sgpp::datadriven::Laplace, m, sgpp::solver::SLESolverConfiguration::maxIterations_, sgpp::base::AdpativityConfiguration::noPoints_, sgpp::base::AdpativityConfiguration::numRefinements_, sgpp::datadriven::LearnerBase::postProcessing(), prior, sgpp::base::DataVector::setAll(), setNrClasses(), sgpp::datadriven::LearnerTiming::timeComplete_, sgpp::solver::SLESolverConfiguration::type_, and withPrior.

Member Data Documentation

std::vector<base::DataVector> sgpp::datadriven::LearnerDensityBased::alphaVec
protected
datadriven::RegularizationType sgpp::datadriven::LearnerDensityBased::CMode
protected

regularization mode

Referenced by train().

std::vector<std::unique_ptr<base::OperationMatrix> > sgpp::datadriven::LearnerDensityBased::CVec
protected

Referenced by train(), and ~LearnerDensityBased().

std::vector<std::unique_ptr<base::Grid> > sgpp::datadriven::LearnerDensityBased::gridVec
protected
std::map<int, double> sgpp::datadriven::LearnerDensityBased::indexToClass
protected

Referenced by predict(), and train().

size_t sgpp::datadriven::LearnerDensityBased::nrClasses
protected
std::vector<double> sgpp::datadriven::LearnerDensityBased::prior
protected

Referenced by predict(), and train().

bool sgpp::datadriven::LearnerDensityBased::withPrior
protected

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