0
0
MLOpsdevops~15 mins

Model stages (staging, production, archived) in MLOps - Mini Project: Build & Apply

Choose your learning style9 modes available
Manage ML Model Stages with Python
📖 Scenario: You work in a team that builds machine learning models. Each model can be in one of three stages: staging (testing), production (live use), or archived (old versions).You want to organize your models by their stages so the team can easily find and update them.
🎯 Goal: Create a Python dictionary to store model names and their stages. Then, filter models by stage and finally print the models in production.
📋 What You'll Learn
Create a dictionary called models with exact model names and stages
Create a variable called target_stage set to the string 'production'
Use a dictionary comprehension to create a new dictionary called filtered_models that includes only models in target_stage
Print the filtered_models dictionary
💡 Why This Matters
🌍 Real World
Teams managing machine learning models often track which models are being tested, which are live, and which are archived. Organizing models by stage helps with deployment and maintenance.
💼 Career
Understanding how to manage model stages is important for MLOps engineers and data scientists to keep production systems stable and organized.
Progress0 / 4 steps
1
Create the initial models dictionary
Create a dictionary called models with these exact entries: 'modelA': 'staging', 'modelB': 'production', 'modelC': 'archived', 'modelD': 'production'
MLOps
Need a hint?

Use curly braces {} to create a dictionary with keys as model names and values as their stages.

2
Set the target stage variable
Create a variable called target_stage and set it to the string 'production'
MLOps
Need a hint?

Assign the string 'production' to the variable target_stage.

3
Filter models by the target stage
Use a dictionary comprehension to create a new dictionary called filtered_models that includes only the models from models where the stage equals target_stage
MLOps
Need a hint?

Use {name: stage for name, stage in models.items() if stage == target_stage} to filter the dictionary.

4
Print the filtered models
Write a print statement to display the filtered_models dictionary
MLOps
Need a hint?

Use print(filtered_models) to show the filtered dictionary.