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: Helper that extracts and returns the explainability result attribute for a specified horizon and component from
  the input attribute.
  
  Parameters
  ----------
  attr
      An explainability result attribute from which to extract the content for a certain horizon and component.
  horizon
      The horizon for which to return the content of the attribute.
  component
      The component for which to return the content of the attribute. Does not
      need to be specified for univariate series.
docstr_tok: ["Helper","that","extracts","and","returns","the","explainability","result","attribute","for","a","specified","horizon","and","component","from","the","input","attribute",".","Parameters","--","--","--","--","--","attr","An","explainability","result","attribute","from","which","to","extract","the","content","for","a","certain","horizon","and","component",".","horizon","The","horizon","for","which","to","return","the","content","of","the","attribute",".","component","The","component","for","which","to","return","the","content","of","the","attribute",".","Does","not","need","to","be","specified","for","univariate","series","."]
code: def _query_explainability_result(
      self,
      attr: Union[
          Dict[int, Dict[str, Any]], List[Dict[int, Dict[str, Any]]]
      ],
      horizon: int,
      component: Optional[str] = None,
  ) -> Any:
      """
      Helper that extracts and returns the explainability result attribute for a specified horizon and component from
      the input attribute.
  
      Parameters
      ----------
      attr
          An explainability result attribute from which to extract the content for a certain horizon and component.
      horizon
          The horizon for which to return the content of the attribute.
      component
          The component for which to return the content of the attribute. Does not
          need to be specified for univariate series.
      """
      component = (
          self._validate_input_for_querying_explainability_result(
              horizon, component
          )
      )
  
      if isinstance(attr, list):
          return [attr[i][horizon][component] for i in range(len(attr))]
      elif all(isinstance(key, int) for key in attr.keys()):
          return attr[horizon][component]
      else:
          raise_log(
              ValueError(
                  f"Something went wrong. {self.__class__.__name__} got instantiated with an unexpected type."
              ),
              logger,
          )
  
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 3 for calling the HorizonBasedExplainabilityResult obj's underlying member method code with example usage: obj._query_explainability_result(attr, horizon, component) and returns: unknown, attr