Spaces:
Runtime error
Runtime error
shap
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ with gr.Blocks() as demo:
|
|
54 |
output = gr.Text(label="Model prediction")
|
55 |
plot = gr.Plot()
|
56 |
with gr.Row():
|
57 |
-
with gr.Accordion("See model explanability"):
|
58 |
waterfall_plot = gr.Plot()
|
59 |
|
60 |
def submit_inputs(
|
@@ -111,8 +111,10 @@ with gr.Blocks() as demo:
|
|
111 |
|
112 |
## explainability plots
|
113 |
rf_model = model.steps[-1][1]
|
|
|
114 |
explainer = shap.Explainer(rf_model)
|
115 |
shap_values = explainer(df)
|
|
|
116 |
shap_waterfall_plot = shap.plots.waterfall(shap_values[0])
|
117 |
|
118 |
## save user's data in hopsworks
|
|
|
54 |
output = gr.Text(label="Model prediction")
|
55 |
plot = gr.Plot()
|
56 |
with gr.Row():
|
57 |
+
with gr.Accordion("See model explanability", open=False):
|
58 |
waterfall_plot = gr.Plot()
|
59 |
|
60 |
def submit_inputs(
|
|
|
111 |
|
112 |
## explainability plots
|
113 |
rf_model = model.steps[-1][1]
|
114 |
+
print("model: ", rf_model)
|
115 |
explainer = shap.Explainer(rf_model)
|
116 |
shap_values = explainer(df)
|
117 |
+
print(shap_values.shape) # should show (num_samples, 1)
|
118 |
shap_waterfall_plot = shap.plots.waterfall(shap_values[0])
|
119 |
|
120 |
## save user's data in hopsworks
|