From b93a376ed75fbb35c5040ee639f507418fad2164 Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Fri, 3 Jan 2025 11:27:35 +0100 Subject: [PATCH] Enhance error message --- baybe/insights/shap.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/baybe/insights/shap.py b/baybe/insights/shap.py index 3f30b8c65..526a00462 100644 --- a/baybe/insights/shap.py +++ b/baybe/insights/shap.py @@ -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", } @@ -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: @@ -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)