![]() |
MeLOn
|
This class represents a Gaussian process, to be used in the MAiNGO solver. More...
#include <gp.h>
Public Member Functions | |
GaussianProcess () | |
Default Constructor. | |
GaussianProcess (std::string modelName) | |
Constructor. | |
GaussianProcess (std::string modelPath, std::string modelName) | |
Constructor. | |
GaussianProcess (std::shared_ptr< const GPData > modelData) | |
Constructor. | |
T | calculate_prediction_reduced_space (std::vector< T > input) const |
Calculates the prediction of the Gaussian process at a given point in reduced space mode (only network inputs are given) | |
T | calculate_variance_reduced_space (std::vector< T > input) const |
Calculates the variance of the Gaussian process at a given point in reduced space mode (only network inputs are given) | |
T | calculate_prediction_full_space (std::vector< T > input, std::vector< T > internalVariables, std::vector< T > &constraints) const |
Calculates the prediction of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned) | |
T | calculate_variance_full_space (std::vector< T > input, std::vector< T > internalVariables, std::vector< T > &constraints) const |
Calculates the variance of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned) | |
std::pair< T, T > | calculate_prediction_and_variance_full_space (std::vector< T > input, std::vector< T > internalVariables, std::vector< T > &constraints) const |
Calculates the prediction and the variance of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned) | |
int | get_input_dimension () const |
Get the dimesnion of the input. | |
int | get_number_of_training_data_points () const |
Get the number of training data points. | |
double | get_minimum_of_training_data_outputs () const |
Get the minimum value of the training data outputs. | |
double | get_maximum_of_training_data_outputs () const |
Get the maximum value of the training data outputs. | |
unsigned int | get_number_of_full_space_variables_prediction () const |
Get the number of internal variables used in the calculation of the prediction. | |
void | get_full_space_variables_prediction (unsigned int &variableNumber, std::vector< std::string > &variableNames, std::vector< std::pair< double, double > > &variableBounds) const |
Get the properties of internal variables used in the calculation of the prediction. | |
unsigned int | get_number_of_full_space_variables_variance () const |
Get the number of internal variables used in the calculation of the variance. | |
void | get_full_space_variables_variance (unsigned int &variableNumber, std::vector< std::string > &variableNames, std::vector< std::pair< double, double > > &variableBounds) const |
Get the properties of internal variables used in the calculation of the variance. | |
unsigned int | get_number_of_full_space_variables_prediction_and_variance () const |
Get the number of internal variables used in the calculation of prediction and variance. | |
void | get_full_space_variables_prediction_and_variance (unsigned int &variableNumber, std::vector< std::string > &variableNames, std::vector< std::pair< double, double > > &variableBounds) const |
Get the properties of internal variables used in the calculation of prediction and variance. | |
std::vector< double > | get_observations () const |
Get the observations based on which the Gaussian process was trained and is evaluated. | |
std::vector< double > | get_normalized_observations () const |
Returns the the normalized values of the observations based on which the Gaussian process was trained and is evaluated. | |
const GPData & | data () const |
Getter for member variable _data. | |
const kernel::StationaryKernel< double, T > & | kernel () const |
Getter for member variable _kernel. | |
const Scaler< T > & | inputScaler () const |
Getter for member variable _inputScaler. | |
const Scaler< T > & | predictionScaler () const |
Getter for member variable _predictionScaler. | |
const Scaler< T > & | parameterScaler () const |
Getter for member variable _parameterScaler. | |
![]() | |
virtual | ~MelonModel ()=default |
Default destructor. | |
void | load_model (std::string modelName, MODEL_FILE_TYPE fileType) |
Loads new model from file. | |
void | load_model (std::string modelPath, std::string modelName, MODEL_FILE_TYPE fileType) |
Loads new model from file. | |
void | load_model (std::shared_ptr< const ModelData > modelData) |
Loads new model from file. | |
Private Member Functions | |
void | _set_data_object (std::shared_ptr< const ModelData > modelData) override |
Sets data object containing model parameters. | |
void | _set_kernel (std::shared_ptr< const GPData > data) |
Function for setting the kernel of the Gaussian process. | |
template<typename RandomAccessIterator > | |
std::vector< T > | _calculate_covariance_vector (std::vector< T > input, RandomAccessIterator &internalVariables, const bool fullSpace, std::vector< T > &constraints) const |
Calculates the covariance vector of the Gaussian process for a given point. | |
template<typename RandomAccessIterator > | |
T | _calculate_prediction (std::vector< T > covarianceVector, RandomAccessIterator &internalVariables, const bool fullSpace, std::vector< T > &constraints) const |
Calculates the prediction of the Gaussian process for a given point. | |
template<typename RandomAccessIterator > | |
T | _calculate_variance (std::vector< T > covarianceVector, RandomAccessIterator &internalVariables, const bool fullSpace, std::vector< T > &constraints) const |
Calculates the variance of the Gaussian process for a given point. | |
Private Attributes | |
std::shared_ptr< const GPData > | _data |
std::unique_ptr< kernel::StationaryKernel< double, T > > | _kernel |
std::unique_ptr< Scaler< T > > | _inputScaler |
std::unique_ptr< Scaler< T > > | _predictionScaler |
std::unique_ptr< Scaler< double > > | _parameterScaler |
Additional Inherited Members | |
![]() | |
MelonModel (std::shared_ptr< ModelParserFactory > parserFactory) | |
Constructor. | |
template<typename RandomAccessIterator > | |
void | _set_constraints (std::vector< T > &constraints, std::vector< T > &constraintEvaluation, RandomAccessIterator &constraintValue) const |
Sets constraints required for fullspace opimization. | |
template<typename RandomAccessIterator > | |
void | _set_constraints (std::vector< T > &constraints, T &constraintEvaluation, RandomAccessIterator &constraintValue) const |
Sets constraints required for fullspace opimization. | |
![]() | |
bool | _modelLoaded { false } |
std::shared_ptr< ModelParserFactory > | _parserFactory |
This class represents a Gaussian process, to be used in the MAiNGO solver.
This class is used to enable the solution of optimization problems in MAiNGO containing Gaussian processes. The trained GPs can be loaded from json files created in matlab.
|
inline |
Default Constructor.
|
inline |
Constructor.
[in] | modelName | is the name of the Gaussian process |
|
inline |
Constructor.
[in] | modelPath | is the path to the directory in which the Gaussian process file is located |
[in] | modelName | is the name of the Gaussian process |
|
inline |
Constructor.
[in] | modelData | is a GPData object containing the data which defines the Gaussian process |
|
private |
Calculates the covariance vector of the Gaussian process for a given point.
[in] | input | is a vector containing input point for which the covariance vector is calculated |
[in] | internalVariables | is a iterator pointing to the beginning of the internal variables used in calculation of the covariance vector |
[in] | fullSpace | indicates wether the Gaussian process should be evaluated in fullspace mode (all internal variables are pre-set and given in variables and a vector of constraints is returned) |
[out] | constraints | is a vector of constraints which are the difference of the given (in the vector variables) and calulated internal Gaussian process variables. |
|
private |
Calculates the prediction of the Gaussian process for a given point.
[in] | covarianceVector | is a vector based on which the prediction is calculated |
[in] | internalVariables | is a iterator pointing to the beginning of the internal variables used in calculation of the prediction |
[in] | fullSpace | indicates wether the Gaussian process should be evaluated in fullspace mode (all internal variables are pre-set and given in variables and a vector of constraints is returned) |
[out] | constraints | is a vector of constraints which are the difference of the given (in the vector variables) and calulated internal Gaussian process variables. |
|
private |
Calculates the variance of the Gaussian process for a given point.
[in] | covarianceVector | is a vector based on which the variance is calculated |
[in] | internalVariables | is a iterator pointing to the beginning of the internal variables used in calculation of the variance |
[in] | fullSpace | indicates wether the Gaussian process should be evaluated in fullspace mode (all internal variables are pre-set and given in variables and a vector of constraints is returned) |
[out] | constraints | is a vector of constraints which are the difference of the given (in the vector variables) and calulated internal Gaussian process variables. |
|
overrideprivatevirtual |
Sets data object containing model parameters.
[in] | modelData | is a ModelData object containing the data which defines the model |
Implements melon::MelonModel< T >.
|
private |
Function for setting the kernel of the Gaussian process.
[in] | data | is a pointer to a GPData object containing information about the kernel that should be set |
std::pair< T, T > melon::GaussianProcess< T >::calculate_prediction_and_variance_full_space | ( | std::vector< T > | input, |
std::vector< T > | internalVariables, | ||
std::vector< T > & | constraints ) const |
Calculates the prediction and the variance of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned)
[in] | input | is a vector containing input point for which prediction and variance of the Gaussian process are calculated |
[in] | internalVariables | is a vector containing values for the internal variables of the Gaussian process predcition and variance calculation |
[out] | constraints | is vector containing the evaluation of the fullspace constraints regarding the internal variables |
T melon::GaussianProcess< T >::calculate_prediction_full_space | ( | std::vector< T > | input, |
std::vector< T > | internalVariables, | ||
std::vector< T > & | constraints ) const |
Calculates the prediction of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned)
[in] | input | is a vector containing input point for which the prediction of the Gaussian process is calculated |
[in] | internalVariables | is a vector containing values for the internal variables of the Gaussian process prediction calculation |
[out] | constraints | is vector containing the evaluation of the fullspace constraints regarding the internal variables |
T melon::GaussianProcess< T >::calculate_prediction_reduced_space | ( | std::vector< T > | input | ) | const |
Calculates the prediction of the Gaussian process at a given point in reduced space mode (only network inputs are given)
[in] | input | is a vector containing input point for which the prediction of the Gaussian process is calculated |
T melon::GaussianProcess< T >::calculate_variance_full_space | ( | std::vector< T > | input, |
std::vector< T > | internalVariables, | ||
std::vector< T > & | constraints ) const |
Calculates the variance of the Gaussian process at a given point in full space mode (values for all internal variables are given and a set of constraints is returned)
[in] | input | is a vector containing input point for which the variance of the Gaussian process is calculated |
[in] | internalVariables | is a vector containing values for the internal variables of the Gaussian process variance calculation |
[out] | constraints | is vector containing the evaluation of the fullspace constraints regarding the internal variables |
T melon::GaussianProcess< T >::calculate_variance_reduced_space | ( | std::vector< T > | input | ) | const |
Calculates the variance of the Gaussian process at a given point in reduced space mode (only network inputs are given)
[in] | input | is a vector containing input point for which the variance of the Gaussian process is calculated |
|
inline |
Getter for member variable _data.
void melon::GaussianProcess< T >::get_full_space_variables_prediction | ( | unsigned int & | variableNumber, |
std::vector< std::string > & | variableNames, | ||
std::vector< std::pair< double, double > > & | variableBounds ) const |
Get the properties of internal variables used in the calculation of the prediction.
[out] | variableNumber | is the number of internal variables |
[out] | variableNames | is a vector containing the names of the internal variables |
[out] | variableBounds | is a vector of pairs containing the bounds of the internal variables |
void melon::GaussianProcess< T >::get_full_space_variables_prediction_and_variance | ( | unsigned int & | variableNumber, |
std::vector< std::string > & | variableNames, | ||
std::vector< std::pair< double, double > > & | variableBounds ) const |
Get the properties of internal variables used in the calculation of prediction and variance.
[out] | variableNumber | is the number of internal variables |
[out] | variableNames | is a vector containing the names of the internal variables |
[out] | variableBounds | is a vector of pairs containing the bounds of the internal variables |
void melon::GaussianProcess< T >::get_full_space_variables_variance | ( | unsigned int & | variableNumber, |
std::vector< std::string > & | variableNames, | ||
std::vector< std::pair< double, double > > & | variableBounds ) const |
Get the properties of internal variables used in the calculation of the variance.
[out] | variableNumber | is the number of internal variables |
[out] | variableNames | is a vector containing the names of the internal variables |
[out] | variableBounds | is a vector of pairs containing the bounds of the internal variables |
int melon::GaussianProcess< T >::get_input_dimension | ( | ) | const |
Get the dimesnion of the input.
double melon::GaussianProcess< T >::get_maximum_of_training_data_outputs | ( | ) | const |
Get the maximum value of the training data outputs.
double melon::GaussianProcess< T >::get_minimum_of_training_data_outputs | ( | ) | const |
Get the minimum value of the training data outputs.
|
inline |
Returns the the normalized values of the observations based on which the Gaussian process was trained and is evaluated.
unsigned int melon::GaussianProcess< T >::get_number_of_full_space_variables_prediction | ( | ) | const |
Get the number of internal variables used in the calculation of the prediction.
unsigned int melon::GaussianProcess< T >::get_number_of_full_space_variables_prediction_and_variance | ( | ) | const |
Get the number of internal variables used in the calculation of prediction and variance.
unsigned int melon::GaussianProcess< T >::get_number_of_full_space_variables_variance | ( | ) | const |
Get the number of internal variables used in the calculation of the variance.
int melon::GaussianProcess< T >::get_number_of_training_data_points | ( | ) | const |
Get the number of training data points.
std::vector< double > melon::GaussianProcess< T >::get_observations | ( | ) | const |
Get the observations based on which the Gaussian process was trained and is evaluated.
|
inline |
Getter for member variable _inputScaler.
|
inline |
Getter for member variable _kernel.
|
inline |
Getter for member variable _parameterScaler.
|
inline |
Getter for member variable _predictionScaler.
|
private |
object containing the data and parameters of the Gaussian process
|
private |
Object for scaling input data
|
private |
kernel object
|
private |
Object for scaling double parameters
|
private |
Object for scaling output data