class_docstr: The ClassicalTextExplainer for returning explanations for n-gram
  bag-of-words models using sklearn's classifier API.
  Also serves as extensible wrapper with components built to support addition
  of fresh explainers using certain parts of this class.
class_docstr_tok: ["The","ClassicalTextExplainer","for","returning","explanations","for","n-gram","bag-of-words","models","using","sklearn","'s","classifier","API",".","Also","serves","as","extensible","wrapper","with","components","built","to","support","addition","of","fresh","explainers","using","certain","parts","of","this","class","."]
docstr: Initialize the ClassicalTextExplainer
  :param model: Linear models with linear coefs mapped to features or
      tree based models with inbuilt feature_importances that are sklearn
      models or follow the sklearn API.
  :type: sklearn.ensemble or sklearn.linear_model (natively supported)
  :param preprocessor: Custom preprocessor for encoding text into vector
      form. Contains custom parser, vectorizer and tokenizer. Reference
      utils_classical.BOWEncoder for preprocessor's API template.
  :type preprocessor: object
  :param hyperparam_range: Custom hyper parameter range to search over
      when training input model. passed to sklearn's GridsearchCV's
      as param_grid argument.
  :type hyperparam_range: dict
  :param n_jobs: The number of jobs to run in parallel.
      Passed to GridSearchCV. -1 means using all processors.
  :type n_jobs: int
  :param tol: Tolerance for stopping criteria. Default is 1e-4.
  :type tol: float
docstr_tok: ["Initialize","the","ClassicalTextExplainer",":","param","model",":","Linear","models","with","linear","coefs","mapped","to","features","or","tree","based","models","with","inbuilt","feature_importances","that","are","sklearn","models","or","follow","the","sklearn","API",".",":","type",":","sklearn.ensemble","or","sklearn.linear_model","(","natively","supported",")",":","param","preprocessor",":","Custom","preprocessor","for","encoding","text","into","vector","form",".","Contains","custom","parser",",","vectorizer","and","tokenizer",".","Reference","utils_classical.BOWEncoder","for","preprocessor","'s","API","template",".",":","type","preprocessor",":","object",":","param","hyperparam_range",":","Custom","hyper","parameter","range","to","search","over","when","training","input","model",".","passed","to","sklearn","'s","GridsearchCV's","as","param_grid","argument",".",":","type","hyperparam_range",":","dict",":","param","n_jobs",":","The","number","of","jobs","to","run","in","parallel",".","Passed","to","GridSearchCV",".","-1","means","using","all","processors",".",":","type","n_jobs",":","int",":","param","tol",":","Tolerance","for","stopping","criteria",".","Default","is","1e-4",".",":","type","tol",":","float"]
code: def __init__(
      self,
      preprocessor=None,
      model=None,
      hyperparam_range=None,
      is_trained=False,
      n_jobs=None,
      tol=0.0001,
  ):
      """Initialize the ClassicalTextExplainer
      :param model: Linear models with linear coefs mapped to features or
          tree based models with inbuilt feature_importances that are sklearn
          models or follow the sklearn API.
      :type: sklearn.ensemble or sklearn.linear_model (natively supported)
      :param preprocessor: Custom preprocessor for encoding text into vector
          form. Contains custom parser, vectorizer and tokenizer. Reference
          utils_classical.BOWEncoder for preprocessor's API template.
      :type preprocessor: object
      :param hyperparam_range: Custom hyper parameter range to search over
          when training input model. passed to sklearn's GridsearchCV's
          as param_grid argument.
      :type hyperparam_range: dict
      :param n_jobs: The number of jobs to run in parallel.
          Passed to GridSearchCV. -1 means using all processors.
      :type n_jobs: int
      :param tol: Tolerance for stopping criteria. Default is 1e-4.
      :type tol: float
      """
      self.parsed_sentence = None
      self.word_importances = None
      self.model = model
      self.is_trained = is_trained
      if self.model is None and self.is_trained:
          raise Exception(
              "Is_trained flag can't be set to true, if custom model not provided."
          )
      self.hyperparam_range = hyperparam_range
      if self.model is not None:
          # model is user defined
          if not self.is_trained and self.hyperparam_range is None:
              raise Exception(
                  "Custom model needs to be supplied with custom hyperparameter range to search over."
              )
      self.preprocessor = (
          BOWEncoder() if preprocessor is None else preprocessor
      )
      self.n_jobs = n_jobs
      self.tol = tol
  
file_path: interpret-text/python/interpret_text/experimental/classical.py
imports: import numpy
  from sklearn.model_selection import GridSearchCV
  from sklearn.linear_model import LogisticRegression
  from sklearn.pipeline import Pipeline
  from interpret_text.experimental.common.base_explainer import _validate_X
  from interpret_text.experimental.common.utils_classical import BOWEncoder
  from interpret_text.experimental.common.constants import ExplainerParams
  from interpret_text.experimental.explanation import _create_local_explanation
label_desc: Use image node_id 1 to create a new ClassicalTextExplainer object  with example: obj = ClassicalTextExplainer(preprocessor, model, hyperparam_range, is_trained, n_jobs, tol)