From f2cfa2603fc64e96db671f75f7ff6cbe519073e7 Mon Sep 17 00:00:00 2001 From: MaximeLecardonnel6x7 Date: Thu, 13 Feb 2025 14:41:52 +0100 Subject: [PATCH] Update template explainability. --- shapash/report/html/explainability.html | 85 +++++++++++++++---------- 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/shapash/report/html/explainability.html b/shapash/report/html/explainability.html index 51a70292..a490a45e 100644 --- a/shapash/report/html/explainability.html +++ b/shapash/report/html/explainability.html @@ -1,48 +1,65 @@ {% if labels|length > 1 %} - {% with menuId='dropdownMenuLabel', menuText='Response', values=labels, menuDivVisible='explain-all' %} - {% include "dropdown.html" %} - {% endwith %} +{% with menuId='dropdownMenuLabel', menuText='Response', values=labels, menuDivVisible='explain-all' %} +{% include "dropdown.html" %} +{% endwith %} {% else %} {% endif %}

Global feature importance plot

{% for label in labels %} -
- {{ label['feature_importance_plot'] }} -
+
+ {{ label['feature_importance_plot'] }} +
{% endfor %}

Features contribution plots

{% for label in labels %} -
- {% with menuId='dropdownMenu2', menuText='Feature', values=label['features'], menuDivVisible='explain-contrib-'~label['index'] %} - {% include "dropdown.html" %} - {% endwith %} - {% for col in label['features'] %} -
-

{{ col['name'] }} - {{ col['type'] }}

- {% if col['name'] != col['description'] %} -
{{ col['description'] }}
- {% else %} - {% endif %} - {{ col['plot'] }} -
- {% endfor %} +
+ {% with menuId='dropdownMenu2', menuText='Feature', values=label['features'], + menuDivVisible='explain-contrib-'~label['index'] %} + {% include "dropdown.html" %} + {% endwith %} + {% for col in label['features'] %} +
+

{{ col['name'] }} - {{ col['type'] }}

+ {% if col['name'] != col['description'] %} +
{{ col['description'] }}
+ {% else %} + {% endif %} + {{ col['plot'] }}
+ {% endfor %} +
{% endfor %} +{% set has_interaction = false %} +{% for label in labels %} +{% if label['features_interaction']|length > 0 %} +{% set has_interaction = true %} +{% endif %} +{% endfor %} + +{% if has_interaction %}

Features Top Interaction plots

{% for label in labels %} -
- {% with menuId='dropdownMenu3', menuText='Interactions', values=label['features_interaction'], menuDivVisible='explain-contrib-interaction-'~label['index'] %} - {% include "dropdown.html" %} - {% endwith %} - {% for col in label['features_interaction'] %} -
-

{{ col['name'] }} - {{ col['type'] }}

- {% if col['name'] != col['description'] %} -
{{ col['description'] }}
- {% else %} - {% endif %} - {{ col['plot'] }} -
- {% endfor %} +{% if label['features_interaction']|length > 0 %} +
+ {% with menuId='dropdownMenu3', menuText='Interactions', values=label['features_interaction'], + menuDivVisible='explain-contrib-interaction-'~label['index'] %} + {% include "dropdown.html" %} + {% endwith %} + {% for col in label['features_interaction'] %} +
+

{{ col['name'] }} - {{ col['type'] }}

+ {% if col['name'] != col['description'] %} +
{{ col['description'] }}
+ {% endif %} + {{ col['plot'] }}
+ {% endfor %} +
+{% endif %} {% endfor %} +{% endif %}