pymc.Empirical#

class pymc.Empirical(trace=None, size=None, **kwargs)[source]#

Single Group Full Rank Approximation

Builds Approximation instance from a given trace.

It has the same interface as variational approximation.

Methods

Empirical.__init__([trace, size])

Empirical.collect(item)

Empirical.evaluate_over_trace(node)

Allow to statically evaluate any symbolic expression over the trace.

Empirical.get_optimization_replacements(s, d)

Dev - optimizations for logP.

Empirical.make_size_and_deterministic_replacements(s, d)

Dev - create correct replacements for initial depending on sample size and deterministic flag.

Empirical.rslice(name)

Dev - vectorized sampling for named random variable without call to pytensor.scan.

Empirical.sample([draws, random_seed, ...])

Draw samples from variational posterior.

Empirical.sample_node(node[, size, ...])

Sample given node or nodes over shared posterior.

Empirical.set_size_and_deterministic(node, s, d)

Dev - after node is sampled via symbolic_sample_over_posterior() or symbolic_single_sample() new random generator can be allocated and applied to node.

Empirical.symbolic_sample_over_posterior(node)

Dev - perform sampling of node applying independent samples from posterior each time.

Empirical.symbolic_single_sample(node[, ...])

Dev - perform sampling of node applying single sample from posterior.

Empirical.to_flat_input(node[, ...])

Dev - replace vars with flattened view stored in self.inputs.

Attributes

all_histograms

any_histograms

datalogp

Dev - computes \(E_{q}(data term)\) from model via pytensor.scan that can be optimized later.

datalogp_norm

Dev - normalized \(E_{q}(data term)\).

ddim

has_logq

inputs

joint_histogram

logp

Dev - computes \(E_{q}(logP)\) from model via pytensor.scan that can be optimized later.

logp_norm

Dev - normalized \(E_{q}(logP)\).

logq

Dev - collects logQ for all groups.

logq_norm

Dev - collects logQ for all groups and normalizes it.

ndim

params

replacements

Dev - all replacements from groups to replace PyMC random variables with approximation.

sample_dict_fn

scale_cost_to_minibatch

Dev - Property to control scaling cost to minibatch.

single_symbolic_datalogp

Dev - for single MC sample estimate of \(E_{q}(data term)\) pytensor.scan is not needed and code can be optimized.

single_symbolic_logp

Dev - for single MC sample estimate of \(E_{q}(logP)\) pytensor.scan is not needed and code can be optimized.

single_symbolic_varlogp

Dev - for single MC sample estimate of \(E_{q}(prior term)\) pytensor.scan is not needed and code can be optimized.

sized_symbolic_datalogp

Dev - computes sampled data term from model via pytensor.scan.

sized_symbolic_logp

Dev - computes sampled logP from model via pytensor.scan.

sized_symbolic_varlogp

Dev - computes sampled prior term from model via pytensor.scan.

symbolic_logq

Dev - collects symbolic_logq for all groups.

symbolic_normalizing_constant

Dev - normalizing constant for self.logq, scales it to minibatch_size instead of total_size.

symbolic_random

symbolic_randoms

varlogp

Dev - computes \(E_{q}(prior term)\) from model via pytensor.scan that can be optimized later.

varlogp_norm

Dev - normalized \(E_{q}(prior term)\).