docstr: Class to filter data with cohort filters.
  
  :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: Any
  :param dataset: The dataset.
  :type dataset: pandas.DataFrame
  :param features: The features in the dataset.
  :type features: list[str]
  :param categorical_features: The categorical features.
  :type categorical_features: list[str]
  :param categories: The categories.
  :type categories: list[list[str]]
  :param true_y: The true y.
  :type true_y: numpy.ndarray
  :param pred_y: The predicted y.
  :type pred_y: numpy.ndarray
  :param model_task: Either 'classification' or 'regression'.
  :type model_task: str
  :param classes: The list of classes in case of
                  classification problems.
  :type classes: list[str]
docstr_tok: ["Class","to","filter","data","with","cohort","filters",".",":","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",":","Any",":","param","dataset",":","The","dataset",".",":","type","dataset",":","pandas.DataFrame",":","param","features",":","The","features","in","the","dataset",".",":","type","features",":","list","[","str","]",":","param","categorical_features",":","The","categorical","features",".",":","type","categorical_features",":","list","[","str","]",":","param","categories",":","The","categories",".",":","type","categories",":","list","[","list","[","str","]","]",":","param","true_y",":","The","true","y.",":","type","true_y",":","numpy.ndarray",":","param","pred_y",":","The","predicted","y.",":","type","pred_y",":","numpy.ndarray",":","param","model_task",":","Either","'classification","'","or","'regression","'",".",":","type","model_task",":","str",":","param","classes",":","The","list","of","classes","in","case","of","classification","problems",".",":","type","classes",":","list","[","str","]"]
code: def __init__(
      self,
      model: Any,
      dataset: pd.DataFrame,
      features: List[str],
      categorical_features: List[str],
      categories: List[List[str]],
      true_y: np.ndarray,
      pred_y: np.ndarray,
      model_task: str,
      classes: Optional[List[str]] = None,
  ):
      """Class to filter data with cohort filters.
  
      :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: Any
      :param dataset: The dataset.
      :type dataset: pandas.DataFrame
      :param features: The features in the dataset.
      :type features: list[str]
      :param categorical_features: The categorical features.
      :type categorical_features: list[str]
      :param categories: The categories.
      :type categories: list[list[str]]
      :param true_y: The true y.
      :type true_y: numpy.ndarray
      :param pred_y: The predicted y.
      :type pred_y: numpy.ndarray
      :param model_task: Either 'classification' or 'regression'.
      :type model_task: str
      :param classes: The list of classes in case of
                      classification problems.
      :type classes: list[str]
      """
      self.model = model
      self.dataset = dataset
      self.features = features
      self.categorical_features = categorical_features
      self.categories = categories
      self.true_y = true_y
      self.pred_y = pred_y
      self.model_task = model_task
      self.classes = classes
  
file_path: responsible-ai-toolbox/erroranalysis/erroranalysis/_internal/cohort_filter.py
imports: from typing import Any, List, Optional
  import numpy
  import pandas
  from erroranalysis._internal.constants import ARG, COLUMN, COMPOSITE_FILTERS, METHOD, OPERATION, PRED_Y, ROW_INDEX, TRUE_Y, CohortFilterMethods, CohortFilterOps, ModelTask
  from erroranalysis._internal.metrics import get_ordered_classes
  from erroranalysis._internal.utils import is_spark
label_desc: Use image node_id 1 to create a new FilterDataWithCohortFilters object  with example: obj = FilterDataWithCohortFilters(model, dataset, features, categorical_features, categories, true_y, pred_y, model_task, classes)