docstr: Build the LIME text explainer
  For now, the parameters used to instantiate this class are exactly those of
  lime.lime_text.LimeTextExplainer. Original documentation can be found here:
  https://lime-ml.readthedocs.io/en/latest/lime.html#lime.lime_text.LimeTextExplainer
  
  Args:
      predict_fn (Callable): A function that takes in a 1D numpy array and outputs a vector
          of probabilities which should sum to 1.
      kernel_width (float): Width of the exponential kernel used in the LIME loss function
      verbose (bool): Control verbosity. If true, local prediction values of the LIME model
          are printed
      class_names (list): Class names (positional index corresponding to class index)
      feature_selection (str): Feature selection method. See original docs for more details
      split_expression (str): Regex expression for splitting the text
      bow (bool):  if True (bag of words), will perturb input data by removing all ocurrences of
          individual words. Explanations will be in terms of these words. Otherwise,
          will explain in terms of word-positions, so that a word may be important the
          first time it appears and unimportant the second. Only set to false if the
          classifier uses word order in some way (bigrams, etc).
  
  Returns:
      None
docstr_tok: ["Build","the","LIME","text","explainer","For","now",",","the","parameters","used","to","instantiate","this","class","are","exactly","those","of","lime.lime_text.LimeTextExplainer",".","Original","documentation","can","be","found","here",":","https",":","\/\/lime-ml.readthedocs.io\/en\/latest\/lime.html","#","lime.lime_text.LimeTextExplainer","Args",":","predict_fn","(","Callable",")",":","A","function","that","takes","in","a","1D","numpy","array","and","outputs","a","vector","of","probabilities","which","should","sum","to","1.","kernel_width","(","float",")",":","Width","of","the","exponential","kernel","used","in","the","LIME","loss","function","verbose","(","bool",")",":","Control","verbosity",".","If","true",",","local","prediction","values","of","the","LIME","model","are","printed","class_names","(","list",")",":","Class","names","(","positional","index","corresponding","to","class","index",")","feature_selection","(","str",")",":","Feature","selection","method",".","See","original","docs","for","more","details","split_expression","(","str",")",":","Regex","expression","for","splitting","the","text","bow","(","bool",")",":","if","True","(","bag","of","words",")",",","will","perturb","input","data","by","removing","all","ocurrences","of","individual","words",".","Explanations","will","be","in","terms","of","these","words",".","Otherwise",",","will","explain","in","terms","of","word-positions",",","so","that","a","word","may","be","important","the","first","time","it","appears","and","unimportant","the","second",".","Only","set","to","false","if","the","classifier","uses","word","order","in","some","way","(","bigrams",",","etc",")",".","Returns",":","None"]
code: def build_explainer(
      self,
      predict_fn: Callable[[np.ndarray], np.ndarray],
      kernel_width: float = 25,
      verbose: bool = False,
      class_names: Optional[List[str]] = None,
      feature_selection: str = "auto",
      split_expression: str = "\W+",
      bow: bool = True,
      **kwargs,
  ):
      """
      Build the LIME text explainer
      For now, the parameters used to instantiate this class are exactly those of
      lime.lime_text.LimeTextExplainer. Original documentation can be found here:
      https://lime-ml.readthedocs.io/en/latest/lime.html#lime.lime_text.LimeTextExplainer
  
      Args:
          predict_fn (Callable): A function that takes in a 1D numpy array and outputs a vector
              of probabilities which should sum to 1.
          kernel_width (float): Width of the exponential kernel used in the LIME loss function
          verbose (bool): Control verbosity. If true, local prediction values of the LIME model
              are printed
          class_names (list): Class names (positional index corresponding to class index)
          feature_selection (str): Feature selection method. See original docs for more details
          split_expression (str): Regex expression for splitting the text
          bow (bool):  if True (bag of words), will perturb input data by removing all ocurrences of
              individual words. Explanations will be in terms of these words. Otherwise,
              will explain in terms of word-positions, so that a word may be important the
              first time it appears and unimportant the second. Only set to false if the
              classifier uses word order in some way (bigrams, etc).
  
      Returns:
          None
      """
      self.predict_fn = predict_fn
      self.explainer_object = OriginalLimeTextExplainer(
          kernel_width=kernel_width,
          verbose=verbose,
          class_names=class_names,
          feature_selection=feature_selection,
          split_expression=split_expression,
          bow=bow,
      )
  
      if verbose:
          warnings.warn(message="Explainer built successfully!")
  
file_path: contextual-ai/xai/explainer/text/lime_text_explainer.py
imports: import warnings
  from typing import List, Optional, Callable, Dict
  import dill
  import numpy
  from lime.lime_text import LimeTextExplainer
  from ..abstract_explainer import AbstractExplainer
  from ..explainer_exceptions import ExplainerUninitializedError
  from ..utils import explanation_to_json
  from ..constants import MODE
label_desc: Use image node_id 2 for calling the LimeTextExplainer obj's underlying member method code with example usage: obj.build_explainer(predict_fn, kernel_width, verbose, class_names, feature_selection, split_expression, bow) without return types