alterlab-pymc — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited alterlab-pymc (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
PyMC is a Python library for Bayesian modeling and probabilistic programming. Build, fit, validate, and compare Bayesian models using PyMC's modern API (version 5.x+), including hierarchical models, MCMC sampling (NUTS), variational inference, and model comparison (LOO, WAIC).
This skill should be used when:
Follow this 8-step workflow for building and validating Bayesian models:
coordsdims, pm.Data() for predictablespm.sample_prior_predictive; validate priors before fittingpm.sample(draws=2000, tune=1000, chains=4, target_accept=0.9); include log_likelihood=True for comparisonpm.sample_posterior_predictive; check fit vs. observed dataaz.summary, az.plot_posterior, az.plot_forestpm.set_data then pm.sample_posterior_predictive; extract HDI intervalsFull step-by-step code: references/workflow_examples.md.
PyMC supports linear/logistic/Poisson regression, hierarchical (multilevel) models, and time-series (AR). Ready-to-adapt code for each lives in references/model_patterns.md.
Critical: Always use non-centered parameterization for hierarchical models to avoid divergences. Templates: assets/linear_regression_template.py, assets/hierarchical_model_template.py.
Choosing priors and likelihoods is the highest-leverage modeling decision. A quick chooser (scale params, unbounded, positive, probabilities, correlation matrices; continuous/count/binary/ categorical likelihoods) is in references/distribution_selection.md. The comprehensive catalog is in references/distributions.md.
scripts/model_comparison.py); interpret Δloo and Pareto-k.target_accept for divergences; ADVI for fast approximation.scripts/model_diagnostics.py (check_diagnostics, create_diagnostic_report).Code and decision rules: references/model_comparison.md. Detailed sampling-algorithm guide: references/sampling_inference.md.
dims) for clarityStart simple and add complexity gradually, iterating on the model based on each predictive check (see the 8-step workflow above).
This skill includes:
references/)workflow_examples.md — missing-data imputation, QR reparameterization, mixture models, and a model-averaging helper.scripts/)check_diagnostics() for quick checks, create_diagnostic_report() for comprehensive analysis with plots.compare_models(), check_loo_reliability(), model_averaging().assets/)with pm.Model(coords={'var': names}) as model:
# Priors
param = pm.Normal('param', mu=0, sigma=1, dims='var')
# Likelihood
y = pm.Normal('y', mu=..., sigma=..., observed=data)idata = pm.sample(draws=2000, tune=1000, chains=4, target_accept=0.9)from scripts.model_diagnostics import check_diagnostics
check_diagnostics(idata)from scripts.model_comparison import compare_models
compare_models({'m1': idata1, 'm2': idata2}, ic='loo')# X must have been wrapped at build time: pm.Data('X', X, dims=('obs', 'predictors'))
with model:
pm.set_data({'X': X_new}, coords={'obs': range(len(X_new))})
pm.sample_posterior_predictive(idata, predictions=True, extend_inferencedata=True)
# predictions land in idata.predictionspm.model_to_graphviz(model) to visualize model structureidata.to_netcdf('results.nc'); load with az.from_netcdf('results.nc')Common gotchas (PyMC 5.x / ArviZ):
pm.Data('X', X, dims=...) at build time — only then can pm.set_data({'X': X_new}, coords={...}) swap them. A plain NumPy array baked into the graph cannot be replaced.pm.sample_prior_predictive takes draws= (the old samples= keyword was removed).pm.sample_posterior_predictive(idata, predictions=True, extend_inferencedata=True, ...); results then live in idata.predictions, not idata.posterior_predictive.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.