SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::datadriven::LearnerLeastSquaresIdentity Class Reference

This class implements standard sparse grid regression with an Identity matrix as regularization operator. More...

#include <LearnerLeastSquaresIdentity.hpp>

Inheritance diagram for sgpp::datadriven::LearnerLeastSquaresIdentity:
sgpp::datadriven::LearnerBase

Public Member Functions

std::vector< std::pair< size_t, double > > getRefinementExecTimes ()
 
 LearnerLeastSquaresIdentity (const bool isRegression, const bool isVerbose=true)
 Constructor.
 
void multTranspose (sgpp::base::DataMatrix &dataset, sgpp::base::DataVector &multiplier, sgpp::base::DataVector &result) override
 
virtual void predict (sgpp::base::DataMatrix &testDataset, sgpp::base::DataVector &classesComputed)
 executes a Regression test for a given dataset and returns the result
 
void predict (sgpp::base::DataMatrix &testDataset, sgpp::base::DataVector &classesComputed) override
 executes a Regression test for a given dataset and returns the result
 
void setImplementation (sgpp::datadriven::OperationMultipleEvalConfiguration operationConfiguration)
 
double testRegular (const sgpp::base::RegularGridConfiguration &gridConfig, sgpp::base::DataMatrix &testDataset)
 
 ~LearnerLeastSquaresIdentity () override
 Destructor.
 
- 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.
 
void dumpGrid (std::string tFilename)
 simple dump of grid points into file, e.g.
 
virtual double getAccuracy (const sgpp::base::DataVector &classesComputed, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the accuracy for given testDataset.
 
virtual double getAccuracy (sgpp::base::DataMatrix &testDataset, const sgpp::base::DataVector &classesReference, const double threshold=0.0)
 compute the accuracy for given testDataset.
 
sgpp::base::DataVectorgetAlpha ()
 
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!
 
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
 
sgpp::base::GridgetGrid ()
 
bool getIsRegression () const
 determines the current mode
 
bool getIsVerbose () const
 determines the current verbose mode of learner
 
std::vector< std::pair< size_t, double > > getRefinementExecTimes ()
 
 LearnerBase (const bool isRegression, const bool isVerbose=true)
 Constructor.
 
 LearnerBase (const LearnerBase &copyMe)
 Copy-Constructor.
 
void setIsVerbose (const bool isVerbose)
 sets the current verbose mode of learner
 
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.
 
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.
 
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::AdaptivityConfiguration &adaptivityConfig, bool testAccDuringAdapt, const double lambdaRegularization, sgpp::base::DataMatrix *testDataset=nullptr, sgpp::base::DataVector *testClasses=nullptr)
 Learning a dataset with spatially adaptive sparse grids.
 
virtual ~LearnerBase ()
 Destructor.
 

Protected Member Functions

std::unique_ptr< sgpp::datadriven::DMSystemMatrixBasecreateDMSystem (sgpp::base::DataMatrix &trainDataset, double lambda) override
 abstract method that constructs the corresponding system of linear equations Derived classes MUST overwrite this functions!
 
void postProcessing (const sgpp::base::DataMatrix &trainDataset, const sgpp::solver::SLESolverType &solver, const size_t numNeededIterations) override
 Hook-Method for post-processing after each refinement learning.
 
- Protected Member Functions inherited from sgpp::datadriven::LearnerBase
virtual void InitializeGrid (const sgpp::base::RegularGridConfiguration &gridConfig)
 Initialize the grid and its coefficients.
 
virtual void preProcessing ()
 Hook-Method for pre-processing before starting learning.
 

Additional Inherited Members

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

Detailed Description

This class implements standard sparse grid regression with an Identity matrix as regularization operator.

Furthermore this Learner provides support for several vectorization approaches covering GPUs, CPUs and coprocessors.

Constructor & Destructor Documentation

◆ LearnerLeastSquaresIdentity()

sgpp::datadriven::LearnerLeastSquaresIdentity::LearnerLeastSquaresIdentity ( const bool  isRegression,
const bool  isVerbose = true 
)
explicit

Constructor.

Parameters
isRegressionset to true if a regression task should be executed
isVerboseset to true in order to allow console output

◆ ~LearnerLeastSquaresIdentity()

sgpp::datadriven::LearnerLeastSquaresIdentity::~LearnerLeastSquaresIdentity ( )
override

Destructor.

Member Function Documentation

◆ createDMSystem()

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

abstract method that constructs the corresponding system of linear equations Derived classes MUST overwrite this functions!

Parameters
trainDatasettraining dataset
lambdalambda regularization parameter

Implements sgpp::datadriven::LearnerBase.

References sgpp::datadriven::LearnerBase::grid, and lambda.

◆ getRefinementExecTimes()

std::vector< std::pair< size_t, double > > sgpp::datadriven::LearnerLeastSquaresIdentity::getRefinementExecTimes ( )

◆ multTranspose()

void sgpp::datadriven::LearnerLeastSquaresIdentity::multTranspose ( sgpp::base::DataMatrix dataset,
sgpp::base::DataVector multiplier,
sgpp::base::DataVector result 
)
overridevirtual

◆ postProcessing()

void sgpp::datadriven::LearnerLeastSquaresIdentity::postProcessing ( const sgpp::base::DataMatrix trainDataset,
const sgpp::solver::SLESolverType solver,
const size_t  numNeededIterations 
)
overrideprotectedvirtual

◆ predict() [1/2]

void sgpp::datadriven::LearnerBase::predict ( sgpp::base::DataMatrix testDataset,
sgpp::base::DataVector classesComputed 
)
virtual

executes a Regression test for a given dataset and returns the result

Parameters
testDatasetdataset that is evaluated with the current learner
classesComputedresult of the evaluation of the data set

Reimplemented from sgpp::datadriven::LearnerBase.

◆ predict() [2/2]

void sgpp::datadriven::LearnerLeastSquaresIdentity::predict ( sgpp::base::DataMatrix testDataset,
sgpp::base::DataVector classesComputed 
)
overridevirtual

executes a Regression test for a given dataset and returns the result

Parameters
testDatasetdataset that is evaluated with the current learner
classesComputedresult of the evaluation of the data set

Reimplemented from sgpp::datadriven::LearnerBase.

References sgpp::datadriven::LearnerBase::alpha, sgpp::op_factory::createOperationMultipleEval(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::LearnerBase::grid, and sgpp::base::OperationMultipleEval::mult().

◆ setImplementation()

void sgpp::datadriven::LearnerLeastSquaresIdentity::setImplementation ( sgpp::datadriven::OperationMultipleEvalConfiguration  operationConfiguration)
inline

◆ testRegular()


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