Skip to content

feat(plotly): implement shap-summary#2982

Merged
github-actions[bot] merged 4 commits intomainfrom
implementation/shap-summary/plotly
Dec 31, 2025
Merged

feat(plotly): implement shap-summary#2982
github-actions[bot] merged 4 commits intomainfrom
implementation/shap-summary/plotly

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: shap-summary - plotly

Implements the plotly version of shap-summary.

File: plots/shap-summary/implementations/plotly.py

Parent Issue: #2923


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Dec 31, 2025

AI Review - Attempt 1/3

Image Description

The plot displays a SHAP summary visualization with 15 features on the y-axis, sorted by importance from top (mean radius) to bottom (smoothness error). Each row shows scattered dots representing individual samples, positioned horizontally by their SHAP values ranging from approximately -0.3 to +0.3. The dots are colored using a diverging blue-to-red color scheme (RdBu_r) where blue indicates low feature values and red indicates high feature values. A clear vertical black line at x=0 separates positive and negative SHAP impacts. The title "shap-summary · plotly · pyplots.ai" is centered at the top. A colorbar on the right shows the feature value scale from Low to High. The background is white with subtle gray gridlines.

Quality Score: 91/100

Criteria Checklist

Visual Quality (37/40 pts)

  • VQ-01: Text Legibility (10/10) - Title at 28pt, axis labels at 22pt, tick labels at 16-18pt - all perfectly readable
  • VQ-02: No Overlap (8/8) - No overlapping text, feature names well-spaced on y-axis
  • VQ-03: Element Visibility (7/8) - Markers sized appropriately (size=8) with 0.7 alpha for 200 samples; jittering prevents complete overlap
  • VQ-04: Color Accessibility (5/5) - RdBu_r diverging colorscale is colorblind-friendly
  • VQ-05: Layout Balance (4/5) - Good margins (200px left for feature names), plot uses canvas well but some empty space at bottom
  • VQ-06: Axis Labels (2/2) - Descriptive labels: "SHAP Value (Impact on Model Output)" and "Feature"
  • VQ-07: Grid & Legend (1/2) - Grid is subtle (alpha 0.2), colorbar well-placed, but no traditional legend needed

Spec Compliance (25/25 pts)

  • SC-01: Plot Type (8/8) - Correct SHAP summary beeswarm-style plot
  • SC-02: Data Mapping (5/5) - SHAP values on x-axis, features on y-axis, color by feature value
  • SC-03: Required Features (5/5) - Vertical line at x=0, diverging color scale, sorted by importance, jittering applied
  • SC-04: Data Range (3/3) - All data visible within axes
  • SC-05: Legend Accuracy (2/2) - Colorbar correctly labeled with Low/Medium/High
  • SC-06: Title Format (2/2) - "shap-summary · plotly · pyplots.ai" matches required format

Data Quality (17/20 pts)

  • DQ-01: Feature Coverage (6/8) - Shows positive and negative SHAP values, varying importances, but correlation between feature value and SHAP is somewhat uniform across features
  • DQ-02: Realistic Context (7/7) - Uses breast cancer diagnostic feature names (radius, texture, perimeter, etc.) - realistic ML interpretability scenario
  • DQ-03: Appropriate Scale (4/5) - SHAP values in reasonable -0.3 to +0.3 range, feature values simulated realistically

Code Quality (9/10 pts)

  • CQ-01: KISS Structure (3/3) - Linear script: imports → data → plot → save
  • CQ-02: Reproducibility (3/3) - np.random.seed(42) set
  • CQ-03: Clean Imports (2/2) - Only numpy and plotly.graph_objects used
  • CQ-04: No Deprecated API (0/1) - Using dict syntax instead of go.Layout() is fine, but hovertemplate uses normalized color value instead of actual feature value
  • CQ-05: Output Correct (1/1) - Saves as plot.png and plot.html

Library Features (3/5 pts)

  • LF-01: Uses distinctive library features (3/5) - Uses go.Scatter with custom colorscale, add_vline, interactive hover templates, and HTML export. Could have used animation or subplot features more distinctively.

Strengths

  • Excellent implementation of the SHAP summary visualization concept with proper beeswarm-style jittering
  • Correct blue-to-red diverging colorscale (RdBu_r) for feature values as specified
  • Clear vertical reference line at x=0 separating positive/negative impacts
  • Well-organized code with realistic breast cancer dataset feature names
  • Appropriate marker sizing and transparency for 200 data points
  • Interactive hover templates provide additional information on interaction

Weaknesses

  • Hover template shows normalized feature value (0-1) instead of actual feature values which would be more informative
  • The grid styling is functional but could use slightly more prominent styling for the zero line
  • Feature importance distribution is relatively uniform - could show more dramatic differences between important and less important features

Verdict: APPROVED

@github-actions github-actions Bot added the quality:91 Quality score 91/100 label Dec 31, 2025
@github-actions github-actions Bot added the ai-approved Quality OK, ready for merge label Dec 31, 2025
@github-actions github-actions Bot merged commit eab3951 into main Dec 31, 2025
3 checks passed
@github-actions github-actions Bot deleted the implementation/shap-summary/plotly branch December 31, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge quality:91 Quality score 91/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants