PIE and optional integrations
The MMM runner is not the entry point for every component in the package. Install the relevant extra and inspect the linked interface before combining these tools with a modelling workflow.
PIE
ammm.pie.model.PIEModel is an alpha BART-based model that learns from a corpus
of experimental incrementality measurements and campaign features. It predicts
incrementality for other campaigns under a transport model; it does not turn
those campaigns into randomised experiments.
Set use_post_determined_features=False for a pre-campaign prediction, and
supply standard_error_column so that imprecise experiments carry less weight.
Study quality and transport across campaigns still need their own review. The
PIE guide covers the data contract, feature diagnostics, a held-out
coverage check and why predictions are not calibration inputs.
MLflow and Plotly
ammm.mlflow supports tracking integration with the mlflow extra. Check its
configuration and the destination before logging model artefacts or data.
Tracking a run does not establish model validity or access governance.
The plotly extra enables model.plot_interactive. For application-owned charts,
use the summary tables and retain dimensions, units and interval
metadata. Optional graph tools use the dag extra; a supplied causal graph
records assumptions rather than testing them.
Record inference data to a local MLflow run
With the mlflow extra installed, this continuation logs the quickstart’s fitted
inference data to a deliberately selected local tracking database. Use an
approved destination for real data and inspect what the artefact contains before
sharing it (src/ammm/mlflow.py:346).
from pathlib import Path
import mlflow
from ammm.mlflow import log_inference_data
tracking_root = Path("sandbox/mlflow-example").resolve()
tracking_root.mkdir(parents=True, exist_ok=True)
mlflow.set_tracking_uri(f"sqlite:///{tracking_root / 'tracking.db'}")
experiment_id = mlflow.create_experiment(
"local-mmm-example", artifact_location=(tracking_root / "artifacts").as_uri(),
)
upload_file = tracking_root / "inference-upload.nc"
if upload_file.exists():
raise FileExistsError(upload_file)
with mlflow.start_run(experiment_id=experiment_id):
log_inference_data(model.idata, save_file=upload_file)
Choose a fresh experiment name on repetition. The helper writes and removes its
temporary upload file after logging (src/ammm/mlflow.py:346).
This logs inference data rather than creating a governed model registry or
access policy. Preserve data sensitivity, source identity and acceptance evidence
outside the tracking success flag. Install extras using the
installation guide; a minimal graph
or logging example does not verify every optional integration workflow.
Implementation reference: src/ammm/pie/model.py:80, src/ammm/mlflow.py:346.