# gpytorch.models¶

## Models for Exact GP Inference¶

### ExactGP¶

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.

Note

If targets is a batch (e.g. b x m), then the GP returned from this method will be a batch mode GP.

Args:
• inputs (Tensor m x d or b x m x d): Locations of fantasy observations.
• targets (Tensor m or b x m): Labels of fantasy observations.
Returns:
• 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).

Args:
• 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¶

### AbstractVariationalGP¶

class gpytorch.models.AbstractVariationalGP(variational_strategy)[source]
forward(x)[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.