Get startedGet started for free

Registering new models

The MLflow Model Registry can also register models during a training run. This is helpful because it enables logging and registering a model under the same function.

In this exercise, you will use the scikit-learn flavor to register a model to the Model Registry during a training run when the model is logged to MLflow Tracking. You will then search the Model Registry to ensure the model was registered.

This model will be registered alongside existing registered models that were trained on the "Insurance" training data. The model has already been trained and set to the variable lr. When searching the Model Registry, an instance of MLflowClient() has been set to client and the filter string has already been created as insurance_filter_string.

This exercise is part of the course

Introduction to MLflow

View Course

Exercise instructions

  • Register the lr model to "Insurance" using the scikit-learn flavor.
  • Search the Model Registry with client to ensure that the model was registered.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Log the model using scikit-learn flavor
____.____.____(____, "model", ____="____")
insurance_filter_string = "name = 'Insurance'"

# Search for Insurance models
print(____.____(____=____))
Edit and Run Code