aimz.mlflow.load_model#

aimz.mlflow.load_model(model_uri, dst_path=None)[source]#

Load an aimz model from a local file or a run.

Parameters:
  • model_uri (str) –

    The location, in URI format, of the MLflow model. For example:

    • /Users/me/path/to/local/model

    • relative/path/to/local/model

    • s3://my_bucket/path/to/model

    • runs:/<mlflow_run_id>/run-relative/path/to/model

    • models:/<model_name>/<model_version>

    • models:/<model_name>/<stage>

    For more information about supported URI schemes, see Referencing Artifacts.

  • dst_path (str | None) – The local filesystem path to which to download the model artifact. This directory must already exist. If unspecified, a local output path will be created.

Returns:

An aimz model (an instance of ImpactModel).

Return type:

ImpactModel

Example#
import aimz.mlflow

# Load model
im = aimz.mlflow.load_model("runs:/<mlflow_run_id>/model")

# Make predictions; returns an xarray.DataTree of posterior predictive samples
predictions = im.predict(X)