mlflow.sklearn

MLflow integration for scikit-learn.

mlflow.sklearn.load_model(path, run_id=None)

Load a scikit-learn model from a local file (if run_id is None) or a run.

mlflow.sklearn.load_pyfunc(path)

Load a Python Function model from a local file.

mlflow.sklearn.log_model(sk_model, artifact_path)

Log a scikit-learn model as an MLflow artifact for the current run.

mlflow.sklearn.save_model(sk_model, path, conda_env=None, mlflow_model=<mlflow.models.Model object>)

Save a scikit-learn model to a path on the local file system.

Parameters:
  • sk_model – scikit-learn model to be saved.
  • path – Local path where the model is to be saved.
  • conda_env – Path to a Conda environment file. If provided, this decribes the environment this model should be run in. At minimum, it should specify python, scikit-learn, and mlflow with appropriate versions.
  • mlflow_model – MLflow model config this flavor is being added to.