mxfusion.components.distributions.gp.cond_gp

Members

class mxfusion.components.distributions.gp.cond_gp.ConditionalGaussianProcessLogPDFDecorator

Bases: mxfusion.components.distributions.distribution.LogPDFDecorator

class mxfusion.components.distributions.gp.cond_gp.ConditionalGaussianProcessDrawSamplesDecorator

Bases: mxfusion.components.distributions.distribution.DrawSamplesDecorator

class mxfusion.components.distributions.gp.cond_gp.ConditionalGaussianProcess(X, X_cond, Y_cond, kernel, mean_func=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_func (N/A) – the mean function of Gaussian process.
  • 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).
static define_variable(X, X_cond, Y_cond, kernel, shape=None, mean_func=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_func (N/A) – the mean function of Gaussian process.
  • 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(F, variables)

Computes the logrithm of the probability density/mass function (PDF/PMF) of the distribution. The inputs and outputs variables are fetched from the variables argument according to their UUIDs.

Parameters:
  • F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
  • variables – the set of MXNet arrays that holds the values of

variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :returns: log pdf of the distribution :rtypes: MXNet NDArray or MXNet Symbol

draw_samples(F, variables, num_samples=1, always_return_tuple=False)

Draw a set of samples from the distribution. The inputs variables are fetched from the variables argument according to their UUIDs.

Parameters:
  • F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
  • variables – the set of MXNet arrays that holds the values of

variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :param num_samples: the number of drawn samples (default: one) :int num_samples: int :param always_return_tuple: Whether return a tuple even if there is only one variables in outputs. :type always_return_tuple: boolean :returns: a set samples of the distribution :rtypes: MXNet NDArray or MXNet Symbol or [MXNet NDArray or MXNet Symbol]