code: def test_plot(self):
      model_cls = LightGBMModel if lgbm_available else XGBModel
      m_0 = model_cls(
          lags=4,
          lags_past_covariates=[-1, -2, -3],
          lags_future_covariates=[0],
          output_chunk_length=4,
          add_encoders=self.add_encoders,
      )
      m_0.fit(
          series=self.target_ts,
          past_covariates=self.past_cov_ts,
          future_covariates=self.fut_cov_ts,
      )
  
      shap_explain = ShapExplainer(m_0)
  
      # We need at least 5 points for force_plot
      with pytest.raises(ValueError):
          shap_explain.force_plot_from_ts(
              self.target_ts[100:104],
              self.past_cov_ts[100:104],
              self.fut_cov_ts[100:104],
              2,
              "power",
          )
  
      fplot = shap_explain.force_plot_from_ts(
          self.target_ts[100:105],
          self.past_cov_ts[100:105],
          self.fut_cov_ts[100:105],
          2,
          "power",
      )
      assert isinstance(fplot, shap.plots._force.BaseVisualizer)
      plt.close()
  
      # no component name -> multivariate error
      with pytest.raises(ValueError):
          shap_explain.force_plot_from_ts(
              self.target_ts[100:108],
              self.past_cov_ts[100:108],
              self.fut_cov_ts[100:108],
              1,
          )
  
      # fake component
      with pytest.raises(ValueError):
          shap_explain.force_plot_from_ts(
              self.target_ts[100:108],
              self.past_cov_ts[100:108],
              self.fut_cov_ts[100:108],
              2,
              "fake",
          )
  
      # horizon 0
      with pytest.raises(ValueError):
          shap_explain.force_plot_from_ts(
              self.target_ts[100:108],
              self.past_cov_ts[100:108],
              self.fut_cov_ts[100:108],
              0,
              "power",
          )
  
      # Check the dimensions of returned values
      dict_shap_values = shap_explain.summary_plot(show=False)
      # One nested dict per horizon
      assert len(dict_shap_values) == m_0.output_chunk_length
      # Size of nested dict match number of component
      for i in range(1, m_0.output_chunk_length + 1):
          assert len(dict_shap_values[i]) == self.target_ts.width
  
      # Wrong component name
      with pytest.raises(ValueError):
          shap_explain.summary_plot(
              horizons=[1], target_components=["test"]
          )
  
      # Wrong horizon
      with pytest.raises(ValueError):
          shap_explain.summary_plot(
              horizons=[0], target_components=["test"]
          )
      with pytest.raises(ValueError):
          shap_explain.summary_plot(
              horizons=[10], target_components=["test"]
          )
  
      # No past or future covariates
      m = LinearRegressionModel(
          lags=1,
          output_chunk_length=2,
      )
      m.fit(
          series=self.target_ts,
      )
  
      shap_explain = ShapExplainer(m)
      fplot = shap_explain.force_plot_from_ts(
          foreground_series=self.target_ts[100:105],
          horizon=1,
          target_component="power",
      )
      assert isinstance(fplot, shap.plots._force.BaseVisualizer)
      plt.close()
  
imports: import copy
  from datetime import date, timedelta
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  import shap
  import sklearn
  from dateutil.relativedelta import relativedelta
  from numpy.testing import assert_array_equal
  from sklearn.preprocessing import MinMaxScaler
  from darts import TimeSeries
  from darts.dataprocessing.transformers import Scaler
  from darts.explainability.explainability_result import ShapExplainabilityResult
  from darts.explainability.shap_explainer import MIN_BACKGROUND_SAMPLE, ShapExplainer
  from darts.models import CatBoostModel, ExponentialSmoothing, LightGBMModel, LinearRegressionModel, NotImportedModule, RegressionModel, XGBModel
  from darts.utils.timeseries_generation import linear_timeseries
label_desc: Use image node_id 6 for calling the TestShapExplainer obj's underlying member method code with example usage: obj.test_plot() without return types