Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the main goal of responsible ML.
ML Python
print("The main goal of responsible ML is to prevent [1].")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'accuracy' because it sounds important, but harm prevention is the key.
✗ Incorrect
Responsible ML aims to prevent harm caused by biased or unfair models.
2fill in blank
mediumComplete the code to check if a model is accurate by comparing predictions.
ML Python
if all(model.predict(data) == [1]): print("Model is accurate")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'data' instead of 'labels' which is incorrect for comparison.
✗ Incorrect
We compare model predictions to true labels to check accuracy.
3fill in blank
hardFix the error in the code that checks for bias in predictions.
ML Python
bias_detected = any(prediction [1] threshold for prediction in predictions)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '==' which are assignment or equality, not comparison.
✗ Incorrect
We check if any prediction is greater than a threshold to detect bias.
4fill in blank
hardFill both blanks to create a dictionary of features and their importance if importance is above 0.5.
ML Python
important_features = {feature: [1] for feature, importance in feature_importances.items() if importance [2] 0.5} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using feature as value or using '<' instead of '>'.
✗ Incorrect
We keep features with importance greater than 0.5 and map feature to its importance.
5fill in blank
hardFill all three blanks to filter data points where age is above 18 and income is above 30000.
ML Python
filtered_data = [[1] for [2] in data if [3]['age'] > 18 and [3]['income'] > 30000]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently or wrong variable for list element.
✗ Incorrect
We iterate over data with variable 'point' and select 'point' for the list, using 'point' to access fields.