0
0
ML Pythonml~10 mins

Model registry in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to register a model named 'my_model' in MLflow. Assume 'model' is a scikit-learn model and registered_model_name='my_model' is used.

ML Python
import mlflow
mlflow.[1].log_model(model, 'my_model', registered_model_name='my_model')
Drag options to blanks, or click blank then click option'
Atracking
Bmodels
Cpytorch
Dsklearn
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tracking' which handles experiments and tracking, not model logging.
Using 'models' or flavor-specific modules incorrectly.
Forgetting to import mlflow before using it.
2fill in blank
medium

Complete the code to load a registered model named 'my_model' from MLflow.

ML Python
import mlflow
model = mlflow.pyfunc.load_model(model_uri='models:/[1]/1')
Drag options to blanks, or click blank then click option'
Amy_model
Bbest_model
Cmodel_v1
Dlatest_model
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different model name than the one registered.
Forgetting the 'models:/' prefix in the URI.
3fill in blank
hard

Fix the error in the code to transition a model version to 'Production' stage.

ML Python
from mlflow.tracking import MlflowClient
client = MlflowClient()
client.[1](name='my_model', version=1, stage='Production')
Drag options to blanks, or click blank then click option'
Achange_stage
Btransition_model_version_stage
Cupdate_stage
Dset_model_stage
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names that do not exist in MlflowClient.
Forgetting to import MlflowClient.
4fill in blank
hard

Fill both blanks to create a client and list all registered models.

ML Python
from mlflow.tracking import [1]
client = [2]() 
models = client.list_registered_models()
Drag options to blanks, or click blank then click option'
AMlflowClient
BMlflowRegistry
CModelClient
DModelRegistry
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent classes like 'ModelClient' or 'MlflowRegistry'.
Importing the class but not instantiating it.
5fill in blank
hard

Fill all three blanks to register a model, transition its stage, and load it.

ML Python
import mlflow
client = mlflow.tracking.[1]()
client.transition_model_version_stage(name='my_model', version=1, stage=[2])
model = mlflow.pyfunc.load_model(model_uri='models:/my_model/[3]')
Drag options to blanks, or click blank then click option'
AMlflowClient
B'Production'
DMlflowRegistry
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong client class names.
Not quoting the stage name correctly.
Using version numbers instead of stage names in the URI.