PyMC Extras

0.10.0 · active · verified Thu Apr 16

PyMC-Extras (version 0.10.0) serves as an experimental extension library for PyMC, providing a sandbox for new probability distributions, advanced model fitting algorithms, and other specialized code not yet integrated into the main PyMC repository. It aims to offer bleeding-edge features to users, with a flexible release cadence tied to the development cycle of its experimental components.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates defining a PyMC model using a specialized distribution, `LogitNormal`, from `pymc-extras`. This illustrates how to seamlessly integrate `pymc-extras` components into a standard PyMC workflow, typically followed by sampling if observed data is provided.

import pymc as pm
from pymc_extras import distributions as pmx_dist
import numpy as np

# Define a custom distribution from pymc-extras, e.g., the LogitNormal
with pm.Model() as model:
    # Example using LogitNormal, suitable for modeling proportions
    proportion_latent = pm.Normal("proportion_latent", mu=0, sigma=1)
    proportion = pmx_dist.LogitNormal("proportion", mu=proportion_latent, sigma=1)

    # In a real scenario, you would typically add observed data for inference.
    # Example: obs = pm.Binomial("obs", n=10, p=proportion, observed=np.array([5, 6, 7]))

    # For this quickstart, we just demonstrate model definition.
    # trace = pm.sample(draws=1000, tune=1000, chains=2)
    print(f"Model created with LogitNormal distribution: {model.named_vars['proportion']}")

view raw JSON →