0
0
MLOpsdevops~30 mins

Technical debt in ML systems in MLOps - Mini Project: Build & Apply

Choose your learning style9 modes available
Managing Technical Debt in ML Systems
📖 Scenario: You are working as a machine learning engineer in a team that builds ML models for predicting customer churn. Over time, the ML system has grown complex and hard to maintain. Your task is to create a simple Python script that helps identify and manage technical debt by tracking model versions and their metadata.
🎯 Goal: Build a Python script that stores model metadata, sets a threshold for maximum allowed model versions, filters out old models exceeding the threshold, and prints the list of active models. This helps keep the ML system clean and manageable.
📋 What You'll Learn
Create a dictionary called model_versions with exact keys as model version names and values as their accuracy scores.
Create a variable called max_versions set to the integer 3 to limit the number of active models.
Use a dictionary comprehension to create a new dictionary called active_models that includes only the top max_versions models by accuracy.
Print the active_models dictionary to display the current active models.
💡 Why This Matters
🌍 Real World
ML systems often accumulate many model versions and metadata, which can cause confusion and errors if not managed well. This project simulates a simple way to track and limit active models to reduce technical debt.
💼 Career
Understanding how to manage model versions and technical debt is crucial for ML engineers and MLOps specialists to maintain reliable and maintainable ML systems.
Progress0 / 4 steps
1
Create the initial model versions dictionary
Create a dictionary called model_versions with these exact entries: 'v1.0': 0.82, 'v1.1': 0.85, 'v2.0': 0.88, 'v2.1': 0.90, 'v3.0': 0.87.
MLOps
Need a hint?

Use curly braces to create a dictionary with version names as keys and accuracy scores as values.

2
Set the maximum allowed model versions
Create a variable called max_versions and set it to the integer 3.
MLOps
Need a hint?

Just assign the number 3 to the variable max_versions.

3
Filter active models using dictionary comprehension
Use a dictionary comprehension to create a new dictionary called active_models that contains only the top max_versions models by accuracy from model_versions. Sort the models by accuracy in descending order and include only the top 3.
MLOps
Need a hint?

Use sorted() with key=lambda item: item[1] and reverse=True to sort by accuracy descending. Then slice the first max_versions items and build a dictionary comprehension.

4
Print the active models
Write a print statement to display the active_models dictionary.
MLOps
Need a hint?

Use print(active_models) to show the filtered dictionary.