sample_gp_function¶
-
safeopt.
sample_gp_function
(kernel, bounds, noise_var, num_samples, interpolation='kernel', mean_function=None)¶ Sample a function from a gp with corresponding kernel within its bounds.
Parameters: - kernel: instance of GPy.kern.*
- bounds: list of tuples
[(x1_min, x1_max), (x2_min, x2_max), …]
- noise_var: float
Variance of the observation noise of the GP function
- num_samples: int or list
If integer draws the corresponding number of samples in all dimensions and test all possible input combinations. If a list then the list entries correspond to the number of linearly spaced samples of the corresponding input
- interpolation: string
If ‘linear’ interpolate linearly between samples, if ‘kernel’ use the corresponding mean RKHS-function of the GP.
- mean_function: callable
Mean of the sample function
Returns: - function: object
function(x, noise=True) A function that takes as inputs new locations x to be evaluated and returns the corresponding noisy function values. If noise=False is set the true function values are returned (useful for plotting).