class_docstr: ``BaseBackend`` is the base class for all backends.
  All explainability implementations should extend this abstract class
  and implement the methods marked as abstract.
docstr: Get local contributions using the explainer data computed in the `run_explainer`
  method.
  
  It applies some aggregations and transformations to the result of the `run_explainer` method
  if needed. For example, if there are some one-hot-encoded columns, it automatically checks
  and applies aggregations depending on the result of `_run_explainer` and the `preprocessing`
  (encoder).
  
  Parameters
  ----------
  x : pd.DataFrame
      The dataframe of observations used by the model.
  explain_data : dict
      The data computed in the `run_explainer` method.
  subset : list
      list of indices on which to get local contributions.
  
  Returns
  -------
  local_contributions : pd.DataFrame
      The local contributions computed by the backend.
docstr_tok: ["Get","local","contributions","using","the","explainer","data","computed","in","the","`","run_explainer","`","method",".","It","applies","some","aggregations","and","transformations","to","the","result","of","the","`","run_explainer","`","method","if","needed",".","For","example",",","if","there","are","some","one-hot-encoded","columns",",","it","automatically","checks","and","applies","aggregations","depending","on","the","result","of","`","_run_explainer","`","and","the","`","preprocessing","`","(","encoder",")",".","Parameters","--","--","--","--","--","x",":","pd.DataFrame","The","dataframe","of","observations","used","by","the","model",".","explain_data",":","dict","The","data","computed","in","the","`","run_explainer","`","method",".","subset",":","list","list","of","indices","on","which","to","get","local","contributions",".","Returns","--","--","--","-","local_contributions",":","pd.DataFrame","The","local","contributions","computed","by","the","backend","."]
code: def get_local_contributions(
      self,
      x: pd.DataFrame,
      explain_data: Any,
      subset: Optional[List[int]] = None,
  ) -> Union[pd.DataFrame, List[pd.DataFrame]]:
      """Get local contributions using the explainer data computed in the `run_explainer`
      method.
  
      It applies some aggregations and transformations to the result of the `run_explainer` method
      if needed. For example, if there are some one-hot-encoded columns, it automatically checks
      and applies aggregations depending on the result of `_run_explainer` and the `preprocessing`
      (encoder).
  
      Parameters
      ----------
      x : pd.DataFrame
          The dataframe of observations used by the model.
      explain_data : dict
          The data computed in the `run_explainer` method.
      subset : list
          list of indices on which to get local contributions.
  
      Returns
      -------
      local_contributions : pd.DataFrame
          The local contributions computed by the backend.
      """
      assert isinstance(
          explain_data, dict
      ), "The _run_explainer method should return a dict"
      if "contributions" not in explain_data.keys():
          raise ValueError(
              "The _run_explainer method should return a dict"
              " with at least `contributions` key containing "
              "the local contributions"
          )
  
      local_contributions = explain_data["contributions"]
      if subset is not None:
          local_contributions = local_contributions.loc[subset]
      local_contributions = (
          self.format_and_aggregate_local_contributions(
              x, local_contributions
          )
      )
      return local_contributions
  
file_path: shapash/shapash/backend/base_backend.py
imports: from abc import ABC, abstractmethod
  from typing import Any, List, Optional, Union
  import pandas
  import numpy
  from shapash.utils.check import check_model, check_contribution_object
  from shapash.utils.transform import adapt_contributions, get_preprocessing_mapping
  from shapash.utils.utils import choose_state
label_desc: Use image node_id 3 for calling the BaseBackend obj's underlying member method code with example usage: obj.get_local_contributions(x, explain_data, subset) and returns: local_contributions