Skip to content

Add a contribution-weighted correlation plot - #754

Open
guillaume-vignal wants to merge 1 commit into
MAIF:masterfrom
guillaume-vignal:feature/contribution-weighted-correlation-plot
Open

Add a contribution-weighted correlation plot#754
guillaume-vignal wants to merge 1 commit into
MAIF:masterfrom
guillaume-vignal:feature/contribution-weighted-correlation-plot

Conversation

@guillaume-vignal

@guillaume-vignal guillaume-vignal commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes #753

Summary

This PR adds a new correlation heatmap based on feature contributions, alongside the existing feature-correlation plot.

The goal is to visualize relationships between contributions rather than between raw input variables, making it easier to inspect how explanation signals behave across features.

image

How the matrix is computed

For each pair of contribution columns, Shapash computes a weighted correlation on the aligned samples:

  • missing contribution values are treated as 0
  • each sample is weighted by the maximum absolute contribution of the two features for that row
  • the result is a symmetric correlation matrix, with the diagonal equal to 1
  • values are clipped to stay in the [-1, 1] interval

In practice, this gives more importance to rows where at least one of the two contributions is strong, while keeping the same visual and clustering logic as correlations_plot.

@guillaume-vignal guillaume-vignal self-assigned this Aug 28, 2026
@guillaume-vignal guillaume-vignal added the enhancement New feature or request label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a contribution-weighted correlation plot

1 participant