0
0
ML Pythonml~10 mins

Why responsible ML prevents harm in ML Python - Test Your Understanding

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

Complete 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'
Aharm
Baccuracy
Ccomplexity
Dspeed
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'accuracy' because it sounds important, but harm prevention is the key.
2fill in blank
medium

Complete 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'
Alabels
Bdata
Cfeatures
Dbias
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'data' instead of 'labels' which is incorrect for comparison.
3fill in blank
hard

Fix 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'
A<
B=
C==
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '==' which are assignment or equality, not comparison.
4fill in blank
hard

Fill 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'
Aimportance
Bfeature
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using feature as value or using '<' instead of '>'.
5fill in blank
hard

Fill 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'
Apoint
Bx
Citem
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently or wrong variable for list element.