mxfusion.inference.forward_sampling

Members

class mxfusion.inference.forward_sampling.ForwardSamplingAlgorithm(num_samples, model, observed, target_variables=None)

Bases: mxfusion.inference.inference_alg.InferenceAlgorithm

The class of the forward sampling algorithm.

Parameters:
  • num_samples (int) – the number of samples used in estimating the variational lower bound
  • model_graph (Model) – the definition of the probabilistic model
  • target_variables ([UUID]) – (optional) the target variables to sample
  • observed ([Variable]) – A list of observed variables
compute(F, data, parameters, constants)

The method for the computation of the inference algorithm

Parameters:
  • F (Python module) – the execution context (mxnet.ndarray or mxnet.symbol)
  • data ({Variable: mxnet.ndarray.ndarray.NDArray or mxnet.symbol.symbol.Symbol}) – the data variables for inference
  • parameters ({Variable: mxnet.ndarray.ndarray.NDArray or mxnet.symbol.symbol.Symbol}) – the parameters for inference
  • constants – the constants for inference
Returns:

the outcome of the inference algorithm

Return type:

mxnet.ndarray.ndarray.NDArray or mxnet.symbol.symbol.Symbol

class mxfusion.inference.forward_sampling.ForwardSampling(num_samples, model, observed, var_tie, infr_params, target_variables=None, hybridize=False, constants=None, dtype=None, context=None)

Bases: mxfusion.inference.inference.TransferInference

Inference method of forward sampling.

Parameters:
  • num_samples (int) – the number of samples used in estimating the variational lower bound
  • model_graph (Model) – the definition of the probabilistic model
  • observed ([Variable]) – A list of observed variables
  • var_ties ({ UUID to tie from : UUID to tie to }) – A dictionary of variables that are tied together and use the MXNet Parameter of the dict value’s uuid.
  • infr_params (InferenceParameters or [InferenceParameters]) – list or single of InferenceParameters objects from previous Inference runs.
  • target_variables ([Variable]) – (optional) the target variables to sample
  • constants ({Variable: mxnet.ndarray}) – Specify a list of model variables as constants
  • hybridize (boolean) – Whether to hybridize the MXNet Gluon block of the inference method.
  • dtype ({numpy.float64, numpy.float32, 'float64', 'float32'}) – data type for internal numberical representation
  • context ({mxnet.cpu or mxnet.gpu}) – The MXNet context
mxfusion.inference.forward_sampling.merge_posterior_into_model(model, posterior, observed)
class mxfusion.inference.forward_sampling.VariationalPosteriorForwardSampling(num_samples, observed, inherited_inference, target_variables=None, hybridize=False, constants=None, dtype=None, context=None)

Bases: mxfusion.inference.forward_sampling.ForwardSampling

The forward sampling method for variational inference.

Parameters:
  • num_samples (int) – the number of samples used in estimating the variational lower bound
  • inherited_inference (SVIInference or SVIMiniBatchInference) – the inference method of which the model and inference results are taken
  • observed ([Variable]) – A list of observed variables
  • target_variables ([Variable]) – (optional) the target variables to sample
  • constants ({Variable: mxnet.ndarray}) – Specify a list of model variables as constants
  • hybridize (boolean) – Whether to hybridize the MXNet Gluon block of the inference method.
  • dtype ({numpy.float64, numpy.float32, 'float64', 'float32'}) – data type for internal numberical representation
  • context ({mxnet.cpu or mxnet.gpu}) – The MXNet context