MLflow module¶
-
class
MLflow.MLApplication(model, preprocessing)¶ Bases:
mlflow.pyfunc.model.PythonModelDefine the MLFlow “PythonModel”. This clas is used to deploy the model as a REST API.
- Parameters
model – fitted model
preprocessing – fitted pipeline
-
predict(context, x)¶ Evaluates a pyfunc-compatible input and produces a pyfunc-compatible output. For more information about the pyfunc input/output API, see the pyfunc-inference-api.
- Parameters
context – A
PythonModelContextinstance containing artifacts that the model can use to perform inference.model_input – A pyfunc-compatible input for the model to evaluate.
-
MLflow.track(metrics=None, params=None, artifacts=None, model=None, feature_engineering=None, preprocessing=None, mlflow_dir='./mlruns', artifacts_path='outputs/plots/mlflow_artifacts')¶ Ensure MLFlow Tracking.
- Parameters
metrics (dict) – Model’s metrics.
params (dict) – Best hyperparameters found.
artifacts – Plots.
model – fitted model.
feature_engineering – Not used for now.
preprocessing – Fitted pipeline.
mlflow_dir (str) – path describing where to store MLFlows runs. Defaults to ‘./mlruns’.
artifacts_path (str) – path of the artifacts to add to MLFlow. Defaults to “outputs/plots/mlflow_artifacts”.