Visualization¶
Token attribution visualization plugins.
- nlp_shap.viz.display_attribution_html(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, title: str | None = None) Any[source]¶
Display colored token HTML when IPython is available.
- nlp_shap.viz.render_attribution(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, renderer: str = 'token_text', title: str | None = None, registry: PluginRegistry | None = None) Figure[source]¶
Render
outputattributions with a registered renderer plugin.
- nlp_shap.viz.render_attribution_html(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, title: str | None = None) str[source]¶
Return an HTML fragment for inline token coloring in Jupyter.
Public helpers for attribution visualization.
- nlp_shap.viz.render.render_attribution(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, renderer: str = 'token_text', title: str | None = None, registry: PluginRegistry | None = None) Figure[source]¶
Render
outputattributions with a registered renderer plugin.
- nlp_shap.viz.render.render_attribution_html(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, title: str | None = None) str[source]¶
Return an HTML fragment for inline token coloring in Jupyter.
- nlp_shap.viz.render.display_attribution_html(output: ExplainRunOutput, snapshot: ConversationSnapshot, player_set: PlayerSet, *, title: str | None = None) Any[source]¶
Display colored token HTML when IPython is available.
SHAP-style inline colored token attribution renderer.
- class nlp_shap.viz.token_text.TokenTextRenderer[source]¶
Bases:
objectRender attributions as inline colored tokens.
Horizontal bar chart renderer for token attributions.
- class nlp_shap.viz.token_bar.TokenBarRenderer[source]¶
Bases:
objectRender attributions as a SHAP-style horizontal bar chart.
Attribution renderer protocol.