Builders and Pipeline

AMMM3 exposes one public YAML builder and one structured pipeline runner.

Use these surfaces when you want configuration-driven model construction or a staged run directory with machine-readable artefacts.

YAML builder

Import path:

from abacus.mmm.builders.yaml import build_mmm_from_yaml

Signature:

model = build_mmm_from_yaml(
    config_path,
    X=X,
    y=y,
    model_kwargs=None,
    holidays_path=None,
)

Main inputs:

ArgumentMeaning
config_pathYAML file path
XOptional pre-loaded feature data
yOptional pre-loaded target data
model_kwargsModel init overrides
holidays_pathOptional holiday CSV override

It returns a built PanelMMM.

The builder orchestrates:

  • model construction
  • optional additive effects
  • holiday augmentation
  • build_model(X, y)
  • optional original_scale_vars
  • optional calibration steps
  • optional inference-data attachment

Holiday augmentation is model-aware:

  • time-series configs default holidays.countries to US
  • geo-panel configs must declare multiple holidays.countries values
  • catalogue-style holiday CSV inputs are filtered to the configured countries

Structured pipeline runner

Top-level import path:

from abacus.pipeline import PipelineRunConfig, PipelineRunResult, run_pipeline

PipelineRunConfig

PipelineRunConfig is the user-facing run configuration dataclass.

Key fields:

FieldMeaning
config_pathYAML config file
output_dirOutput root for run directories
run_nameOptional logical run name
dataset_pathOptional combined dataset CSV
x_path / y_pathOptional separate feature and target CSVs
holidays_pathOptional holiday CSV override
target_columnOptional target-column override
prior_samplesPrior predictive sample count
draws, tune, chains, coresSampler overrides
random_seedGlobal random seed override
curve_samplesCurve summary sample count
curve_pointsCurve summary x-axis resolution

It also exposes:

  • effective_run_name()

run_pipeline(...)

Use run_pipeline(...) to execute the structured runner:

from pathlib import Path

from abacus.pipeline import PipelineRunConfig, run_pipeline

result = run_pipeline(
    PipelineRunConfig(
        config_path=Path("data/demo/timeseries/config.yml"),
        dataset_path=Path("data/demo/timeseries/dataset.csv"),
    )
)

run_pipeline(...):

  • loads the YAML config
  • loads data from the configured or overridden paths
  • resolves sampler overrides
  • creates the run directory and manifest
  • runs the retained stage sequence

The stage sequence is:

  1. metadata
  2. prior_sensitivity (optional)
  3. ai_advisor (optional)
  4. preflight
  5. fit
  6. assessment
  7. validation (optional)
  8. decomposition
  9. diagnostics
  10. ai_diagnostics_advisor (optional)
  11. curves
  12. optimisation (optional)
  13. interpretation

See Runner Overview for stage conditions. Path fields in PipelineRunConfig require pathlib.Path objects. The example above uses the full configured sampling workload.

PipelineRunResult

PipelineRunResult is a small dataclass with:

FieldMeaning
run_dirConcrete run directory path
manifest_pathManifest JSON path

CLI entry point

The CLI entry point lives in abacus.pipeline.runner:

python -m abacus.pipeline.runner --config config.yml --dataset-path data.csv

For full CLI usage, see CLI Reference.