docstr: partition_hierarchy should contain the hierarchy of partitionings to apply. example:
  [{{"partition_fn":  "n_sentences", "partition_kwargs": {"n": 3}},
  {"partition_fn": "sentences", "partition_kwargs": {}},
  {"partition_fn": "ngrams", "partition_kwargs": {"n": 3}}]
docstr_tok: ["partition_hierarchy","should","contain","the","hierarchy","of","partitionings","to","apply",".","example",":","[","{","{","``","partition_fn","''",":","``","n_sentences","''",",","``","partition_kwargs","''",":","{","``","n","''",":","3","}","}",",","{","``","partition_fn","''",":","``","sentences","''",",","``","partition_kwargs","''",":","{","}","}",",","{","``","partition_fn","''",":","``","ngrams","''",",","``","partition_kwargs","''",":","{","``","n","''",":","3","}","}","]"]
code: def __init__(
      self,
      perturbation_model,
      perturbation_hierarchy,
      step_explainer,
      progress_bar=None,
  ):
      """
      partition_hierarchy should contain the hierarchy of partitionings to apply. example:
      [{{"partition_fn":  "n_sentences", "partition_kwargs": {"n": 3}},
      {"partition_fn": "sentences", "partition_kwargs": {}},
      {"partition_fn": "ngrams", "partition_kwargs": {"n": 3}}]
      """
      self.perturbation_hierarchy = perturbation_hierarchy
      self.perturbation_model = perturbation_model
      self.progress_bar = progress_bar
      self.step_explainer = step_explainer
  
imports: import torch
  import numpy
  from abc import ABC, abstractmethod
  from sklearn.linear_model import Ridge, lars_path
  from .text_utils import *
  from .perturbation_tools import RemovalPerturbation
label_desc: Use image node_id 1 to create a new LocalExplanationHierarchical object from inherited base classes: LocalExplanations with example: obj = LocalExplanationHierarchical(perturbation_model, perturbation_hierarchy, step_explainer, progress_bar)