class_docstr: Defines the top-level RAITextInsights API.
  
  Use RAITextInsights to assess text machine learning models in a
  single API.
class_docstr_tok: ["Defines","the","top-level","RAITextInsights","API",".","Use","RAITextInsights","to","assess","text","machine","learning","models","in","a","single","API","."]
docstr: Creates an RAITextInsights object.
  
  :param model: The model to compute RAI insights for.
      A model that implements sklearn.predict or sklearn.predict_proba
      or function that accepts a 2d ndarray.
  :type model: object
  :param test: The test dataset including the label column.
  :type test: pandas.DataFrame
  :param target_column: The name of the label column or list of columns.
      This is a list of columns for multilabel models.
  :type target_column: str or list[str]
  :param task_type: The task to run.
  :type task_type: str
  :param classes: The class labels in the training dataset
  :type classes: numpy.ndarray
  :param serializer: Picklable custom serializer with save and load
      methods for custom model serialization.
      The save method writes the model to file given a parent directory.
      The load method returns the deserialized model from the same
      parent directory.
  :type serializer: object
  :param maximum_rows_for_test: Limit on size of test data
      (for performance reasons)
  :type maximum_rows_for_test: int
  :param feature_metadata: Feature metadata for the dataset
      to identify different kinds of features.
  :type feature_metadata: Optional[FeatureMetadata]
  :param text_column: The name of the optional text column(s).
      If not provided, and there is additional feature metadata, then
      an exception will be raised.
  :type text_column: str or list[str]
docstr_tok: ["Creates","an","RAITextInsights","object",".",":","param","model",":","The","model","to","compute","RAI","insights","for",".","A","model","that","implements","sklearn.predict","or","sklearn.predict_proba","or","function","that","accepts","a","2d","ndarray",".",":","type","model",":","object",":","param","test",":","The","test","dataset","including","the","label","column",".",":","type","test",":","pandas.DataFrame",":","param","target_column",":","The","name","of","the","label","column","or","list","of","columns",".","This","is","a","list","of","columns","for","multilabel","models",".",":","type","target_column",":","str","or","list","[","str","]",":","param","task_type",":","The","task","to","run",".",":","type","task_type",":","str",":","param","classes",":","The","class","labels","in","the","training","dataset",":","type","classes",":","numpy.ndarray",":","param","serializer",":","Picklable","custom","serializer","with","save","and","load","methods","for","custom","model","serialization",".","The","save","method","writes","the","model","to","file","given","a","parent","directory",".","The","load","method","returns","the","deserialized","model","from","the","same","parent","directory",".",":","type","serializer",":","object",":","param","maximum_rows_for_test",":","Limit","on","size","of","test","data","(","for","performance","reasons",")",":","type","maximum_rows_for_test",":","int",":","param","feature_metadata",":","Feature","metadata","for","the","dataset","to","identify","different","kinds","of","features",".",":","type","feature_metadata",":","Optional","[","FeatureMetadata","]",":","param","text_column",":","The","name","of","the","optional","text","column","(","s",")",".","If","not","provided",",","and","there","is","additional","feature","metadata",",","then","an","exception","will","be","raised",".",":","type","text_column",":","str","or","list","[","str","]"]
code: def __init__(
      self,
      model: Any,
      test: pd.DataFrame,
      target_column: str,
      task_type: str,
      classes: Optional[np.ndarray] = None,
      serializer: Optional[Any] = None,
      maximum_rows_for_test: int = 5000,
      feature_metadata: Optional[FeatureMetadata] = None,
      text_column: Optional[Union[str, List]] = None,
  ):
      """Creates an RAITextInsights object.
  
      :param model: The model to compute RAI insights for.
          A model that implements sklearn.predict or sklearn.predict_proba
          or function that accepts a 2d ndarray.
      :type model: object
      :param test: The test dataset including the label column.
      :type test: pandas.DataFrame
      :param target_column: The name of the label column or list of columns.
          This is a list of columns for multilabel models.
      :type target_column: str or list[str]
      :param task_type: The task to run.
      :type task_type: str
      :param classes: The class labels in the training dataset
      :type classes: numpy.ndarray
      :param serializer: Picklable custom serializer with save and load
          methods for custom model serialization.
          The save method writes the model to file given a parent directory.
          The load method returns the deserialized model from the same
          parent directory.
      :type serializer: object
      :param maximum_rows_for_test: Limit on size of test data
          (for performance reasons)
      :type maximum_rows_for_test: int
      :param feature_metadata: Feature metadata for the dataset
          to identify different kinds of features.
      :type feature_metadata: Optional[FeatureMetadata]
      :param text_column: The name of the optional text column(s).
          If not provided, and there is additional feature metadata, then
          an exception will be raised.
      :type text_column: str or list[str]
      """
      # drop index as this can cause issues later like when copying
      # target column below from test dataset to _ext_test_df
      test = test.reset_index(drop=True)
      if feature_metadata is None:
          # initialize to avoid having to keep checking if it is None
          feature_metadata = FeatureMetadata()
      feature_metadata = _add_extra_metadata_features(
          task_type, feature_metadata
      )
      self._text_column = text_column
      self._feature_metadata = feature_metadata
      self._wrapped_model = wrap_model(model, test, task_type)
      self._validate_rai_insights_input_parameters(
          model=self._wrapped_model,
          test=test,
          target_column=target_column,
          task_type=task_type,
          classes=classes,
          serializer=serializer,
          maximum_rows_for_test=maximum_rows_for_test,
          text_column=self._text_column,
      )
      self._classes = RAITextInsights._get_classes(
          task_type=task_type,
          test=test,
          target_column=target_column,
          classes=classes,
      )
      ext_test, ext_features = extract_features(
          test,
          target_column,
          task_type,
          self._feature_metadata.dropped_features,
      )
      self._ext_test = ext_test
      self._ext_features = ext_features
      self._ext_test_df = pd.DataFrame(ext_test, columns=ext_features)
      self._ext_test_df[target_column] = test[target_column]
      self.predict_output = None
  
      super(RAITextInsights, self).__init__(
          model, None, test, target_column, task_type, serializer
      )
      self._initialize_managers()
  
imports: import json
  import logging
  import pickle
  import warnings
  from enum import Enum
  from pathlib import Path
  from typing import Any, List, Optional, Union
  import numpy
  import pandas
  from ml_wrappers import wrap_model
  from erroranalysis._internal.cohort_filter import FilterDataWithCohortFilters
  from raiutils.data_processing import convert_to_list, serialize_json_safe
  from raiutils.models import SKLearn, is_classifier
  from responsibleai._interfaces import Dataset, RAIInsightsData
  from responsibleai._internal.constants import ManagerNames, Metadata, SerializationAttributes
  from responsibleai.exceptions import UserConfigValidationException
  from responsibleai.feature_metadata import FeatureMetadata
  from responsibleai.rai_insights.rai_base_insights import RAIBaseInsights
  from responsibleai_text.common.constants import ModelTask
  from responsibleai_text.managers.error_analysis_manager import ErrorAnalysisManager
  from responsibleai_text.managers.explainer_manager import ExplainerManager
  from responsibleai_text.utils.feature_extractors import extract_features, get_text_columns
label_desc: Use image node_id 1 to create a new RAITextInsights object from inherited base classes: RAIBaseInsights with example: obj = RAITextInsights(model, test, target_column, task_type, classes, serializer, maximum_rows_for_test, feature_metadata, text_column)