Meridian Tools workflow guide
This guide shows the supported end-to-end agency workflow for
meridian-tools. It starts with one YAML config, moves through candidate
validation, separates the final full-sample fit from the validation runs, and
ends with the artefacts you should hand over or inspect later. The examples in
this guide stay inside the implemented package surface. They do not assume
notebooks, dashboards, or unpublished helper scripts.
Before you start
Install Meridian first, then install meridian-tools in the same environment:
Use the CLI for ordinary run execution. Use the Python API when you need rolling-origin planning, an explicit final-fit run, or lifecycle compare and refresh operations. Phase 07 does not provide a lifecycle CLI.
If you want packaged reference examples before authoring your own YAML, use the
bundled demo guide in demos.md. The packaged demo launcher is
meridian-tools demo .... The repo-root python runme.py ... wrapper remains
available when you are working from a source checkout.
Author one YAML config
Keep the authored project definition in YAML. Keep runtime-only choices out of
the YAML file. In practice, that means your source file owns the project
metadata, data path, model specification, fit settings, validation settings,
and export switches. Runtime-only values such as output_dir, run_name, and
one concrete validation_spec belong in PipelineRunConfig or the CLI call,
not in config.resolved.yaml.
Here is one exact blocked-tail config:
Choose the right validation path
Use blocked_tail when you want one contiguous future block for candidate
evaluation. This is often the right default for short MMM time series. Use
rolling_origin when you have enough history to evaluate more than one
expanding-window split. Do not treat rolling_origin as ordinary k-fold
cross-validation. The package does not implement naive IID folds or random
shuffling because that is not the right statistical workflow for MMM time
series.
Validation runs and the final production fit are different jobs. First, you evaluate candidate specifications on blocked time splits. Then, once you have chosen the specification, you run a separate full-sample fit with no holdout.
Run one blocked-tail candidate from the CLI
Once the YAML file is authored, you can execute a blocked-tail candidate run directly through the CLI:
The same packaged runner surface is available through the thin repo-root wrapper:
This command creates a dated run directory under runs/. If you need to
change the output location or the visible run name, pass --output-dir or
--run-name at execution time. Those are runtime-only overrides. They affect
the run directory and manifest, but they do not become part of the authored
YAML contract.
Plan and run rolling-origin validation through the Python API
rolling_origin is a Python-first planning surface because you need one
concrete split at a time. Start with an explicit YAML definition:
Then materialise and execute the validation runs:
build_validation_plan(...) gives you one concrete ValidationRunSpec per
split. run_pipeline(...) remains the primitive that executes one actual run.
Run the final full-sample fit separately
After you have chosen the winning specification, run the final fit on the full sample. Do not reuse a validation fit as the production artefact.
For rolling_origin and blocked_tail workflows, validation_plan.final_fit_run
is the explicit no-holdout runtime spec. It keeps the boundary clear. Candidate
validation and final production fitting are separate steps.
Know which artefacts matter for handoff
Each successful run directory is the handoff unit. The important files are:
run_manifest.jsonfor stage status, versions, timestamps, and top-level artefact links00_run_metadata/config.source.yamlfor the authored source config00_run_metadata/config.resolved.yamlfor the YAML-owned config after path resolution00_run_metadata/input_data_provenance.jsonfor the exact dataset identity used by the run10_validation/validation_spec.jsonwhen the run is validation-aware30_model_assessment/diagnostics_bundle.jsonfor stable diagnostics metadata30_model_assessment/model_results_summary.htmlfor the wrapped Meridian assessment summary30_model_assessment/plots/for assessment PNG plots such as model fit andrhatreview40_decomposition/summary_metrics.csvandsummary_metrics.ncfor decomposition exports40_decomposition/plots/for decomposition PNG plots60_response_curves/plots/response_curves_plot.pngwhen response-curve export is enabled70_optimisation/plots/when optimisation export is enabled30_model_assessmentmodel-selection outputs when the run is compatible, or30_model_assessment/model_selection_status.jsonwhen it is not
Read those artefacts together.
30_model_assessment/diagnostics_bundle.json tells you whether predictive
accuracy and review summary were exported or disabled. The assessment stage
either contains the real Bayesian model-selection outputs or one explicit
compatibility status artefact.
The supported Bayesian model-selection boundary is narrow and deliberate. The
package supports fitted Meridian models where holdout_id is None. That means
full-sample fitted models and explicit final-fit runs are compatible. Validation
fits and authored holdout fits are not.
Use lifecycle helpers after a run exists
Once you have stored run directories, the lifecycle API lets you reload, compare, and refresh them without going back to notebook state.
compare_run_records(...) gives you a metadata-level comparison. It does not
attempt a raw-file diff across every output. refresh_run(...) rebuilds a new
sibling run from the stored run-local artefacts. It does not overwrite the
source run. Phase 07 does not provide lifecycle CLI commands, so use the
Python API for these operations.
Know the staged output schema
The current run layout is:
The runner always writes:
00_run_metadata20_model_fit30_model_assessment40_decomposition
The runner writes these only when applicable:
10_validation60_response_curves70_optimisation
For the bundled reference examples and the exact stage-level file set, see demos.md.
A practical analyst sequence
If you want one concrete operating pattern, use this one. Author a YAML file.
Run a blocked-tail candidate through the CLI when you need one held-out tail
block. Use rolling_origin through build_validation_plan(...) when you need
multiple expanding-window validation splits. Choose the modelling
specification. Run the final full-sample fit as its own job. Review the run
directory artefacts. Then use compare_run_records(...) and refresh_run(...)
when you need to inspect or rerun stored work later.