Registry / ai-ml / nutpie

nutpie

JSON →
library0.16.8pypypi✓ verified 30d ago

Nutpie is a Python library designed to sample Stan or PyMC models efficiently, leveraging JAX for high-performance computation. It provides an alternative MCMC sampler for probabilistic programming models, aiming for speed and robustness. The current version is 0.16.8, and it maintains a frequent release cadence, often with minor bug fixes, dependency updates, and feature enhancements.

ai-mldata
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from nutpie import sample

This example demonstrates how to define a basic PyMC model and then use `nutpie.sample()` to perform MCMC sampling. The results are returned in an `arviz.InferenceData` object.

import pymc as pm import nutpie as np # Define a simple PyMC model with pm.Model() as model: # Priors mu = pm.Normal('mu', mu=0, sigma=1) sigma = pm.HalfNormal('sigma', sigma=1) # Likelihood obs = pm.Normal('obs', mu=mu, sigma=sigma, observed=[1.0, 2.0, 3.0]) # Sample the model using Nutpie print("Starting Nutpie sampling...") idata = np.sample(model) print("Sampling complete. InferenceData:\n", idata)
Debug
Known footguns
gotchaOlder versions of Nutpie (pre-0.16.7) might encounter compatibility issues when sampling PyMC models that heavily utilize `pymc.dims`. Ensure you are on a recent version for full `pymc.dims` support.
gotchaNutpie versions prior to 0.16.5 had a bug affecting compatibility with pandas 3.0 for string coordinates. If you use pandas 3.0 or later with models containing string coordinates, you might encounter errors.
gotchaThe `mindepth` parameter when `check_turning=True` was misbehaving in versions before 0.16.3. This could lead to incorrect or inefficient sampling behavior under specific configurations.
breakingStarting from v0.16.0, step size jitter is enabled by default during NUTS sampling. This changes the default behavior, potentially leading to slightly different sampling paths compared to previous versions where it was disabled by default.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources