Models for Exact GP Inference


class gpytorch.models.ExactGP(train_inputs, train_targets, likelihood)[source]
get_fantasy_model(inputs, targets, **kwargs)[source]

Returns a new GP model that incorporates the specified inputs and targets as new training data.

Using this method is more efficient than updating with set_train_data when the number of inputs is relatively small, because any computed test-time caches will be updated in linear time rather than computed from scratch.


If targets is a batch (e.g. b x m), then the GP returned from this method will be a batch mode GP. If inputs is of the same (or lesser) dimension as targets, then it is assumed that the fantasy points are the same for each target batch.

  • inputs (Tensor b1 x … x bk x m x d or f x b1 x … x bk x m x d): Locations of fantasy
  • targets (Tensor b1 x … x bk x m or f x b1 x … x bk x m): Labels of fantasy observations.
  • ExactGP
    An ExactGP model with n + m training examples, where the m fantasy examples have been added and all test-time caches have been updated.
set_train_data(inputs=None, targets=None, strict=True)[source]

Set training data (does not re-fit model hyper-parameters).

  • inputs the new training inputs
  • targets the new training targets
  • strict
    if True, the new inputs and targets must have the same shape, dtype, and device as the current inputs and targets. Otherwise, any shape/dtype/device are allowed.

Models for Variational GP Inference


class gpytorch.models.AbstractVariationalGP(variational_strategy)[source]

As in the exact GP setting, the user-defined forward method should return the GP prior mean and covariance evaluated at input locations x.