SG++-Doxygen-Documentation
|
Class to host all methods to perform Bayesian Optimization. More...
#include <BayesianOptimization.hpp>
Public Member Functions | |
double | acquisitionOuter (const base::DataVector &inp) |
Wrapper function for use in optimizer. More... | |
BayesianOptimization (const std::vector< BOConfig > &initialConfigs) | |
Constructor setting up Gaussian Process. More... | |
void | decomposeCholesky (base::DataMatrix &km, base::DataMatrix &gnew) |
Perform a Cholesky Decomposition. More... | |
base::DataVector | fitScales () |
fitting the Gaussian Process to the data in the form of scaling the hyperparameters in relation to each other by likelihood maximization More... | |
double | kernel (double distance) |
kernel function More... | |
double | likelihood (const base::DataVector &inp) |
Gaussian Process likelihood to perform likelihood maximization over. More... | |
BOConfig | main (BOConfig &prototype) |
main routine to find new sample point More... | |
double | mean (base::DataVector &knew) |
void | setScales (base::DataVector nscales, double factor) |
void | solveCholeskySystem (base::DataMatrix &gmatrix, base::DataVector &x) |
Solve a system of linear equations using previously decomposed matrix. More... | |
void | updateGP (BOConfig &newConfig, bool normalize) |
Gaussian Process update step. More... | |
double | var (base::DataVector &knew, double kself) |
Static Public Member Functions | |
static double | acquisitionEI (double dMean, double dVar, double bestsofar) |
Implementation of mathematical formulation of the expected improvement acquisition function. More... | |
Protected Attributes | |
std::vector< BOConfig > | allConfigs |
existing sample points in the Gaussian Process More... | |
double | bestsofar |
best score encountered so far (used for expected improvement calculation) More... | |
bool | decomFailed = false |
debugging variable for numerical instabilities More... | |
base::DataMatrix | gleft |
Cholesky Decomposition of the Gram matrix. More... | |
base::DataMatrix | kernelmatrix |
Gram matrix containing all kernel values between all existing samples. More... | |
double | maxofmax |
debugging variable for numerical instabilities More... | |
base::DataVector | rawScores |
score values belonging to all existing sample points More... | |
base::DataVector | scales |
scales of the hyperparameter space used to compute the kernel (set by fitScales()) More... | |
bool | screwedvar |
debugging variable for numerical instabilities More... | |
base::DataVector | transformedOutput |
solution of Kx = s where K is the Gram matrix and s the scores of the samples More... | |
Class to host all methods to perform Bayesian Optimization.
|
explicit |
Constructor setting up Gaussian Process.
initialConfigs | non-empty vector of initial points to build the Gaussian Process |
References allConfigs, bestsofar, python.statsfileInfo::i, sgpp::base::DataVector::max(), sgpp::base::DataVector::min(), sgpp::base::DataVector::normalize(), rawScores, scales, setScales(), sgpp::base::DataVector::sub(), and sgpp::base::DataVector::sum().
|
static |
Implementation of mathematical formulation of the expected improvement acquisition function.
Referenced by acquisitionOuter().
double sgpp::datadriven::BayesianOptimization::acquisitionOuter | ( | const base::DataVector & | inp | ) |
Wrapper function for use in optimizer.
inp | point in continuous optimization space |
References acquisitionEI(), allConfigs, bestsofar, python.statsfileInfo::i, kernel(), m, mean(), scales, and var().
Referenced by main().
void sgpp::datadriven::BayesianOptimization::decomposeCholesky | ( | base::DataMatrix & | km, |
base::DataMatrix & | gnew | ||
) |
Perform a Cholesky Decomposition.
km | input matrix |
gnew | output (triangular) matrix |
References decomFailed, sgpp::base::DataMatrix::get(), sgpp::base::DataMatrix::getNrows(), python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, and sgpp::base::DataMatrix::set().
Referenced by likelihood(), setScales(), and updateGP().
base::DataVector sgpp::datadriven::BayesianOptimization::fitScales | ( | ) |
fitting the Gaussian Process to the data in the form of scaling the hyperparameters in relation to each other by likelihood maximization
References likelihood(), and scales.
Referenced by sgpp::datadriven::BoHyperparameterOptimizer::run().
double sgpp::datadriven::BayesianOptimization::kernel | ( | double | distance | ) |
kernel function
distance | as computed according to some spacial representation |
Referenced by acquisitionOuter(), likelihood(), setScales(), and updateGP().
double sgpp::datadriven::BayesianOptimization::likelihood | ( | const base::DataVector & | inp | ) |
Gaussian Process likelihood to perform likelihood maximization over.
inp | vector containing scales of the hyperparameter space |
References allConfigs, decomposeCholesky(), sgpp::base::DataVector::dotProduct(), sgpp::base::DataMatrix::get(), python.statsfileInfo::i, kernel(), sgpp::combigrid::pow(), rawScores, solveCholeskySystem(), and analyse_erg::tmp.
Referenced by fitScales().
main routine to find new sample point
prototype | baseline BOConfig |
References acquisitionOuter(), allConfigs, sgpp::datadriven::BOConfig::calcDiscDistance(), sgpp::datadriven::BOConfig::getContSize(), sgpp::optimization::optimizer::UnconstrainedOptimizer::getOptimalPoint(), sgpp::optimization::optimizer::UnconstrainedOptimizer::getOptimalValue(), sgpp::datadriven::BOConfig::nextDisc(), sgpp::optimization::optimizer::MultiStart::optimize(), scales, and sgpp::datadriven::BOConfig::setCont().
Referenced by sgpp::datadriven::BoHyperparameterOptimizer::run().
double sgpp::datadriven::BayesianOptimization::mean | ( | base::DataVector & | knew | ) |
void sgpp::datadriven::BayesianOptimization::setScales | ( | base::DataVector | nscales, |
double | factor | ||
) |
References sgpp::base::DataVector::add(), allConfigs, decomposeCholesky(), gleft, python.statsfileInfo::i, kernel(), kernelmatrix, sgpp::base::DataVector::mult(), sgpp::combigrid::pow(), rawScores, scales, sgpp::base::DataMatrix::set(), solveCholeskySystem(), analyse_erg::tmp, and transformedOutput.
Referenced by BayesianOptimization(), and sgpp::datadriven::BoHyperparameterOptimizer::run().
void sgpp::datadriven::BayesianOptimization::solveCholeskySystem | ( | base::DataMatrix & | gmatrix, |
base::DataVector & | x | ||
) |
Solve a system of linear equations using previously decomposed matrix.
gmatrix | decomposed matrix |
x | target vector |
References sgpp::base::DataMatrix::get(), and python.statsfileInfo::i.
Referenced by likelihood(), setScales(), updateGP(), and var().
void sgpp::datadriven::BayesianOptimization::updateGP | ( | BOConfig & | newConfig, |
bool | normalize | ||
) |
Gaussian Process update step.
Incorporates most recent sample into Gaussian Process.
References allConfigs, sgpp::base::DataMatrix::appendCol(), sgpp::base::DataMatrix::appendRow(), bestsofar, decomFailed, decomposeCholesky(), sgpp::base::DataMatrix::getNcols(), sgpp::datadriven::BOConfig::getScore(), gleft, python.statsfileInfo::i, kernel(), kernelmatrix, sgpp::base::DataVector::max(), maxofmax, sgpp::base::DataVector::min(), sgpp::base::DataMatrix::mult(), sgpp::base::DataVector::normalize(), sgpp::combigrid::pow(), rawScores, scales, screwedvar, sgpp::base::DataMatrix::set(), solveCholeskySystem(), sgpp::base::DataVector::sub(), sgpp::base::DataVector::sum(), analyse_erg::tmp, and transformedOutput.
Referenced by sgpp::datadriven::BoHyperparameterOptimizer::run().
double sgpp::datadriven::BayesianOptimization::var | ( | base::DataVector & | knew, |
double | kself | ||
) |
References python.uq.tools::check(), sgpp::base::DataVector::dotProduct(), gleft, kernelmatrix, maxofmax, sgpp::base::DataMatrix::mult(), screwedvar, solveCholeskySystem(), and analyse_erg::tmp.
Referenced by acquisitionOuter(), python.uq.analysis.mc.MCAnalysis.MCAnalysis::computeMoments(), and python.uq.analysis.asgc.ASGCAnalysis.ASGCAnalysis::computeMoments().
|
protected |
existing sample points in the Gaussian Process
Referenced by acquisitionOuter(), BayesianOptimization(), likelihood(), main(), setScales(), and updateGP().
|
protected |
best score encountered so far (used for expected improvement calculation)
Referenced by acquisitionOuter(), BayesianOptimization(), and updateGP().
|
protected |
debugging variable for numerical instabilities
Referenced by decomposeCholesky(), and updateGP().
|
protected |
Cholesky Decomposition of the Gram matrix.
Referenced by setScales(), updateGP(), and var().
|
protected |
Gram matrix containing all kernel values between all existing samples.
Referenced by setScales(), updateGP(), and var().
|
protected |
debugging variable for numerical instabilities
Referenced by updateGP(), and var().
|
protected |
score values belonging to all existing sample points
Referenced by BayesianOptimization(), likelihood(), setScales(), and updateGP().
|
protected |
scales of the hyperparameter space used to compute the kernel (set by fitScales())
Referenced by acquisitionOuter(), BayesianOptimization(), fitScales(), main(), setScales(), and updateGP().
|
protected |
debugging variable for numerical instabilities
Referenced by updateGP(), and var().
|
protected |
solution of Kx = s where K is the Gram matrix and s the scores of the samples
Referenced by mean(), setScales(), and updateGP().