Skip to content

Commit

Permalink
Enhance error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Scienfitz committed Jan 3, 2025
1 parent a6eef09 commit b93a376
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions baybe/insights/shap.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def _has_required_init_parameters(cls):
ALL_EXPLAINERS = SHAP_EXPLAINERS | NON_SHAP_EXPLAINERS
SUPPORTED_SHAP_PLOTS = {
"bar",
"scatter",
"heatmap",
"force",
"beeswarm",
"force",
"heatmap",
"scatter",
}


Expand Down Expand Up @@ -354,7 +354,7 @@ def plot(self, plot_type: str, **kwargs: dict) -> None:
Args:
plot_type: The type of plot to be created. Supported types are:
"bar", "scatter", "heatmap", "force", "beeswarm".
"bar", "beeswarm", "force", "heatmap", "scatter".
**kwargs: Additional keyword arguments to be passed to the plot function.
Raises:
Expand All @@ -370,7 +370,10 @@ def plot(self, plot_type: str, **kwargs: dict) -> None:
or (plot is None)
or (not callable(plot))
):
raise ValueError(f"Invalid plot type: '{plot_type}'.")
raise ValueError(
f"Invalid plot type: '{plot_type}'. Available options: "
f"{SUPPORTED_SHAP_PLOTS}."
)

plot(self.explanation, **kwargs)

Expand Down

0 comments on commit b93a376

Please sign in to comment.