0
0
ML Pythonml~10 mins

Model drift detection in ML Python - Interactive Code Practice

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

Complete the code to import the library used for detecting model drift.

ML Python
from sklearn.metrics import [1]
Drag options to blanks, or click blank then click option'
Amean_squared_error
Baccuracy_score
Cclassification_report
Droc_auc_score
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a metric that measures error instead of accuracy.
Importing a report function instead of a metric.
2fill in blank
medium

Complete the code to calculate the accuracy of model predictions.

ML Python
accuracy = accuracy_score(y_true, [1])
Drag options to blanks, or click blank then click option'
Ay_prob
By_test
Cy_train
Dy_pred
Attempts:
3 left
💡 Hint
Common Mistakes
Using predicted probabilities instead of predicted labels.
Confusing test data with predictions.
3fill in blank
hard

Fix the error in the code to detect model drift by comparing old and new accuracy.

ML Python
if new_accuracy [1] old_accuracy - threshold:
    print('Model drift detected')
Drag options to blanks, or click blank then click option'
A>
B==
C<
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using greater than operator which means performance improved.
Using equality operator which doesn't detect drift.
4fill in blank
hard

Fill both blanks to create a dictionary that stores accuracy scores for old and new data.

ML Python
accuracy_scores = {'old': [1], 'new': [2]
Drag options to blanks, or click blank then click option'
Aold_accuracy
Bnew_accuracy
Caccuracy_score(y_old_true, y_old_pred)
Daccuracy_score(y_new_true, y_new_pred)
Attempts:
3 left
💡 Hint
Common Mistakes
Calling accuracy_score inside the dictionary instead of using variables.
Swapping old and new accuracy values.
5fill in blank
hard

Fill all three blanks to complete the code that calculates accuracy for old and new data and checks for drift.

ML Python
old_accuracy = [1](y_old_true, y_old_pred)
new_accuracy = [2](y_new_true, y_new_pred)
if new_accuracy [3] old_accuracy - 0.05:
    print('Model drift detected')
Drag options to blanks, or click blank then click option'
Aaccuracy_score
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using different functions for accuracy calculation.
Using greater than operator which means performance improved.