#import necessary modules, set up the plotting import numpy as np %matplotlib inline %config InlineBackend.figure_format = 'svg' import matplotlib;matplotlib.rcParams['figure.figsize'] = (8,6) from matplotlib import pyplot as plt import GPy
The GPy model class has a set of features which are designed to make it simple to explore the parameter space of the model. By default, the scipy optimisers are used to fit GPy models (via model.optimize()), for which we provide mechanisms for ‘free’ optimisation: GPy can ensure that naturally positive parameters (such as variances) remain positive. But these mechanisms are much more powerful than simple reparameterisation, as we shall see.
Along this tutorial we’ll use a sparse GP regression model as example. This example can be in GPy.examples.regression. All of the examples included in GPy return an instance of a model class, and therefore they can be called in the following way:
m = GPy.examples.regression.sparse_GP_regression_1D(plot=False, optimize=False)
To see the current state of the model parameters, and the model’s (marginal) likelihood just print the model
The first thing displayed on the screen is the log-likelihood value of the model with its current parameters. Below the log-likelihood, a table with all the model’s parameters is shown. For each parameter, the table contains the name of the parameter, the current value, and in case there are defined: constraints, ties and prior distrbutions associated.
Model: sparse gp
Number of Parameters: 8
Number of Optimization Parameters: 8
|inducing inputs||(5, 1)|
In this case the kernel parameters (
bf.lengthscale) as well as the likelihood noise parameter (
Gaussian_noise.variance), are constrained to be positive, while the inducing inputs have no constraints associated. Also there are no ties or prior defined.
You can also print all subparts of the model, by printing the subcomponents individually; this will print the details of this particular parameter handle:
When you want to get a closer look into multivalue parameters, print them directly: