the repo-managed development environment from environment.yml
an editable install, so local code changes are picked up immediately
Minimal pip install from source
If you do not want the full Conda environment, you can still install Abacus
directly from the repository root.
Standard install
python3 -m pip install .
Editable install
python3 -m pip install -e .
Use the editable install if you are changing code, configs, or docs locally.
Optional extras
Abacus defines a small set of optional extras in pyproject.toml.
Extra
Install command
Use when you need
lint
python3 -m pip install .[lint]
Ruff, MyPy, and related local linting tools
test
python3 -m pip install .[test]
Pytest and test-only dependencies
planner
python3 -m pip install -e ".[planner]"
Deprecated no-op compatibility marker for old install commands
If you created the environment from environment.yml, most development
dependencies are already present.
The statistical scenario API does not require the planner extra. New
library code should import scenario objects from abacus.scenarios. The
experimental abacus-dashboard application is deprecated. Use the scenario
Python API or CLI; no dashboard installation is required. Legacy app-layer
paths under abacus.scenario_planner remain as advisory compatibility facades.
Abacus does not vendor Dash, Plotly, or Flask dependencies.
For a real end-to-end verification path, use the repo smoke target:
make smoke_mmm
If you are working on the repo itself, the main local verification commands
are:
make testmake verify_local
make verify_package
Runtime defaults for restricted environments
Some local runs need writable cache directories. If you hit PyTensor compiledir
or cache-permission issues, export the same defaults used by the repo
verification scripts:
This page shows the fastest direct path from a pandas dataset to a fitted
PanelMMM.
If you have not prepared your dataset yet, read
Data Preparation first.
Load a dataset
The repository includes bundled demo datasets under data/demo/. The
timeseries bundle is the simplest starting point because it has no extra panel
dimensions.
An existing model graph can only be fitted with the data used to construct it.
This applies to both fit() and approximate_fit(), including models restored
with PanelMMM.load(). Equal copies of the training inputs are accepted;
changed outcomes, predictors, dates or panel units raise ValueError before
inference starts. Use a fresh model instance to fit a different dataset.
Abacus checks the retained training values and coordinates, not Python object
identity. Mutating the original DataFrame or array after construction does not
change the recorded training data. The check also rejects fitting after an
in-place update of the graph’s training data. Posterior prediction clones the
PanelMMM graph by default; keep that default if you intend to fit it again.
Building explicitly and then fitting identical data preserves additions to the
graph, including calibration terms and extra deterministics. Abacus does not
silently rebuild the graph when fitting inputs change.
Supply the real target when constructing a graph for prior predictive checks
that you intend to fit later:
Omitting y during prior construction creates a graph with zero targets. A
later fit with different target values is rejected; construct a fresh instance
for that fit.
This guard does not retrospectively validate saved results. If an earlier fit
reused a graph with changed inputs, rerun it from a fresh instance.
Read Model Fitting for fitting, save/load, and
predictive-check workflows in more detail.
Quickstart: YAML Builder
Use the YAML builder to create an in-memory PanelMMM from a model
specification. It builds the PyMC graph; you then fit and predict in Python.
For staged outputs and manifests, use the
Pipeline Runner.
Complete Installation first. The example below uses small
synthetic data and short chains to check execution. It does not establish
convergence, parameter recovery or a suitable model for real data.
Create a builder configuration
Work in a new scratch directory, such as sandbox/yaml-quickstart/ within your
checkout. Save this as model.yml in that directory:
This configuration accepts X and y from Python. The bundled
data/demo/timeseries/config.yml is a runner configuration: it also
contains diagnostics, validation, prior_sensitivity and ai_advisor.
The public builder rejects those runner-only blocks. Use the runner for that
file; do not pass it directly to build_mmm_from_yaml(...).
Build from synthetic data
Run these Python blocks in order from the directory containing model.yml:
With this configuration, the returned dataset has 24 dates and 100 combined
posterior samples (two chains of 50 draws). Sampling warnings and divergences can occur
with such short chains. Do not interpret these smoke-run estimates. Before
interpreting a real model, choose adequate sampling settings and assess
Diagnostics.
Override configuration from Python
model_kwargs takes precedence over the translated YAML constructor arguments.
For sampler_config, provide the complete mapping you want to use: it replaces
the YAML sampler mapping at this boundary.
This second fit only checks the override path. It is not a sensitivity or
convergence assessment.
Load your own data
Pattern
What you provide
In-memory data
Both X and y, as above
Combined CSV
data.dataset_path; the file must contain the target column
Separate CSVs
data.x_path and data.y_path
Configured relative paths resolve from the YAML file’s directory. The builder
normalises the configured date column. To fit after loading a CSV, load and
split that data in Python too, then pass matching X and y to fit(...).
See Input Data Requirements
for index, missing-data and panel rules.
Optional builder blocks
Key
Purpose
estimator
Select a named estimator preset
dimensions
Legacy panel-dimension configuration; do not combine with estimator
scaling
Target and channel scaling rules
effects
Additive effects attached before graph construction
priors
Model-level prior overrides
fit
Sampler defaults
holidays
Holiday/event configuration
original_scale_vars
Original-scale deterministic variables added after build
inference_data
Attach saved inference data
calibration
Calibration steps after build, subject to estimator support
optimization
Optimisation settings accepted by the shared schema; the builder does not run optimisation
Use the pipeline runner when you want a full staged run instead of only an
in-memory model fit.
The runner writes:
a run manifest
copied and resolved config files
fitted model artefacts
posterior predictive assessment outputs
decomposition, diagnostics, and response-curve artefacts
Full bundled demo
From the repository root, run the complete demo with:
python3 runme.py --demo timeseries
Other bundled demos are:
timeseries_controls
geo_fe
geo_cre
geo_panel
geo_brand_panel
timeseries and timeseries_controls use the released time_series estimator
preset. geo_fe and geo_cre use the released one-unit FE and CRE presets.
geo_panel and geo_brand_panel use the advanced dimensions.panel surface;
they are not named RE, FE, or CRE estimators. The named RE preset remains
release-gated. See the demo catalogue for the exact
semantics and release status of each recipe.
List them explicitly with:
python3 runme.py --list-demos
runme.py is a convenience wrapper around the structured pipeline. It resolves
the demo config under data/demo/<demo_name>/config.yml and runs the pipeline
for you.
Read Choose an Estimator
before treating either recipe as the basis for a real model.
The timeseries demo requests four chains with 2,000 tuning and 3,000 retained
draws per chain for Stage 20. Its enabled validation stage separately requests
four chains with 2,000 tuning and 2,000 retained draws per chain. Explicit
validation.sampler settings override main-fit CLI settings for that refit.
make smoke_mmm launches this full demo without reducing either budget.
Bounded software smoke
Use this synthetic example to check execution with a small, explicit budget.
Run the following from the repository root in the installed Abacus environment.
It creates a separate scratch configuration and dataset, leaving the bundled
demos unchanged. Repeating the setup overwrites these two scratch inputs; each
pipeline execution creates a new run directory.
Stage 20 uses two chains, each with 20 tuning and 20 retained draws, on one
core. Stage 35 performs no fit: run_manifest.json must record validation as
skipped, and no holdout scoring artefacts are expected. Prior sensitivity,
both AI stages and optimisation are also skipped because their configuration
blocks are absent. The run should complete through Stage 80’s evidence
inventory. The resolved main-fit settings are in
00_run_metadata/config.resolved.yaml.
These small sampling budgets check software execution only. Warnings or
retained divergences can occur; do not interpret these fitted estimates.
To exercise holdout scoring, prepare a separate config with explicit budgets
for both fits and follow Blocked Holdout Validation.
A skipped validation stage is not evidence of predictive performance.
Run the pipeline from Python
The direct Python API below runs the bundled geo-panel model. It is separate
from the bounded synthetic smoke above. Check the selected YAML’s validation
budget before running it:
The CLI prints the final run directory and manifest when the pipeline
completes. When the run manifest records them, it also prints paths to the
estimator summary, diagnostics summary, and interpretation report. These paths
are relative to the run directory.
Pipeline completion means that the configured stages finished. It does not
mean that the fitted model passed its diagnostic gates or is suitable for
interpretation. Review the listed diagnostic and interpretation artefacts
before using model outputs.
Override data paths
Use one of these patterns:
Pattern
Arguments
Combined dataset override
dataset_path= in Python or --dataset-path in the CLI
Separate feature and target files
x_path= and y_path= in Python or --x-path and --y-path in the CLI
Target column override
target_column= in Python or --target-column in the CLI
Configured relative paths are resolved relative to the YAML config directory.
If you want Stage 50 to use different warn/fail cutoffs, add a runner-only
diagnostics.thresholds block to the YAML. See
YAML Configuration.
What you get back
run_pipeline(...) returns a PipelineRunResult with:
run_dir
manifest_path
The runner creates all stage directories up front, including those for skipped
stages. Use the manifest to distinguish completed, skipped and failed work.
See the canonical stage sequence
and artefact locations, including
Stage 80’s evidence inventory.
Named estimator runs also record their resolved contract in
00_run_metadata/estimator_summary.txt and
00_run_metadata/estimator_manifest.yaml. FE writes its transformed
within-design screen under 10_pre_diagnostics. CRE writes structural and
reference summary-basis screens under 10_pre_diagnostics, a bounded post-fit
screen under 20_model_fit, and separate CRE-adjustment decomposition evidence
under 40_decomposition.
60_response_curves now includes three complementary curve families:
saturation-only transformation artefacts
forward-pass direct contribution artefacts built from scaled observed history