Module: meridian.mlflow.autolog

MLflow autologging integration for Meridian.

This module enables MLflow tracking for Meridian. When enabled via autolog(), parameters, metrics, and other metadata will be automatically logged to MLflow, allowing for improved experiment tracking and analysis.

To enable MLflow autologging for your Meridian workflows, simply call autolog.autolog() once before your model run.

Example usage:

import mlflow
from meridian.data import load
from meridian.mlflow import autolog
from meridian.model import model

# Enable autologging (call this once per session)
autolog.autolog(log_metrics=True)

# Start an MLflow run (optionally name it for better grouping)
with mlflow.start_run(run_name="my_run"):
  # Load data
  data = load.CsvDataLoader(...).load()

  # Initialize Meridian model
  mmm = model.Meridian(input_data=data)

  # Run Meridian sampling processes
  mmm.sample_prior(n_draws=100, seed=123)
  mmm.sample_posterior(n_chains=7, n_adapt=500, n_burnin=500, n_keep=1000,
  seed=1)

# After the run completes, you can retrieve run results using the MLflow client.
client = mlflow.tracking.MlflowClient()

# Get the experiment ID for the run you just launched
experiment_id = "0"

# Search for runs matching the run name
runs = client.search_runs(
    experiment_id,
    max_results=1000,
    filter_string=f"attributes.run_name = 'my_run'"
)

# Print details of the run
if runs:
  print(runs[0])
else:
  print("No runs found.")

Functions

autolog(...): Enables MLflow tracking for Meridian.