pymc.model.core.FrozenModel#

class pymc.model.core.FrozenModel(*args, **kwargs)[source]#

A model whose graph is immutable and whose compiled functions are cached.

Create one with pymc.model.transform.optimization.freeze_model(); this class cannot be instantiated directly. Graph-mutating methods do not exist on it, which is what makes caching safe without any invalidation. set_data remains available for data that no free variable depends on — values and shapes are runtime inputs of the cached functions.

Methods

FrozenModel.__init__(*args, **kwargs)

FrozenModel.check_start_vals(start, **kwargs)

Check that the logp is defined and finite at the starting point.

FrozenModel.compile_d2logp([vars, jacobian, ...])

Compiled log probability density hessian function.

FrozenModel.compile_dlogp([vars, jacobian])

Compiled log probability density gradient function.

FrozenModel.compile_fn(outs, *[, inputs, ...])

Compiles a PyTensor function.

FrozenModel.compile_logp([vars, jacobian, sum])

Compiled log probability density function.

FrozenModel.copy()

Clone the model.

FrozenModel.d2logp([vars, jacobian, ...])

Hessian of the models log-probability w.r.t.

FrozenModel.debug([point, fn, verbose])

Debug model function at point.

FrozenModel.dlogp([vars, jacobian])

Gradient of the models log-probability w.r.t.

FrozenModel.eval_rv_shapes()

Evaluate shapes of untransformed AND transformed free variables.

FrozenModel.get_context([error_if_none, ...])

FrozenModel.initial_point([random_seed])

Compute the initial point of the model.

FrozenModel.logp([vars, jacobian, sum])

Elemwise log-probability of the model.

FrozenModel.logp_dlogp_function([grad_vars, ...])

Compile a PyTensor function that computes logp and gradient.

FrozenModel.name_for(name)

Check if name has prefix and adds if needed.

FrozenModel.name_of(name)

Check if name has prefix and deletes if needed.

FrozenModel.point_logps([point, round_vals])

Compute the log probability of point for all random variables in the model.

FrozenModel.profile(outs, *[, n, point, ...])

Compile and profile a PyTensor function which returns outs and takes values of model vars as a dict as an argument.

FrozenModel.replace_rvs_by_values(graphs, ...)

Clone and replace random variables in graphs with their value variables.

FrozenModel.set_data(name, values[, coords])

Change the values of a data variable in the model.

FrozenModel.set_dim(name, new_length[, ...])

Update a mutable dimension.

FrozenModel.shape_from_dims(dims)

FrozenModel.table(*[, split_groups, ...])

Create a rich table summarizing the model's variables and their expressions.

FrozenModel.to_graphviz(*[, var_names, ...])

Produce a graphviz Digraph from a PyMC model.

Attributes

basic_RVs

List of random variables the model is defined in terms of.

continuous_value_vars

All the continuous value variables in the model.

coords

Coordinate values for model dimensions.

datalogp

PyTensor scalar of log-probability of the observed variables and potential terms.

dim_lengths

The symbolic lengths of dimensions in the model.

discrete_value_vars

All the discrete value variables in the model.

isroot

observedlogp

PyTensor scalar of log-probability of the observed variables.

parent

potentiallogp

PyTensor scalar of log-probability of the Potential terms.

prefix

root

unobserved_RVs

List of all random variables, including deterministic ones.

unobserved_value_vars

List of all random variables (including untransformed projections), as well as deterministics used as inputs and outputs of the model's log-likelihood graph.

value_vars

List of unobserved random variables used as inputs to the model's log-likelihood (which excludes deterministics).

varlogp

PyTensor scalar of log-probability of the unobserved random variables (excluding deterministic).

varlogp_nojac

PyTensor scalar of log-probability of the unobserved random variables (excluding deterministic) without jacobian term.