ArviZ

1.0.0 · active · verified Thu Apr 09

ArviZ is a Python package for exploratory analysis of Bayesian models. It provides tools for diagnostics, visualization, and inference data management, working with various probabilistic programming frameworks. Version 1.0.0 is the current major release, and the project has a regular, active release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a basic `InferenceData` object (often loaded from a model output) and use ArviZ to plot a trace and generate summary statistics. It uses `numpy` for data simulation and `arviz` for analysis and visualization.

import arviz as az
import numpy as np

# Simulate some data for demonstration
np.random.seed(42)
data = {
    'theta': np.random.normal(0, 1, size=1000),
    'phi': np.random.normal(5, 2, size=1000)
}

# Create a dummy InferenceData object (usually loaded from a model)
id = az.InferenceData(
    posterior=az.dict_to_dataset(data),
    sample_stats=az.dict_to_dataset({'lp': np.random.normal(0, 1, size=1000)})
)

# Plot a trace of the posterior samples
az.plot_trace(id, var_names=['theta'])

# Print summary statistics
print(az.summary(id, var_names=['theta']))

view raw JSON →