Base GP models¶
Vanguard implements a small number of base models which are built on by various decorators.
They are syntactically similar to the standard model classes used in GPyTorch.
Models for exact GP inference¶
- class vanguard.models.ExactGPModel(train_x, train_y, likelihood, mean_module, covar_module, **kwargs)[source]¶
Standard GPyTorch exact GP model subclassing
gpytorch.models.ExactGPwith flexible prior kernel, mean.- Parameters:
- __init__(train_x, train_y, likelihood, mean_module, covar_module, **kwargs)[source]¶
Initialise self.
- Parameters:
train_x (
Optional[Tensor]) – (n_samples, n_features) The training inputs (features).train_y (
Optional[Tensor]) – (n_samples,) The training targets (response).likelihood (
_GaussianLikelihoodBase) – Likelihood to use with model. Since we’re using exact inference, the likelihood must be Gaussian.mean_module (
Mean) – The prior mean function to use.covar_module (
Kernel) – The prior kernel function to use.kwargs (
Any)
Models for approximate GPs and approximate inference¶
- class vanguard.models.InducingPointKernelGPModel(train_x, train_y, likelihood, mean_module, covar_module, n_inducing_points, rng=None)[source]¶
A model with inducing point sparse approximation to the kernel.
GPyTorch exact GP model subclassing
gpytorch.models.ExactGPwith flexible prior kernel, mean and an inducing point sparse approximation to the kernel a la [Titsias09].- Parameters:
- __init__(train_x, train_y, likelihood, mean_module, covar_module, n_inducing_points, rng=None)[source]¶
Initialise self.
- Parameters:
train_x (
Tensor) – (n_samples, n_features) The training inputs (features).train_y (
Tensor) – (n_samples,) The training targets (response).likelihood (
GaussianLikelihood) – Likelihood to use with model. Since we’re using exact inference, the likelihood must be Gaussian.mean_module (
Mean) – The prior mean function to use.covar_module (
Kernel) – The prior kernel function to use.n_inducing_points (
int) – The number of inducing points in the sparse kernel approximation.rng (
Optional[Generator]) – Generator instance used to generate random numbers.
Contains base models for approximate inference.
- class vanguard.variational.models.SVGPModel(train_x, train_y, likelihood, mean_module, covar_module, n_inducing_points, rng=None, **_)[source]¶
A standard model for approximate inference.
GPyTorch approximate GP model subclassing
gpytorch.models.ApproximateGPwith flexible prior kernel, mean and an inducing point variational approximation to the posterior al la [Hensman15].- Parameters:
- __init__(train_x, train_y, likelihood, mean_module, covar_module, n_inducing_points, rng=None, **_)[source]¶
Initialise self.
Note that while arbitrary keyword arguments are accepted, they are not inspected or used. This is to allow passing keyword parameters that are required by other GP models (e.g. rng) without raising a TypeError, which allows more generic code.
- Parameters:
train_x (
Union[Tensor,ndarray[tuple[Any,...],dtype[floating]]]) – (n_samples, n_features) The training inputs (features).train_y (
Union[Tensor,ndarray[tuple[Any,...],dtype[floating]]]) – (n_samples,) The training targets (response). Note that these are not used for this method! They are only passed here to match the __init__() signature of the other Vanguard GP models.likelihood (
Likelihood) – Likelihood to use with model. Included only for signature consistency.mean_module (
Mean) – The prior mean function to use.covar_module (
Kernel) – The prior kernel function to use.n_inducing_points (
int) – The number of inducing points in the variational sparse kernel approximation.rng (
Optional[Generator]) – Generator instance used to generate random numbers._ (
Any)