Skip to content

Docstring update for interpretability #261

Open
dianaprior wants to merge 1 commit intomainfrom
docstr-update
Open

Docstring update for interpretability #261
dianaprior wants to merge 1 commit intomainfrom
docstr-update

Conversation

@dianaprior
Copy link
Copy Markdown

The docstring was wrong in describing the function output type.

@dianaprior dianaprior requested a review from a team as a code owner April 8, 2026 11:54
@dianaprior dianaprior requested review from bejaeger and removed request for a team April 8, 2026 11:54
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the docstring for the get_shap_values function to accurately reflect that it returns a shap.Explanation object. However, the type hints for the return values of get_shap_values and get_shap, as well as the input type hint for plot_shap, remain set to np.ndarray. These should be updated to shap.Explanation to maintain consistency and ensure accurate static analysis.


Returns:
np.ndarray: The computed SHAP values with shape (n_samples, n_features).
shap.Explanation: The SHAP explanation object returned by the configured explainer.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The docstring update correctly identifies the return type as shap.Explanation. However, several type hints in this file are now inconsistent with this change: the return type hint for get_shap_values (line 191), the return type hint for the inner get_shap (line 228), and the input type hint for plot_shap (line 115) all still specify np.ndarray. These should be updated to shap.Explanation (or Any) to ensure consistency across the module and avoid misleading static analysis tools. Note that since shap is imported locally, you may need to use string literals (e.g., "shap.Explanation") or TYPE_CHECKING to avoid runtime errors.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants