Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JochenSiegWork committed Aug 30, 2024
1 parent d956cef commit 6d5c2ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion molpipeline/explainability/explanation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ class SHAPExplanation(Explanation):
This Explanation holds additional information only present in SHAP explanations.
"""

expected_value: npt.NDArray[np.float64] = np.nan
expected_value: npt.NDArray[np.float64] | None = None
8 changes: 6 additions & 2 deletions molpipeline/explainability/visualization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ def structure_heatmap_shap(
raise ValueError("SHAPExplanation does not contain feature weights.")
if explanation.feature_vector is None:
raise ValueError("SHAPExplanation does not contain feature_vector.")
if explanation.expected_value is None:
raise ValueError("SHAPExplanation does not contain expected value.")
if explanation.prediction is None:
raise ValueError("SHAPExplanation does not contain prediction.")
if explanation.molecule is None:
raise ValueError("SHAPExplanation does not contain molecule.")
if explanation.atom_weights is None:
Expand All @@ -418,7 +422,7 @@ def structure_heatmap_shap(
sum_present_shap = sum(present_shap)
sum_absent_shap = sum(absent_shap)

drawer, value_grid, color_grid, normalizer, color_map = _structure_heatmap(
drawer, _, _, normalizer, color_map = _structure_heatmap(
explanation.molecule,
explanation.atom_weights,
color=color,
Expand Down Expand Up @@ -450,7 +454,7 @@ def structure_heatmap_shap(
f"$P(y=1|X) = {explanation.prediction[1]:.2f}$ ="
"\n"
"\n"
f" $expected \ value={explanation.expected_value[1]:.2f}$ + " # noqa: W605
f" $expected \ value={explanation.expected_value[1]:.2f}$ + " # noqa: W605 # pylint: disable=W1401
f"$features_{{present}}= {sum_present_shap:.2f}$ + "
f"$features_{{absent}}={sum_absent_shap:.2f}$"
)
Expand Down

0 comments on commit 6d5c2ae

Please sign in to comment.