Creating a multi-step workflow: Model Engineering
The MLflow Projects module can be used as a way to run a multi-step workflow. All steps can be coordinated though a single Python program that passes results from previous steps to the following.
In this exercise, you will begin creating a multi-step workflow to manage the Model Engineering and Model Evaluation steps of the ML lifecycle. You will use the run()
method from the MLflow Projects module for the model_engineering
entry point and pass parameters used as hyperparameters for model training. You will also capture the output of the run_id
and set it to a variable so that it can be passed to the model_evaluation
step of the workflow as a parameter.
The MLproject
created in the previous step is available in the IPython Shell using print(MLproject)
. The MLflow module is imported.
This exercise is part of the course
Introduction to MLflow
Exercise instructions
- Assign the
run()
method from MLflow Projects module to a variable calledmodel_engineering
. - Set the entry point argument to
"model_engineering"
. - Set parameters for training the model.
"n_jobs"
to2
and"fit_intercept"
toFalse
. - Set the
run_id
attribute ofmodel_engineering
to a variable calledmodel_engineering_run_id
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Set run method to model_engineering
____ = ____.____.____(
uri='./',
# Set entry point to model_engineering
____='____',
experiment_name='Insurance',
# Set the parameters for n_jobs and fit_intercept
parameters={
'____': ____,
'____': ____
},
env_manager='local'
)
# Set Run ID of model training to be passed to Model Evaluation step
____ = ____.____
print(model_engineering_run_id)