docstr: perturbation_model: What perturbation strategy to use, e.g. removal or infilling
  partition_fn: How to partition the input
  partition_kwargs: Extra kwargs to the partition function, e.g. n to specify ngrams
  See the partition function below for the potential args
docstr_tok: ["perturbation_model",":","What","perturbation","strategy","to","use",",","e.g",".","removal","or","infilling","partition_fn",":","How","to","partition","the","input","partition_kwargs",":","Extra","kwargs","to","the","partition","function",",","e.g",".","n","to","specify","ngrams","See","the","partition","function","below","for","the","potential","args"]
code: def __init__(
      self,
      perturbation_model="removal",
      partition_fn="sentences",
      partition_kwargs={},
      progress_bar=None,
  ):
      """
      perturbation_model: What perturbation strategy to use, e.g. removal or infilling
      partition_fn: How to partition the input
      partition_kwargs: Extra kwargs to the partition function, e.g. n to specify ngrams
      See the partition function below for the potential args
      """
      self.partition_fn = partition_fn
      self.partition_kwargs = partition_kwargs
      # Dry test
      self.partition("Dummy")
      if perturbation_model == "removal":
          self.perturbation_model = RemovalPerturbation()
      else:
          raise NotImplementedError()
      if progress_bar is None:
  
          def progress_bar(x):
              return x
  
      self.progress_bar = progress_bar
  
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 LocalExplanations object from inherited base classes: ABC with example: obj = LocalExplanations(perturbation_model, partition_fn, partition_kwargs, progress_bar)