class_docstr: Stores the explainability results of a :class:`_ForecastingModelExplainer
  <darts.explainability.explainability._ForecastingModelExplainer>` with convenient access to the horizon
  based results.
  
  The result is a multivariate `TimeSeries` instance containing the 'explanation' for the (horizon, target_component)
  forecast at any timestamp forecastable corresponding to the foreground `TimeSeries` input.
  
  The component name convention of this multivariate `TimeSeries` is:
  ``"{name}_{type_of_cov}_lag_{idx}"``, where:
  
  - ``{name}`` is the component name from the original foreground series (target, past, or future).
  - ``{type_of_cov}`` is the covariates type. It can take 3 different values:
    ``"target"``, ``"past_cov"`` or ``"future_cov"``.
  - ``{idx}`` is the lag index.
  
  Example
  -------
  
  Say we have a model with 2 target components named ``"T_0"`` and ``"T_1"``,
  3 past covariates with default component names ``"0"``, ``"1"``, and ``"2"``,
  and one future covariate with default component name ``"0"``.
  Also, ``horizons = [1, 2]``.
  The model is a regression model, with ``lags = 3``, ``lags_past_covariates=[-1, -3]``,
  ``lags_future_covariates = [0]``.
  
  We provide `foreground_series`, `foreground_past_covariates`, `foreground_future_covariates` each of length 5.
  
  >>> explainer = SomeHorizonBasedExplainer(model)
  >>> explain_results = explainer.explain(
  >>>     foreground_series=foreground_series,
  >>>     foreground_past_covariates=foreground_past_covariates,
  >>>     foreground_future_covariates=foreground_future_covariates,
  >>>     horizons=[1, 2],
  >>>     target_names=["T_0", "T_1"]
  >>> )
  >>> output = explain_results.get_explanation(horizon=1, target="T_1")
  
  Then the method returns a multivariate TimeSeries containing the *explanations* of
  the corresponding `_ForecastingModelExplainer`, with the following component names:
  
       - T_0_target_lag-1
       - T_0_target_lag-2
       - T_0_target_lag-3
       - T_1_target_lag-1
       - T_1_target_lag-2
       - T_1_target_lag-3
       - 0_past_cov_lag-1
       - 0_past_cov_lag-3
       - 1_past_cov_lag-1
       - 1_past_cov_lag-3
       - 2_past_cov_lag-1
       - 2_past_cov_lag-3
       - 0_fut_cov_lag_0
  
  This series has length 3, as the model can explain 5-3+1 forecasts
  (timestamp indexes 4, 5, and 6)
class_docstr_tok: ["Stores","the","explainability","results","of","a",":","class",":","`","_ForecastingModelExplainer","<","darts.explainability.explainability._ForecastingModelExplainer",">","`","with","convenient","access","to","the","horizon","based","results",".","The","result","is","a","multivariate","`","TimeSeries","`","instance","containing","the","'explanation","'","for","the","(","horizon",",","target_component",")","forecast","at","any","timestamp","forecastable","corresponding","to","the","foreground","`","TimeSeries","`","input",".","The","component","name","convention","of","this","multivariate","`","TimeSeries","`","is",":","``","``","{","name","}","_","{","type_of_cov","}","_lag_","{","idx","}","''","``",",","where",":","-","``","{","name","}","``","is","the","component","name","from","the","original","foreground","series","(","target",",","past",",","or","future",")",".","-","``","{","type_of_cov","}","``","is","the","covariates","type",".","It","can","take","3","different","values",":","``","``","target","''","``",",","``","``","past_cov","''","``","or","``","``","future_cov","''","``",".","-","``","{","idx","}","``","is","the","lag","index",".","Example","--","--","--","-","Say","we","have","a","model","with","2","target","components","named","``","``","T_0","''","``","and","``","``","T_1","''","``",",","3","past","covariates","with","default","component","names","``","``","0","''","``",",","``","``","1","''","``",",","and","``","``","2","''","``",",","and","one","future","covariate","with","default","component","name","``","``","0","''","``",".","Also",",","``","horizons","=","[","1",",","2","]","``",".","The","model","is","a","regression","model",",","with","``","lags","=","3","``",",","``","lags_past_covariates=","[","-1",",","-3","]","``",",","``","lags_future_covariates","=","[","0","]","``",".","We","provide","`","foreground_series","`",",","`","foreground_past_covariates","`",",","`","foreground_future_covariates","`","each","of","length","5",".",">",">",">","explainer","=","SomeHorizonBasedExplainer","(","model",")",">",">",">","explain_results","=","explainer.explain","(",">",">",">","foreground_series=foreground_series",",",">",">",">","foreground_past_covariates=foreground_past_covariates",",",">",">",">","foreground_future_covariates=foreground_future_covariates",",",">",">",">","horizons=","[","1",",","2","]",",",">",">",">","target_names=","[","``","T_0","''",",","``","T_1","''","]",">",">",">",")",">",">",">","output","=","explain_results.get_explanation","(","horizon=1",",","target=","''","T_1","''",")","Then","the","method","returns","a","multivariate","TimeSeries","containing","the","*","explanations","*","of","the","corresponding","`","_ForecastingModelExplainer","`",",","with","the","following","component","names",":","-","T_0_target_lag-1","-","T_0_target_lag-2","-","T_0_target_lag-3","-","T_1_target_lag-1","-","T_1_target_lag-2","-","T_1_target_lag-3","-","0_past_cov_lag-1","-","0_past_cov_lag-3","-","1_past_cov_lag-1","-","1_past_cov_lag-3","-","2_past_cov_lag-1","-","2_past_cov_lag-3","-","0_fut_cov_lag_0","This","series","has","length","3",",","as","the","model","can","explain","5-3+1","forecasts","(","timestamp","indexes","4",",","5",",","and","6",")"]
docstr: Returns one or several `TimeSeries` representing the explanations
  for a given horizon and component.
  
  Parameters
  ----------
  horizon
      The horizon for which to return the explanation.
  component
      The component for which to return the explanation. Does not
      need to be specified for univariate series.
docstr_tok: ["Returns","one","or","several","`","TimeSeries","`","representing","the","explanations","for","a","given","horizon","and","component",".","Parameters","--","--","--","--","--","horizon","The","horizon","for","which","to","return","the","explanation",".","component","The","component","for","which","to","return","the","explanation",".","Does","not","need","to","be","specified","for","univariate","series","."]
code: def get_explanation(
      self, horizon: int, component: Optional[str] = None
  ) -> Union[TimeSeries, List[TimeSeries]]:
      """
      Returns one or several `TimeSeries` representing the explanations
      for a given horizon and component.
  
      Parameters
      ----------
      horizon
          The horizon for which to return the explanation.
      component
          The component for which to return the explanation. Does not
          need to be specified for univariate series.
      """
      return self._query_explainability_result(
          self.explained_forecasts, horizon, component
      )
  
imports: from abc import ABC, abstractmethod
  from typing import Any, Dict, List, Optional, Union
  import pandas
  import shap
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
label_desc: Use image node_id 2 for calling the HorizonBasedExplainabilityResult obj's underlying member method code with example usage: obj.get_explanation(horizon, component) and returns: self