Spaces:
Runtime error
Runtime error
shap
Browse files
app.py
CHANGED
@@ -111,9 +111,12 @@ with gr.Blocks() as demo:
|
|
111 |
|
112 |
## explainability plots
|
113 |
rf_model = model.steps[-1][1]
|
114 |
-
|
115 |
-
explainer = shap.TreeExplainer(
|
|
|
|
|
116 |
shap_values = explainer(df)
|
|
|
117 |
print(shap_values.shape) # should now show (1, 4)
|
118 |
|
119 |
shap_waterfall_plot = shap.plots.waterfall(shap_values[0])
|
|
|
111 |
|
112 |
## explainability plots
|
113 |
rf_model = model.steps[-1][1]
|
114 |
+
|
115 |
+
explainer = shap.TreeExplainer(
|
116 |
+
rf_model, model_output="raw", feature_perturbation="tree_path_dependent"
|
117 |
+
)
|
118 |
shap_values = explainer(df)
|
119 |
+
|
120 |
print(shap_values.shape) # should now show (1, 4)
|
121 |
|
122 |
shap_waterfall_plot = shap.plots.waterfall(shap_values[0])
|