mxfusion.components.distributions.gp.cond_gp

Members

class mxfusion.components.distributions.gp.cond_gp.ConditionalGaussianProcess(X, X_cond, Y_cond, kernel, mean=None, mean_cond=None, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.distribution.Distribution

The Conditional Gaussian process distribution.

A Gaussian process consists of a kernel function and a mean function (optional). A collection of GP random variables follows a multi-variate normal distribution, where the mean is computed from the mean function (zero, if not given) and the covariance matrix is computed from the kernel function, both of which are computed given a collection of inputs.

The conditional Gaussian process is a Gaussian process distribution which is conditioned over a pair of observation X_cond and Y_cond.

\[Y \sim \mathcal{N}(Y| K_{*c}K_{cc}^{-1}(Y_C - g(X_c)) + g(X), K_{**} - K_{*c}K_{cc}^{-1}K_{*c}^\top)\]

where \(g\) is the mean function, \(K_{**}\) is the covariance matrix over \(X\), \(K_{*c}\) is the cross covariance matrix between \(X\) and \(X_{c}\) and \(K_{cc}\) is the covariance matrix over \(X_{c}\).

Parameters:
  • X (Variable) – the input variables on which the random variables are conditioned.
  • X_cond (Variable) – the input variables on which the output variables Y_Cond are conditioned.
  • Y_cond (Variable) – the output variables on which the random variables are conditioned.
  • kernel (Kernel) – the kernel of Gaussian process.
  • mean (Variable) – the mean of Gaussian process.
  • mean_cond (Variable) – the mean of the conditional output variable under the same mean function.
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
has_mean
static define_variable(X, X_cond, Y_cond, kernel, shape=None, mean=None, mean_cond=None, rand_gen=None, minibatch_ratio=1.0, dtype=None, ctx=None)

Creates and returns a set of random variable drawn from a Gaussian process.

Parameters:
  • X (Variable) – the input variables on which the random variables are conditioned.
  • X_cond (Variable) – the input variables on which the output variables Y_Cond are conditioned.
  • Y_cond (Variable) – the output variables on which the random variables are conditioned.
  • kernel (Kernel) – the kernel of Gaussian process.
  • shape (tuple or [tuple]) – the shape of the random variable(s) (the default shape is the same shape as X but the last dimension is changed to one.)
  • mean (Variable) – the mean of Gaussian process.
  • mean_cond (Variable) – the mean of the conditional output variable under the same mean function.
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
log_pdf_impl(X, X_cond, Y_cond, random_variable, F=None, **kernel_params)

Computes the logarithm of the probability density function (PDF) of the conditional Gaussian process.

\[\log p(Y| X_c, Y_c, X) = \log \mathcal{N}(Y| K_{*c}K_{cc}^{-1}(Y_C - g(X_c)) + g(X), K_{**} - K_{*c}K_{cc}^{-1}K_{*c}^\top)\]

where \(g\) is the mean function, \(K_{**}\) is the covariance matrix over \(X\), \(K_{*c}\) is the cross covariance matrix between \(X\) and \(X_{c}\) and \(K_{cc}\) is the covariance matrix over \(X_{c}\).

Parameters:
  • X (MXNet NDArray or MXNet Symbol) – the input variables on which the random variables are conditioned.
  • X_cond (MXNet NDArray or MXNet Symbol) – the input variables on which the output variables Y_Cond are conditioned.
  • Y_cond (MXNet NDArray or MXNet Symbol) – the output variables on which the random variables are conditioned.
  • random_variable (MXNet NDArray or MXNet Symbol) – the random_variable of which log-PDF is computed.
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
  • **kernel_params

    the set of kernel parameters, provided as keyword arguments.

Returns:

log pdf of the distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

draw_samples_impl(X, X_cond, Y_cond, rv_shape, num_samples=1, F=None, **kernel_params)

Draw a number of samples from the conditional Gaussian process.

Parameters:
  • X (MXNet NDArray or MXNet Symbol) – the input variables on which the random variables are conditioned.
  • X_cond (MXNet NDArray or MXNet Symbol) – the input variables on which the output variables Y_Cond are conditioned.
  • Y_cond (MXNet NDArray or MXNet Symbol) – the output variables on which the random variables are conditioned.
  • rv_shape (tuple) – the shape of each sample.
  • num_samples (int) – the number of drawn samples (default: one).
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
  • **kernel_params

    the set of kernel parameters, provided as keyword arguments.

Returns:

a set samples of the distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

replicate_self(attribute_map=None)

The copy constructor for a conditional Gaussian process distribution.