def summary_plot(
        self,
        horizons: Optional[Union[int, Sequence[int]]] = None,
        target_components: Optional[Union[str, Sequence[str]]] = None,
        num_samples: Optional[int] = None,
        plot_type: Optional[str] = "dot",
        **kwargs,
    ) -> dict[int, dict[str, shap.Explanation]]:
        """
        Display a shap plot summary for each horizon and each component dimension of the target.
        This method reuses the initial background data as foreground (potentially sampled) to give a general importance
        plot for each feature.
        If no target names and/or no horizons are provided, all summary plots are produced.

        Parameters
        ----------
        horizons
            Optionally, an integer or sequence of integers representing which points/steps in the future to explain,
            starting from the first prediction step at 1. `horizons` must `<=output_chunk_length` of the forecasting
            model.
        target_components
            Optionally, a string or sequence of strings with the target components to explain.
        num_samples
            Optionally, an integer for sampling the foreground series (based on the background),
            for the sake of performance.
        plot_type
            Optionally, specify which of the shap library plot type to use. Can be one of ``'dot', 'bar', 'violin'``.

        Returns
        -------
        shaps_
            A nested dictionary {horizon : {component : shap.Explanation}} containing the raw Explanations for all
            the horizons and components.
        """

        horizons, target_components = self._process_horizons_and_targets(
            horizons, target_components
        )

        if num_samples:
            foreground_X_sampled = shap.utils.sample(
                self.explainers.background_X, num_samples
            )
        else:
            foreground_X_sampled = self.explainers.background_X

        shaps_ = self.explainers.shap_explanations(
            foreground_X_sampled, horizons, target_components
        )

        for t in target_components:
            for h in horizons:
                plt.title(
                    "Target: `{}` - Horizon: {}".format(
                        t, "t+" + str(h + self.model.output_chunk_shift)
                    )
                )
                shap.summary_plot(
                    shaps_[h][t],
                    foreground_X_sampled,
                    plot_type=plot_type,
                    **kwargs,
                )
        return shaps_

        Display a shap plot summary for each horizon and each component dimension of the target.
        This method reuses the initial background data as foreground (potentially sampled) to give a general importance
        plot for each feature.
        If no target names and/or no horizons are provided, all summary plots are produced.

        Parameters
        ----------
        horizons
            Optionally, an integer or sequence of integers representing which points/steps in the future to explain,
            starting from the first prediction step at 1. `horizons` must `<=output_chunk_length` of the forecasting
            model.
        target_components
            Optionally, a string or sequence of strings with the target components to explain.
        num_samples
            Optionally, an integer for sampling the foreground series (based on the background),
            for the sake of performance.
        plot_type
            Optionally, specify which of the shap library plot type to use. Can be one of ``'dot', 'bar', 'violin'``.

        Returns
        -------
        shaps_
            A nested dictionary {horizon : {component : shap.Explanation}} containing the raw Explanations for all
            the horizons and components.
        
darts/explainability/shap_explainer.py