code: def test_creation(self):
      model_cls = LightGBMModel if lgbm_available else XGBModel
      # Model should be fitted first
      m = model_cls(
          lags=4,
          lags_past_covariates=[-1, -2, -3],
          lags_future_covariates=[0],
          output_chunk_length=4,
          add_encoders=self.add_encoders,
      )
      with pytest.raises(ValueError):
          ShapExplainer(
              m, self.target_ts, self.past_cov_ts, self.fut_cov_ts
          )
  
      # Model should be a RegressionModel
      m = ExponentialSmoothing()
      m.fit(self.target_ts["price"])
      with pytest.raises(ValueError):
          ShapExplainer(m)
  
      # For now, multi_models=False not allowed
      m = LinearRegressionModel(
          lags=1, output_chunk_length=2, multi_models=False
      )
      m.fit(
          series=self.target_ts,
      )
      with pytest.raises(ValueError):
          ShapExplainer(
              m,
              self.target_ts,
          )
  
      m = model_cls(
          lags=4,
          lags_past_covariates=[-1, -2, -3],
          lags_future_covariates=[0],
          output_chunk_length=4,
          add_encoders=self.add_encoders,
      )
  
      m.fit(
          series=self.target_ts,
          past_covariates=self.past_cov_ts,
          future_covariates=self.fut_cov_ts,
      )
  
      # Should have the same number of target, past and futures in the respective lists
      with pytest.raises(ValueError):
          ShapExplainer(
              m,
              [self.target_ts, self.target_ts],
              self.past_cov_ts,
              self.fut_cov_ts,
          )
  
      # Missing a future covariate if you choose to use a new background
      with pytest.raises(ValueError):
          ShapExplainer(
              m,
              self.target_ts,
              background_past_covariates=self.past_cov_ts,
          )
  
      # Missing a past covariate if you choose to use a new background
      with pytest.raises(ValueError):
          ShapExplainer(
              m,
              self.target_ts,
              background_future_covariates=self.fut_cov_ts,
          )
  
      # Good type of explainers
      shap_explain = ShapExplainer(m)
      assert isinstance(
          shap_explain.explainers.explainers[0][0], shap.explainers.Tree
      )
  
      # Linear model - also not a MultiOutputRegressor
      m = LinearRegressionModel(
          lags=1,
          lags_past_covariates=[-1, -2, -3],
          lags_future_covariates=[0],
          output_chunk_length=2,
      )
      m.fit(
          series=self.target_ts,
          past_covariates=self.past_cov_ts,
          future_covariates=self.fut_cov_ts,
      )
      shap_explain = ShapExplainer(m)
      assert isinstance(
          shap_explain.explainers.explainers, shap.explainers.Linear
      )
  
      # ExtraTreesRegressor - also not a MultiOutputRegressor
      m = RegressionModel(
          lags=4,
          lags_past_covariates=[-1, -2, -3],
          lags_future_covariates=[0],
          output_chunk_length=2,
          model=sklearn.tree.ExtraTreeRegressor(),
      )
      m.fit(
          series=self.target_ts,
          past_covariates=self.past_cov_ts,
          future_covariates=self.fut_cov_ts,
      )
      shap_explain = ShapExplainer(m)
      assert isinstance(
          shap_explain.explainers.explainers, shap.explainers.Tree
      )
  
      # No past or future covariates
      m = LinearRegressionModel(
          lags=1,
          output_chunk_length=2,
      )
      m.fit(
          series=self.target_ts,
      )
  
      shap_explain = ShapExplainer(m)
      assert isinstance(
          shap_explain.explainers.explainers, shap.explainers.Linear
      )
  
      # CatBoost
      model_cls = CatBoostModel if cb_available else XGBModel
      m = model_cls(
          lags=4,
          lags_past_covariates=[-1, -2, -6],
          lags_future_covariates=[0],
          output_chunk_length=4,
      )
      m.fit(
          series=self.target_ts,
          past_covariates=self.past_cov_ts,
          future_covariates=self.fut_cov_ts,
      )
      shap_explain = ShapExplainer(m)
      assert isinstance(
          shap_explain.explainers.explainers[0][0], shap.explainers.Tree
      )
  
      # Bad choice of shap explainer
      with pytest.raises(ValueError):
          ShapExplainer(m, shap_method="bad_choice")
  
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 1 for calling the TestShapExplainer obj's underlying member method code with example usage: obj.test_creation() without return types