saad177 commited on
Commit
e086c8c
1 Parent(s): 1938dcf
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -111,9 +111,12 @@ with gr.Blocks() as demo:
111
 
112
  ## explainability plots
113
  rf_model = model.steps[-1][1]
114
- print("model: ", rf_model)
115
- explainer = shap.TreeExplainer(rf_model, model_output="raw")
 
 
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])