0
0
MLOpsdevops~10 mins

Responsible AI practices in MLOps - Interactive Code Practice

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

Complete the code to log model fairness metrics using a popular MLOps tool.

MLOps
from mlflow import [1]

client = [1].MlflowClient()
client.log_metric(run_id, 'fairness_metric', fairness_value)
Drag options to blanks, or click blank then click option'
Amodel
Btracking
CMlflow
Dexperiment
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Mlflow' instead of 'tracking' causes import errors.
2fill in blank
medium

Complete the code to check for bias in a dataset using the AI Fairness 360 toolkit.

MLOps
from aif360.datasets import [1]

dataset = [1](features, labels)
Drag options to blanks, or click blank then click option'
AFairnessDataset
BBiasDataset
CStandardDataset
DMLDataset
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent classes like 'BiasDataset' causes import errors.
3fill in blank
hard

Fix the error in the code that applies a fairness metric to a model's predictions.

MLOps
from aif360.metrics import [1]

metric = [1](dataset_true, dataset_pred, unprivileged_groups, privileged_groups)
fairness_score = metric.mean_difference()
Drag options to blanks, or click blank then click option'
AClassificationMetric
BBiasMetric
CFairnessMetric
DPredictionMetric
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong class names causes attribute errors.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters features with values greater than 0.

MLOps
{feature: value for feature, value in features.items() if value [1] 0 and feature [2] 'age'}
Drag options to blanks, or click blank then click option'
A>
B<
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' causes wrong filtering.
Using '==' instead of '!=' includes 'age' feature.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercased feature names to values greater than 10.

MLOps
{ [1]: [2] for [3], value in features.items() if value > 10 }
Drag options to blanks, or click blank then click option'
Afeature.upper()
Bvalue
Cfeature
Dval
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'val' instead of 'value' causes NameError.
Not uppercasing feature names changes keys.