Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Model Approval Workflows
📖 Scenario: You work in a team that builds machine learning models. Before a model is used in production, it must be approved based on its performance metrics. This project helps you create a simple approval workflow to decide if a model passes or needs review.
🎯 Goal: Build a small program that stores model performance scores, sets an approval threshold, checks which models meet the threshold, and prints the approved models.
📋 What You'll Learn
Create a dictionary called models with model names as keys and their accuracy scores as values
Create a variable called approval_threshold with a float value representing the minimum accuracy needed for approval
Use a dictionary comprehension to create a new dictionary approved_models containing only models with accuracy greater than or equal to approval_threshold
Print the approved_models dictionary
💡 Why This Matters
🌍 Real World
Teams building machine learning models need to approve models before using them in real applications to ensure quality and reliability.
💼 Career
Understanding model approval workflows is important for roles in MLOps, data science, and machine learning engineering to maintain production standards.
Progress0 / 4 steps
1
Create the model performance data
Create a dictionary called models with these exact entries: 'model_A': 0.82, 'model_B': 0.76, 'model_C': 0.91, 'model_D': 0.68
MLOps
Hint
Use curly braces {} to create a dictionary with keys as model names and values as accuracy scores.
2
Set the approval threshold
Create a variable called approval_threshold and set it to 0.80 to represent the minimum accuracy needed for model approval
MLOps
Hint
Use a simple assignment to create the approval_threshold variable.
3
Filter approved models
Use a dictionary comprehension to create a new dictionary called approved_models that contains only the models from models with accuracy greater than or equal to approval_threshold
MLOps
Hint
Use {name: acc for name, acc in models.items() if acc >= approval_threshold} to filter the dictionary.
4
Display approved models
Write a print statement to display the approved_models dictionary
MLOps
Hint
Use print(approved_models) to show the filtered dictionary.
Practice
(1/5)
1. What is the main purpose of a model approval workflow in MLOps?
easy
A. To delete old models from storage
B. To train models faster using more data
C. To deploy models automatically without any checks
D. To check and approve machine learning models before they are used in production
Solution
Step 1: Understand the role of model approval workflows
Model approval workflows are designed to ensure models are reviewed and tested before use.
Step 2: Identify the correct purpose
The main goal is to check and approve models to keep production safe and reliable.
Final Answer:
To check and approve machine learning models before they are used in production -> Option D
Quick Check:
Model approval = safety check before use [OK]
Hint: Approval means checking before use, not training or deleting [OK]
Common Mistakes:
Confusing approval with training or deployment
Thinking approval deletes models
Assuming approval skips checks
2. Which of the following is the correct syntax to add a manual approval step in a typical MLOps pipeline YAML?
easy
A. steps:
- approval_step:
users: ['team_lead']
B. steps:
- name: manual_approval
type: approval
inputs:
approvers: ['team_lead']
C. steps:
- manual_approval:
approvers: 'team_lead'
D. steps:
- name: approval
type: manual
approvers: team_lead
Solution
Step 1: Review typical YAML structure for approval steps
Approval steps usually have a name, type, and inputs including approvers as a list.
Step 2: Match syntax with correct YAML format
steps:
- name: manual_approval
type: approval
inputs:
approvers: ['team_lead'] correctly uses 'name', 'type', and 'inputs' with a list of approvers.
The 'approvers' field must be a list, e.g., ['bob'], not a plain string.
Step 2: Understand impact of wrong format
Using a string causes the pipeline to ignore the approval step or not pause.
Final Answer:
Approvers should be a list, not a string -> Option A
Quick Check:
Approvers list format required = Approvers should be a list, not a string [OK]
Hint: Approvers must be a list, even if one person [OK]
Common Mistakes:
Using string instead of list for approvers
Changing step name unnecessarily
Assuming pipeline triggers control pause
5. You want to create a model approval workflow that automatically approves models with accuracy above 90%, but requires manual approval otherwise. Which workflow design achieves this?
hard
A. Add an automatic test step checking accuracy, then a conditional approval step that auto-approves if accuracy > 90%, else manual approval
B. Only use manual approval for all models regardless of accuracy
C. Skip approval if accuracy is above 90%, else reject the model automatically
D. Deploy all models first, then ask for approval later
Solution
Step 1: Define automatic test for accuracy
Use a test step to check if model accuracy is above 90% automatically.
Step 2: Set conditional approval based on test result
If accuracy > 90%, auto-approve; otherwise, require manual approval to ensure safety.
Final Answer:
Add an automatic test step checking accuracy, then a conditional approval step that auto-approves if accuracy > 90%, else manual approval -> Option A
Quick Check:
Auto test + conditional approval = Add an automatic test step checking accuracy, then a conditional approval step that auto-approves if accuracy > 90%, else manual approval [OK]
Hint: Combine auto test with conditional manual approval [OK]