class gpytorch.priors.Prior(batch_shape=torch.Size([]), event_shape=torch.Size([]), validate_args=None)[source]

Base class for Priors in GPyTorch. In GPyTorch, a parameter can be assigned a prior by passing it as the prior argument to register_parameter(). GPyTorch performs internal bookkeeping of priors, and for each parameter with a registered prior includes the log probability of the parameter under its respective prior in computing the Marginal Log-Likelihood.

Returns:log-probability of the parameter value under the prior
Return type:torch.Tensor

Standard Priors


class gpytorch.priors.GammaPrior(concentration, rate, validate_args=False, transform=None)[source]

Gamma Prior parameterized by concentration and rate

pdf(x) = beta^alpha / Gamma(alpha) * x^(alpha - 1) * exp(-beta * x)

were alpha > 0 and beta > 0 are the concentration and rate parameters, respectively.


class gpytorch.priors.LKJCovariancePrior(n, eta, sd_prior, validate_args=False)[source]

LKJCovariancePrior combines an LKJ prior over the correlation matrix and a user-specified prior over marginal standard deviations to return a prior over the full covariance matrix.

Usage: LKJCovariancePrior(n, eta, sd_prior), where
n is a positive integer, the size of the covariance matrix, eta is a positive shape parameter for the LKJPrior over correlations, and sd_prior is a scalar Prior over nonnegative numbers, which is used for each of the n marginal standard deviations on the covariance matrix.


class gpytorch.priors.MultivariateNormalPrior(loc, covariance_matrix=None, precision_matrix=None, scale_tril=None, validate_args=False, transform=None)[source]

Multivariate Normal prior

pdf(x) = det(2 * pi * Sigma)^-0.5 * exp(-0.5 * (x - mu)’ Sigma^-1 (x - mu))

where mu is the mean and Sigma > 0 is the covariance matrix.


Applies module-level cpu() call and resets all lazy properties


Applies module-level cuda() call and resets all lazy properties


class gpytorch.priors.NormalPrior(loc, scale, validate_args=False, transform=None)[source]

Normal (Gaussian) Prior

pdf(x) = (2 * pi * sigma^2)^-0.5 * exp(-(x - mu)^2 / (2 * sigma^2))

where mu is the mean and sigma^2 is the variance.


class gpytorch.priors.SmoothedBoxPrior(a, b, sigma=0.01, validate_args=False, transform=None)[source]

A smoothed approximation of a uniform prior.

Has full support on the reals and is differentiable everywhere.

\[\begin{equation*} B = {x: a_i <= x_i <= b_i} d(x, B) = min_{x' in B} |x - x'| pdf(x) ~ exp(- d(x, B)**2 / sqrt(2 * sigma^2)) \end{equation*}\]