class_docstr: Introspective Rationale Explainer
      
class_docstr_tok: ["Introspective","Rationale","Explainer"]
docstr: Optionally pretrain the generator's introspective classifier, then
  train the explainer's model on the training data, with testing
  at the end of every epoch.
  
  :param X: training data containing labels, lists of word token
  ids, pad/word masks, and token counts for each training example
  :type X: pd.DataFrame
  :param y: testing data containing labels, lists of word token
      ids, pad/word masks, and token counts for each testing example
  :type y: pd.DataFrame
  :return: fitted model
  :rtype IntrospectiveRationaleModel
code: def fit(
      self, X: Iterable[Any], y: Optional[Iterable[Any]]
  ) -> IntrospectiveRationaleModel:
      """Optionally pretrain the generator's introspective classifier, then
      train the explainer's model on the training data, with testing
      at the end of every epoch.
  
      :param X: training data containing labels, lists of word token
      ids, pad/word masks, and token counts for each training example
      :type X: pd.DataFrame
      :param y: testing data containing labels, lists of word token
          ids, pad/word masks, and token counts for each testing example
      :type y: pd.DataFrame
      :return: fitted model
      :rtype IntrospectiveRationaleModel
      """
      if self.model_config.pretrain_cls:
          cls_wrapper = ClassifierWrapper(
              self.model_config, self.generator_classifier
          )
          cls_wrapper.fit(X, y)
  
          # freeze the generator's classifier entirely
          # (makes sense only if user wants to pretrain)
          if self.model_config.fixed_classifier:
              self._freeze_classifier(
                  self.generator_classifier, entire=True
              )
  
      # train the three player model end-to-end
      self.model.fit(X, y)
  
      return self.model
  
imports: from typing import Iterable, Any, Optional, Union, Dict
  import numpy
  import pandas
  import torch
  from interpret_text.experimental.common.base_explainer import BaseTextExplainer, _validate_X
  from interpret_text.experimental.common.constants import BertTokens
  from interpret_text.experimental.common.model_config.introspective_rationale_model_config import IntrospectiveRationaleModelConfig
  from interpret_text.experimental.common.model_config.model_config_constants import get_bert_default_config, get_rnn_default_config, get_bert_rnn_default_config
  from interpret_text.experimental.common.preprocessor.bert_preprocessor import BertPreprocessor
  from interpret_text.experimental.common.preprocessor.glove_preprocessor import GlovePreprocessor
  from interpret_text.experimental.common.utils_classical import plot_local_imp
  from interpret_text.experimental.common.utils_introspective_rationale import generate_data
  from interpret_text.experimental.explanation import _create_local_explanation, LocalExplanation
  from interpret_text.experimental.introspective_rationale.components import ClassifierWrapper, ClassifierModule, IntrospectionGeneratorModule
  from interpret_text.experimental.introspective_rationale.model import IntrospectiveRationaleModel
  from transformers import BertForSequenceClassification
label_desc: Use image node_id 16 for calling the IntrospectiveRationaleExplainer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self