class_docstr: Wraps model that uses index to retrieve text data for making
  predictions.
class_docstr_tok: ["Wraps","model","that","uses","index","to","retrieve","text","data","for","making","predictions","."]
docstr: Initialize the WrappedIndexPredictorModel.
  
  :param model: The model to wrap.
  :type model: object
  :param dataset: The dataset to use for making predictions.
  :type dataset: pandas.DataFrame
  :param is_multilabel: Whether the model is multilabel.
  :type is_multilabel: bool
  :param task_type: The task to run.
  :type task_type: str
  :param classes: The classes for the model.
  :type classes: list
docstr_tok: ["Initialize","the","WrappedIndexPredictorModel",".",":","param","model",":","The","model","to","wrap",".",":","type","model",":","object",":","param","dataset",":","The","dataset","to","use","for","making","predictions",".",":","type","dataset",":","pandas.DataFrame",":","param","is_multilabel",":","Whether","the","model","is","multilabel",".",":","type","is_multilabel",":","bool",":","param","task_type",":","The","task","to","run",".",":","type","task_type",":","str",":","param","classes",":","The","classes","for","the","model",".",":","type","classes",":","list"]
code: def __init__(
      self, model, dataset, is_multilabel, task_type, classes=None
  ):
      """Initialize the WrappedIndexPredictorModel.
  
      :param model: The model to wrap.
      :type model: object
      :param dataset: The dataset to use for making predictions.
      :type dataset: pandas.DataFrame
      :param is_multilabel: Whether the model is multilabel.
      :type is_multilabel: bool
      :param task_type: The task to run.
      :type task_type: str
      :param classes: The classes for the model.
      :type classes: list
      """
      self.model = model
      self.dataset = dataset
      self.classes = classes
      self.is_multilabel = is_multilabel
      self.task_type = task_type
      classif_tasks = [
          ModelTask.TEXT_CLASSIFICATION,
          ModelTask.MULTILABEL_TEXT_CLASSIFICATION,
      ]
      if self.task_type in classif_tasks:
          dataset = self.dataset.iloc[:, 0].tolist()
          self.predictions = (
              self._raise_user_error_on_prediction_failure(
                  self.model.predict, dataset
              )
          )
          self.predict_proba = (
              self._raise_user_error_on_prediction_failure(
                  self.model.predict_proba, dataset
              )
          )
      elif self.task_type == ModelTask.QUESTION_ANSWERING:
          self.predictions = self.model.predict(
              self.dataset.loc[:, ["context", "questions"]]
          )
          self.predictions = np.array(self.predictions)
      else:
          raise ValueError(
              "Unknown task type: {}".format(self.task_type)
          )
  
      if self.is_multilabel:
          predictions_joined = []
          for row in self.predictions:
              # get all labels where prediction is 1
              pred_labels = [i for i in range(len(row)) if row[i]]
              if self.classes is not None:
                  pred_labels = [self.classes[i] for i in pred_labels]
              else:
                  pred_labels = [str(i) for i in pred_labels]
              # concatenate all predicted labels into a single string
              predictions_joined.append(",".join(pred_labels))
          self.predictions = np.array(predictions_joined)
  
imports: import json
  import numbers
  from typing import Any, List, Optional, Union
  import jsonschema
  import numpy
  import pandas
  from ml_wrappers import wrap_model
  from erroranalysis._internal.error_analyzer import ModelAnalyzer
  from erroranalysis._internal.error_report import as_error_report
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.exceptions import UserErrorException
  from responsibleai.managers.error_analysis_manager import ErrorAnalysisManager
  from responsibleai.managers.error_analysis_manager import as_error_config
  from responsibleai_text.common.constants import ModelTask
  from responsibleai_text.utils.feature_extractors import get_text_columns
label_desc: Use image node_id 1 to create a new WrappedIndexPredictorModel object  with example: obj = WrappedIndexPredictorModel(model, dataset, is_multilabel, task_type, classes)