API Reference#

Model#

This reference provides detailed documentation for all modules, classes, and methods in the current release of PyMC experimental.

as_model(*model_args, **model_kwargs)

Decorator to provide context to PyMC models declared in a function.

marginalize(model, rvs_to_marginalize)

Marginalize a subset of variables in a PyMC model.

recover_marginals(idata, *[, model, ...])

Computes posterior log-probabilities and samples of marginalized variables conditioned on parameters of the model given DataTree with posterior group

model_builder.ModelBuilder([model_config, ...])

ModelBuilder can be used to provide an easy-to-use API (similar to scikit-learn) for models and help with deployment.

Inference#

find_MAP([method, model, use_grad, ...])

Fit a PyMC model via maximum a posteriori (MAP) estimation using JAX and scipy.optimize.

fit(method, **kwargs)

Fit a model with an inference algorithm.

fit_laplace([optimize_method, model, ...])

Create a Laplace (quadratic) approximation for a posterior distribution.

fit_pathfinder([model, num_paths, ...])

Fit Pathfinder variational inference (multi-path, PyMC/PyTensor backend).

Distributions#

Chi(name, nu, **kwargs)

\(\chi\) log-likelihood.

Maxwell(name, a, **kwargs)

The Maxwell-Boltzmann distribution

DiscreteMarkovChain(*args[, steps, n_lags])

A Discrete Markov Chain is a sequence of random variables

GeneralizedPoisson(name, *args, **kwargs)

Generalized Poisson.

BetaNegativeBinomial(name, alpha, beta, r, ...)

Beta Negative Binomial distribution.

GenExtreme(name, *args[, rng, dims, ...])

Univariate Generalized Extreme Value log-likelihood

R2D2M2CP(name, output_sigma, input_sigma, *, ...)

R2D2M2CP Prior.

Skellam(name, mu1, mu2, **kwargs)

Skellam distribution.

histogram_approximation(name, dist, *, ...)

Approximate a distribution with a histogram potential.

Prior#

create_dim_handler(desired_dims)

Wrap the handle_dims() function to always use the same desired_dims.

handle_dims(x, dims, desired_dims)

Take a tensor of dims dims and align it to desired_dims.

Prior(distribution, *[, dims, centered, ...])

A class to represent a prior distribution.

register_tensor_transform(name, transform)

Register a tensor transform function to be used in the Prior class.

VariableFactory(*args, **kwargs)

Protocol for something that works like a Prior class.

sample_prior(factory[, coords, name, wrap, ...])

Sample the prior for an arbitrary VariableFactory.

Censored(distribution[, lower, upper])

Create censored random variable.

Scaled(dist, factor)

Scaled distribution for numerical stability.

Deserialize#

deserialize(data)

Deserialize a dictionary into a Python object.

register_deserialization(is_type, deserialize)

Register an arbitrary deserialization.

Deserializer(is_type, deserialize)

Object to store information required for deserialization.

Transforms#

PartialOrder(adj_mat)

Create a PartialOrder transform

Utils#

spline.bspline_interpolation(x, *[, n, ...])

Interpolate sparse grid to dense grid using bsplines.

prior.prior_from_idata(idata[, name, var_names])

Create a prior from posterior using MvNormal approximation.

model_equivalence.equivalent_models(model1, ...)

Check whether two PyMC models are equivalent.

Statespace Models#

Model Transforms#

autoreparam.vip_reparametrize(model, var_names)

Repametrize Model using Variationally Informed Parametrization (VIP).

autoreparam.VIP(_logit_lambda)

Helper to reparemetrize VIP model.

Printing#

model_table(model, *[, split_groups, ...])

Create a rich table with a summary of the model's variables and their expressions.