![]() |
SG++-Doxygen-Documentation
|
General response surface. More...
#include <ResponseSurface.hpp>
Public Member Functions | |
virtual double | eval (sgpp::base::DataVector v) |
evaluates the response surface [Attention: this is not alway simply "interpolant->eval". | |
virtual double | evalGradient (sgpp::base::DataVector v, sgpp::base::DataVector &gradient)=0 |
evaluates the response surface and its gradient | |
double | l2Error (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints=1000) |
Calculates the l2 error between interpolant and objective function. | |
sgpp::base::DataVector | nrmsError (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints=1000) |
Calculates the normalized root mean square error between interpolant and objective function in random points. | |
sgpp::base::DataVector | nrmsErrorFromTestData (const std::string &fileName, size_t numMCPoints, size_t numDim) |
Calculates the normalized root mean square error between interpolant and objective function from a precalculated set of test points and according values (this set is usually generated by ResponseSurface::precalculateErrorTestData) | |
void | precalculateErrorTestData (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints, const std::string &fileName) |
Evaluates the objective function in random points and stores these points with the according evaluation value The stored set of test data can then later be used to calculate and compare the approximation error. | |
ResponseSurface (size_t numDim) | |
Constructor. | |
virtual | ~ResponseSurface () |
Destructor. | |
Protected Member Functions | |
double | domainVolume () |
calculates the volume of the tensor product domain given by lb and ub | |
void | transformPoint (sgpp::base::DataVector &v, sgpp::base::DataVector lBounds, sgpp::base::DataVector uBounds, sgpp::base::DataVector newlBounds, sgpp::base::DataVector newuBounds) |
transforms a point in hyper-rectangle [lBounds,rBounds] to the hyper-rectangle [newlBounds,newuBounds] | |
Protected Attributes | |
std::shared_ptr< sgpp::base::ScalarFunction > | interpolant |
std::shared_ptr< sgpp::base::ScalarFunctionGradient > | interpolantGradient |
sgpp::base::DataVector | lb |
size_t | numDim |
sgpp::base::DataVector | ub |
General response surface.
Represents an approximation of some function. Usually the approximation is created via interpolation. (But could also be regression for example)
|
inlineexplicit |
Constructor.
|
inlinevirtual |
Destructor.
|
protected |
calculates the volume of the tensor product domain given by lb and ub
References lb, numDim, and ub.
Referenced by sgpp::optimization::SplineResponseSurface::getIntegral().
|
virtual |
evaluates the response surface [Attention: this is not alway simply "interpolant->eval".
In context of active subspaces, for example, the argument v must first be transformed to the active subspace]
v | point in which the response surface shall be evaulated |
Reimplemented in sgpp::optimization::SplineResponseSurface.
References interpolant.
Referenced by python.uq.analysis.asgc.ASGCAnalysis.ASGCAnalysis::estimateDensity(), l2Error(), nrmsError(), and nrmsErrorFromTestData().
|
pure virtual |
evaluates the response surface and its gradient
v | point in which the response surface shall be evaluated |
gradient | reference to return the gradient evaluated in v |
Implemented in sgpp::optimization::SplineResponseSurface.
double sgpp::optimization::ResponseSurface::l2Error | ( | std::shared_ptr< sgpp::base::ScalarFunction > | objectiveFunc, |
size_t | numMCPoints = 1000 |
||
) |
Calculates the l2 error between interpolant and objective function.
objectiveFunc | the objectiveFunction |
numMCPoints | number of Monte Carlo Points |
References eval(), sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.
sgpp::base::DataVector sgpp::optimization::ResponseSurface::nrmsError | ( | std::shared_ptr< sgpp::base::ScalarFunction > | objectiveFunc, |
size_t | numMCPoints = 1000 |
||
) |
Calculates the normalized root mean square error between interpolant and objective function in random points.
objectiveFunc | the objectiveFunction |
numMCPoints | number of Monte Carlo Points |
References eval(), sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.
sgpp::base::DataVector sgpp::optimization::ResponseSurface::nrmsErrorFromTestData | ( | const std::string & | fileName, |
size_t | numMCPoints, | ||
size_t | numDim | ||
) |
Calculates the normalized root mean square error between interpolant and objective function from a precalculated set of test points and according values (this set is usually generated by ResponseSurface::precalculateErrorTestData)
fileName | path to the stored data set |
numMCPoints | the first numMCPoints of the data set are used |
numDim | number of dimensions |
References eval(), fileName, sgpp::base::DataMatrix::fromFile(), and numDim.
void sgpp::optimization::ResponseSurface::precalculateErrorTestData | ( | std::shared_ptr< sgpp::base::ScalarFunction > | objectiveFunc, |
size_t | numMCPoints, | ||
const std::string & | fileName | ||
) |
Evaluates the objective function in random points and stores these points with the according evaluation value The stored set of test data can then later be used to calculate and compare the approximation error.
objectiveFunc | the objective function |
numMCPoints | number of Monte carlo Points |
fileName | path specifying where to save the generated data |
References fileName, sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.
|
protected |
transforms a point in hyper-rectangle [lBounds,rBounds] to the hyper-rectangle [newlBounds,newuBounds]
v | point in [lBounds,uBounds] |
lBounds | lower bounds |
uBounds | upper bounds |
newlBounds | new lower bounds |
newuBounds | new upper bounds |
References sgpp::base::DataVector::add(), sgpp::base::DataVector::componentwise_div(), sgpp::base::DataVector::componentwise_mult(), and sgpp::base::DataVector::sub().
Referenced by sgpp::optimization::SplineResponseSurface::eval(), sgpp::optimization::SplineResponseSurface::evalGradient(), and sgpp::optimization::SplineResponseSurface::optimize().
|
protected |
Referenced by eval(), sgpp::optimization::SplineResponseSurface::eval(), sgpp::optimization::SplineResponseSurface::optimize(), sgpp::optimization::SplineResponseSurface::regular(), sgpp::optimization::SplineResponseSurface::regularByPoints(), sgpp::optimization::SplineResponseSurface::ritterNovak(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), and sgpp::optimization::SplineResponseSurface::surplusAdaptive().
|
protected |
Referenced by sgpp::optimization::SplineResponseSurface::evalGradient(), sgpp::optimization::SplineResponseSurface::optimize(), sgpp::optimization::SplineResponseSurface::regular(), sgpp::optimization::SplineResponseSurface::regularByPoints(), sgpp::optimization::SplineResponseSurface::ritterNovak(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), and sgpp::optimization::SplineResponseSurface::surplusAdaptive().
|
protected |
Referenced by domainVolume(), sgpp::optimization::SplineResponseSurface::eval(), sgpp::optimization::SplineResponseSurface::evalGradient(), sgpp::optimization::SplineResponseSurface::getLowerBounds(), l2Error(), nrmsError(), sgpp::optimization::SplineResponseSurface::optimize(), precalculateErrorTestData(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), and sgpp::optimization::SplineResponseSurface::SplineResponseSurface().
|
protected |
Referenced by domainVolume(), l2Error(), nrmsError(), nrmsErrorFromTestData(), sgpp::optimization::SplineResponseSurface::optimize(), precalculateErrorTestData(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), and sgpp::optimization::SplineResponseSurface::SplineResponseSurface().
|
protected |
Referenced by domainVolume(), sgpp::optimization::SplineResponseSurface::eval(), sgpp::optimization::SplineResponseSurface::evalGradient(), sgpp::optimization::SplineResponseSurface::getUpperBounds(), l2Error(), nrmsError(), sgpp::optimization::SplineResponseSurface::optimize(), precalculateErrorTestData(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), sgpp::optimization::SplineResponseSurface::SplineResponseSurface(), and sgpp::optimization::SplineResponseSurface::SplineResponseSurface().