bayeso.gp.gp¶
-
bayeso.gp.gp.
get_optimized_kernel
(X_train, Y_train, prior_mu, str_cov, str_framework='scipy', str_optimizer_method='Nelder-Mead', str_modelselection_method='ml', is_fixed_noise=True, debug=False)¶ This function computes the kernel matrix optimized by optimization method specified, its inverse matrix, and the optimized hyperparameters.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
- prior_mu (function or NoneType) – prior mean function or None.
- str_cov (str.) – the name of covariance function.
- str_framework (str.) – the name of framework for optimizing kernel hyperparameters.
- str_optimizer_method (str., optional) – the name of optimization method.
- str_modelselection_method (str., optional) – the name of model selection method.
- is_fixed_noise (bool., optional) – flag for fixing a noise.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of kernel matrix over X_train, kernel matrix inverse, and dictionary of hyperparameters.
Return type: tuple of (numpy.ndarray, numpy.ndarray, dict.)
Raises: AssertionError, ValueError
-
bayeso.gp.gp.
predict_optimized
(X_train, Y_train, X_test, str_cov='matern52', prior_mu=None, is_fixed_noise=True, debug=False)¶ This function returns posterior mean and posterior standard deviation functions over X_test, computed by the Gaussian process regression optimized with X_train and Y_train.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
- X_test (numpy.ndarray) – inputs. Shape: (l, d) or (l, m, d).
- str_cov (str., optional) – the name of covariance function.
- prior_mu (NoneType, or function, optional) – None, or prior mean function.
- is_fixed_noise (bool., optional) – flag for fixing a noise.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of posterior mean function over X_test, posterior standard deviation function over X_test, and posterior covariance matrix over X_test. Shape: ((l, 1), (l, 1), (l, l)).
Return type: tuple of (numpy.ndarray, numpy.ndarray, numpy.ndarray)
Raises: AssertionError
-
bayeso.gp.gp.
predict_test
(X_train, Y_train, X_test, hyps, str_cov='matern52', prior_mu=None, debug=False)¶ This function returns posterior mean and posterior standard deviation functions over X_test, computed by Gaussian process regression with X_train, Y_train, and hyps.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
- X_test (numpy.ndarray) – inputs. Shape: (l, d) or (l, m, d).
- hyps (dict.) – dictionary of hyperparameters for Gaussian process.
- str_cov (str., optional) – the name of covariance function.
- prior_mu (NoneType, or function, optional) – None, or prior mean function.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of posterior mean function over X_test, posterior standard deviation function over X_test, and posterior covariance matrix over X_test. Shape: ((l, 1), (l, 1), (l, l)).
Return type: tuple of (numpy.ndarray, numpy.ndarray, numpy.ndarray)
Raises: AssertionError
-
bayeso.gp.gp.
predict_test_
(X_train, Y_train, X_test, cov_X_X, inv_cov_X_X, hyps, str_cov='matern52', prior_mu=None, debug=False)¶ This function returns posterior mean and posterior standard deviation functions over X_test, computed by Gaussian process regression with X_train, Y_train, cov_X_X, inv_cov_X_X, and hyps.
Parameters: - X_train (numpy.ndarray) – inputs. Shape: (n, d) or (n, m, d).
- Y_train (numpy.ndarray) – outputs. Shape: (n, 1).
- X_test (numpy.ndarray) – inputs. Shape: (l, d) or (l, m, d).
- cov_X_X (numpy.ndarray) – kernel matrix over X_train. Shape: (n, n).
- inv_cov_X_X (numpy.ndarray) – kernel matrix inverse over X_train. Shape: (n, n).
- hyps (dict.) – dictionary of hyperparameters for Gaussian process.
- str_cov (str., optional) – the name of covariance function.
- prior_mu (NoneType, or function, optional) – None, or prior mean function.
- debug (bool., optional) – flag for printing log messages.
Returns: a tuple of posterior mean function over X_test, posterior standard deviation function over X_test, and posterior covariance matrix over X_test. Shape: ((l, 1), (l, 1), (l, l)).
Return type: tuple of (numpy.ndarray, numpy.ndarray, numpy.ndarray)
Raises: AssertionError
-
bayeso.gp.gp.
sample_functions
(mu, Sigma, num_samples=1)¶ It samples num_samples functions from multivariate Gaussian distribution (mu, Sigma).
Parameters: - mu (numpy.ndarray) – mean vector. Shape: (n, ).
- Sigma (numpy.ndarray) – covariance matrix. Shape: (n, n).
- num_samples (int., optional) – the number of sampled functions
Returns: sampled functions. Shape: (num_samples, n).
Return type: numpy.ndarray
Raises: AssertionError