Run Steps in Parallel

In the previous sections, you explored creating and deploying a pipeline that focused on training a single Logistic Regression model. Now you are going to explore how to create pipelines and train more than a single model at a time. You will start with a Python file that has the Logistic Regression model training code created and decorated for Kale. Throughout this section, you will add another function that trains a Random Forest ensemble and call it with the right arguments inside the ml_pipeline function.

Tip

Please follow along in your own copy of our notebook as we complete the steps below.

1. Load New Python Code

To begin download the Python code you will work with by clicking here.

Open the code in the Notebook Server and confirm you have the correct code as shown below.

![)

2. Rename Logistic Regression Step

To differentiate the two model training steps you need to rename both the function and the name in the @step decorator. Perform the following modifications:

  • Replace name="model_training" with name="logistic_regression" in the @step decorator for the train_logistic_regression function
  • Rename the train function as train_logistic_regression

3. Update ml_pipeline function

Since the function name has changed you will need to update the function name in the ml_pipeline function.

Replace train() in the ml_pipeline function with

train_logistic_regression(x, x_test, y, iters).

Additionally, you will need to rename the pipeline as name="parallel-steps" in the @pipeline decorator.

At this point, the existing code has been refactored to support the introduction of an additional model training step.

Next, you will be challenged to complete this code update.