mlflow.mleap
The mlflow.mleap
module provides an API for saving Spark MLLib models using the
MLeap persistence mechanism.
A companion module for loading MLflow models with the MLeap flavor format is available in the
mlflow/java
package.
-
mlflow.mleap.
add_to_model
(mlflow_model, path, spark_model, sample_input) Add the MLeap flavor to an existing MLflow model.
Parameters: - mlflow_model –
mlflow.models.Model
to which this flavor is being added. - path – Path of the model to which this flavor is being added.
- spark_model – Spark PipelineModel to be saved. This model must be MLeap-compatible and cannot contain any custom transformers.
- sample_input – Sample PySpark DataFrame input that the model can evaluate. This is required by MLeap for data schema inference.
- mlflow_model –
-
mlflow.mleap.
log_model
(spark_model, sample_input, artifact_path) Log a Spark MLLib model in MLeap format as an MLflow artifact for the current run. The logged model will have the MLeap flavor.
Note
The MLeap model flavor cannot be loaded in Python; it must be loaded using the Java module within the
mlflow/java
package.Parameters: - spark_model – Spark PipelineModel to be saved. This model must be MLeap-compatible and cannot contain any custom transformers.
- sample_input – Sample PySpark DataFrame input that the model can evaluate. This is required by MLeap for data schema inference.
- artifact_path – Run-relative artifact path.
-
mlflow.mleap.
save_model
(spark_model, sample_input, path, mlflow_model=<mlflow.models.Model object>) Save a Spark MLlib PipelineModel in MLeap format at a local path. The saved model will have the MLeap flavor.
Note
The MLeap model flavor cannot be loaded in Python; it must be loaded using the Java module within the
mlflow/java
package.Parameters: - spark_model – Spark PipelineModel to be saved. This model must be MLeap-compatible and cannot contain any custom transformers.
- sample_input – Sample PySpark DataFrame input that the model can evaluate. This is required by MLeap for data schema inference.
- path – Local path where the model is to be saved.
- mlflow_model –
mlflow.models.Model
to which this flavor is being added.