0
0
MLOpsdevops~10 mins

Explainability requirements 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 import the library used for model explainability.

MLOps
import [1]
Drag options to blanks, or click blank then click option'
Atensorflow
Bshap
Cnumpy
Dpandas
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated libraries like tensorflow or pandas for explainability.
Confusing numpy with explainability tools.
2fill in blank
medium

Complete the code to create an explainer object for a model using SHAP.

MLOps
explainer = shap.[1](model)
Drag options to blanks, or click blank then click option'
ATreeExplainer
Bsummary_plot
Cforce_plot
Ddependence_plot
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot functions instead of explainer constructors.
Confusing summary_plot with explainer creation.
3fill in blank
hard

Fix the error in the code to generate SHAP values for the dataset.

MLOps
shap_values = explainer.[1](X_test)
Drag options to blanks, or click blank then click option'
Aplot
Bshap_values()
Cvalues
Dshap_values
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to call a non-existent method 'values'.
Using 'plot' which is for visualization, not value extraction.
4fill in blank
hard

Fill both blanks to create a SHAP summary plot for the test data.

MLOps
shap.[1](shap_values, [2])
Drag options to blanks, or click blank then click option'
Asummary_plot
BX_test
Cforce_plot
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Using force_plot instead of summary_plot for overview.
Passing the model instead of the dataset.
5fill in blank
hard

Fill all three blanks to filter features with SHAP values greater than 0.1 and create a dictionary of feature importance.

MLOps
important_features = {feature: value for feature, value in zip([1], shap_values[0]) if value [2] [3]
Drag options to blanks, or click blank then click option'
AX_test.columns
B>
C0.1
DX_test.index
Attempts:
3 left
💡 Hint
Common Mistakes
Using index instead of columns for feature names.
Using wrong comparison operators like '<' or '=='
Using a threshold other than 0.1.