load_model#
- load_model(model_uri, dst_path=None)[source]#
Load a sktime model from a local file or a run.
- Parameters:
- model_uristr
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
mlflow-artifacts:/path/to/model
For more information about supported URI schemes, see Referencing Artifacts.
- dst_pathstr, optional (default=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:
- A sktime model instance.
References
[1]https://www.mlflow.org/docs/latest/python_api/mlflow.models.html#mlflow.models.Model.load
Examples
>>> from sktime.datasets import load_airline >>> from sktime.forecasting.arima import ARIMA >>> from sktime.utils import mlflow_sktime >>> y = load_airline() >>> forecaster = ARIMA( ... order=(1, 1, 0), ... seasonal_order=(0, 1, 0, 12), ... suppress_warnings=True) >>> forecaster.fit(y) ARIMA(...) >>> model_path = "model" >>> mlflow_sktime.save_model( ... sktime_model=forecaster, ... path=model_path) >>> loaded_model = mlflow_sktime.load_model(model_uri=model_path)