Attend the Women in ML Symposium on December 7 Register now

tfp.substrates.numpy.distributions.StudentTProcessRegressionModel

Stay organized with collections Save and categorize content based on your preferences.

StudentTProcessRegressionModel.

Inherits From: StudentTProcess, Distribution

This is an analogue of the GaussianProcessRegressionModel, except we use a Student-T process here (i.e. this represents the posterior predictive of a Student-T process, where we assume that the kernel hyperparameters and degrees of freedom are constants, and hence do optimizations in the constructor).

Specifically, we assume a Student-T Process prior, f ~ StP(df, m, k) along with a noise model whose mathematical implementation is similar to a Gaussian Process albeit whose interpretation is very different.

In particular, this noise model takes the following form:

  e ~ MVT(df + n, 0, 1 + v / df * (1 + f^T k(t, t)^-1 f^T))

which can be interpreted as Multivariate T noise whose covariance depends on the data fit term.

Using the conventions in the GaussianProcessRegressionModel class, we have the posterior predictive distribution as:

  (f(t) | t, x, f(x)) ~ MVT(df + n, loc, cov)

  where

  n is the number of observation points
  b = (y - loc)^T @ inv(k(x, x) + v * I) @ (y - loc)
  v = observation noise variance
  loc = k(t, x) @ inv(k(x, x) + v * I) @ (y - loc)
  cov = (df + b - 2) / (df + n - 2) * (
    k(t, t) - k(t, x) @ inv(k(x, x) + v * I) @ k(x, t))

Note that the posterior predictive mean is the same as a Gaussian Process, but the covariance is multiplied by a term that takes in to account observations.

This distribution does precomputaiton in the constructor by assuming observation_index_points, observations, kernel and observation_noise_variance are fixed, and that mean_fn is the zero function. We do these precomputations in a non-tape safe way.

References

[1]: Amar Shah, Andrew Gordon Wilson, Zoubin Ghahramani. Student-t Processes as Alternatives to Gaussian Processes https://arxiv.org/abs/1402.4306

[2]: Qingtao Tang, Yisen Wang, Shu-Tao Xia Student-T Process Regression with Dependent Student-t Noise https://www.ijcai.org/proceedings/2017/393

df Positive Floating-point Tensor representing the degrees of freedom. Must be greather than 2.
kernel PositiveSemidefiniteKernel-like instance representing the StP's covariance function.
index_points float Tensor representing finite collection, or batch of collections, of points in the index set over which the STP is defined. Shape has the form [b1, ..., bB, e, f1, ..., fF] where F is the number of feature dimensions and must equal kernel.feature_ndims and e is the number (size) of index points in each batch. Ultimately this distribution corresponds to an e-dimensional multivariate normal. The batch shape must be broadcastable with kernel.batch_shape.
observation_index_points float Tensor representing finite collection, or batch of collections, of points in the index set for which some data has been observed. Shape has the form [b1, ..., bB, e, f1, ..., fF] where F is the number of feature dimensions and must equal kernel.feature_ndims, and e is the number (size) of index points in each batch. [b1, ..., bB, e] must be broadcastable with the shape of observations, and [b1, ..., bB] must be broadcastable with the shapes of all other batched parameters (kernel.batch_shape, index_points, etc).
observations float Tensor representing collection, or batch of collections, of observations corresponding to observation_index_points. Shape has the form [b1, ..., bB, e], which must be brodcastable with the batch and example shapes of observation_index_points. The batch shape [b1, ..., bB] must be broadcastable with the shapes of all other batched parameters (kernel.batch_shape, index_points, etc.).
observation_noise_variance float Tensor representing the variance of the noise in the Normal likelihood distribution of the model. May be batched, in which case the batch shape must be broadcastable with the shapes of all other batched parameters (kernel.batch_shape, index_points, etc.). Default value: 0.
predictive_noise_variance float Tensor representing the variance in the posterior predictive model. If None, we simply re-use observation_noise_variance for the posterior predictive noise. If set explicitly, however, we use this value. This allows us, for example, to omit predictive noise variance (by setting this to zero) to obtain noiseless posterior predictions of function values, conditioned on noisy observations.
mean_fn Python callable that acts on index_points to produce a collection, or batch of collections, of mean values at index_points. Takes a Tensor of shape [b1, ..., bB, f1, ..., fF] and returns a Tensor whose shape is broadcastable with [b1, ..., bB]. Default value: None implies the constant zero function.
cholesky_fn Callable which takes a single (batch) matrix argument and returns a Cholesky-like lower triangular factor. Default value: None, in which case make_cholesky_with_jitter_fn.
marginal_fn A Python callable that takes a location, covariance matrix, optional validate_args, allow_nan_stats and name arguments, and returns a multivariate Student-T subclass of tfd.Distribution. Default value: None, in which case a Cholesky-factorizing function is created using make_cholesky_with_jitter_fn.
validate_args Python bool, default False. When True distribution parameters are checked for validity despite possibly degrading runtime performance. When False invalid inputs may silently render incorrect outputs. Default value: False.
allow_nan_stats Python bool, default True. When True, statistics (e.g., mean, mode, variance) use the value NaN to indicate the result is undefined. When False, an exception is raised if one or more of the statistic's batch members are undefined. Default value: False.
name Python str name prefixed to Ops created by this class. Default value: 'StudentTProcessRegressionModel'.
_conditional_kernel Internal parameter -- do not use.
_conditional_mean_fn Internal parameter -- do not use.

allow_nan_stats Python bool describing behavior when a stat is undefined.

Stats return +/- infinity when it makes sense. E.g., the variance of a Cauchy distribution is infinity. However, sometimes the statistic is undefined, e.g., if a distribution's pdf does not achieve a maximum within the support of the distribution, the mode is undefined. If the mean is undefined, then by definition the variance is undefined. E.g. the mean for Student's T for df = 1 is undefined (no clear way to say it is either + or - infinity), so the variance = E[(X - mean)**2] is also undefined.

batch_shape Shape of a single sample from a single event index as a TensorShape.

May be partially defined or unknown.

The batch dimensions are indexes into independent, non-identical parameterizations of this distribution.

cholesky_fn

df

dtype The DType of Tensors handled by this Distribution.
event_shape Shape of a single sample from a single batch as a TensorShape.

May be partially defined or unknown.

experimental_shard_axis_names The list or structure of lists of active shard axis names.
index_points

jitter

kernel

marginal_fn

mean_fn

name Name prepended to all ops created by this Distribution.
observation_cholesky

observation_index_points

observation_noise_variance

observations

parameters Dictionary of parameters used to instantiate this Distribution.
predictive_noise_variance

reparameterization_type Describes how samples from the distribution are reparameterized.

Currently this is one of the static instances tfd.FULLY_REPARAMETERIZED or tfd.NOT_REPARAMETERIZED.

trainable_variables

validate_args Python bool indicating possibly expensive checks are enabled.
variables

Methods

batch_shape_tensor

View source

Shape of a single sample from a single event index as a 1-D Tensor.

The batch dimensions are indexes into independent, non-identical parameterizations of this distribution.

Args
name name to give to the op

Returns
batch_shape Tensor.

cdf

View source

Cumulative distribution function.

Given random variable X, the cumulative distribution function cdf is:

cdf(x) := P[X <= x]

Args
value float or double Tensor.
name Python str prepended to names of ops created by this function.
**kwargs Named arguments forwarded to subclass implementation.

Returns
cdf a Tensor of shape sample_shape(x) + self.batch_shape with values of type self.dtype.

copy

View source