gpp_python_model_selection

Contents:

gpp_python_model_selection.hpp

This file registers the translation layer for invoking functions in gpp_model_selection.hpp from Python.

The functions exported expect hyperparameters input like “pylist hyperparameters[2]:” This will be a python list such that: hyperparameters[0] = double precision number: \alpha (=\sigma_f^2, signal variance) hyperparameters[1] = pylist lengths[dim]: list of length scales for covariance (doubles) For example, if dim = 3, you might set in Python:

hyperparameters_for_C = [2.1, [1.2, 3.1, 0.4]]

for \alpha = 2.1, and for length scales 1.2, 3.1, 0.4

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

gpp_python_model_selection.cpp

This file has the logic to invoke C++ functions pertaining to model selection from Python. The data flow follows the basic 4 step from gpp_python_common.hpp.

Note: several internal functions of this source file are only called from Export*() functions, so their description, inputs, outputs, etc. comments have been moved. These comments exist in Export*() as Python docstrings, so we saw no need to repeat ourselves.

This file contains a wrapper that calls all C++ unit tests. The wrapper prints error messages indicating which test(s) failed.

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

Functions

void ExportModelSelectionFunctions()

Exports functions (with docstrings) for model selection:

  1. log likelihood (and its gradient) evaluation (useful for testing)
  2. multistart hyperparameter optimization (main entry-point)
  3. log likelihood evaluation at a list of hyperparameters (useful for testing, plotting)