class_docstr: Tensorflow backend datasets. 
class_docstr_tok: ["Tensorflow","backend","datasets","."]
docstr: Constructor.
  
  Parameters
  ----------
  X
      Array of input instances. The input should NOT be preprocessed as it will be preprocessed when calling
      the `preprocessor` function.
  preprocessor
      Preprocessor function. This function correspond to the preprocessing steps applied to the
      encoder/auto-encoder model.
  predictor
      Prediction function. The classifier function should expect the input in the original format and preprocess
      it internally in the `predictor` if necessary.
  conditional_func
      Conditional function generator. Given an pre-processed input array, the functions generates a conditional
      array.
  batch_size
      Dimension of the batch used during training. The same batch size is used to infer the classification
      labels of the input dataset.
  shuffle
      Whether to shuffle the dataset each epoch. ``True`` by default.
docstr_tok: ["Constructor",".","Parameters","--","--","--","--","--","X","Array","of","input","instances",".","The","input","should","NOT","be","preprocessed","as","it","will","be","preprocessed","when","calling","the","`","preprocessor","`","function",".","preprocessor","Preprocessor","function",".","This","function","correspond","to","the","preprocessing","steps","applied","to","the","encoder\/auto-encoder","model",".","predictor","Prediction","function",".","The","classifier","function","should","expect","the","input","in","the","original","format","and","preprocess","it","internally","in","the","`","predictor","`","if","necessary",".","conditional_func","Conditional","function","generator",".","Given","an","pre-processed","input","array",",","the","functions","generates","a","conditional","array",".","batch_size","Dimension","of","the","batch","used","during","training",".","The","same","batch","size","is","used","to","infer","the","classification","labels","of","the","input","dataset",".","shuffle","Whether","to","shuffle","the","dataset","each","epoch",".","``","True","``","by","default","."]
code: def __init__(
      self,
      X: np.ndarray,
      preprocessor: Callable,
      predictor: Callable,
      conditional_func: Callable,
      batch_size: int,
      shuffle: bool = True,
  ) -> None:
      """
      Constructor.
  
      Parameters
      ----------
      X
          Array of input instances. The input should NOT be preprocessed as it will be preprocessed when calling
          the `preprocessor` function.
      preprocessor
          Preprocessor function. This function correspond to the preprocessing steps applied to the
          encoder/auto-encoder model.
      predictor
          Prediction function. The classifier function should expect the input in the original format and preprocess
          it internally in the `predictor` if necessary.
      conditional_func
          Conditional function generator. Given an pre-processed input array, the functions generates a conditional
          array.
      batch_size
          Dimension of the batch used during training. The same batch size is used to infer the classification
          labels of the input dataset.
      shuffle
          Whether to shuffle the dataset each epoch. ``True`` by default.
      """
      super().__init__()
  
      self.X = X
      self.preprocessor = preprocessor
      self.predictor = predictor
      self.conditional_func = conditional_func
      self.batch_size = batch_size
      self.shuffle = shuffle
  
      # Infer the classification labels of the input dataset. This is performed in batches.
      self.Y_m = self.predict_batches(
          X=self.X, predictor=self.predictor, batch_size=self.batch_size
      )
  
      # Define number of classes for classification & minimum and maximum labels for regression
      if self.Y_m.shape[1] > 1:
          self.num_classes = self.Y_m.shape[1]
      else:
          self.min_m = np.min(self.Y_m)
          self.max_m = np.max(self.Y_m)
  
      # Preprocess data.
      self.X = self.preprocessor(self.X)
  
      # Generate shuffled indexes.
      self.on_epoch_end()
  
imports: import os
  import random
  from typing import Any, List, Dict, Callable, Union, Optional, TYPE_CHECKING
  import numpy
  import tensorflow
  import tensorflow.keras
  from alibi.explainers.backends.cfrl_base import CounterfactualRLDataset
  from alibi.models.tensorflow.actor_critic import Actor, Critic
label_desc: Use image node_id 1 to create a new TfCounterfactualRLDataset object from inherited base classes: CounterfactualRLDataset, keras.utils with example: obj = TfCounterfactualRLDataset(X, preprocessor, predictor, conditional_func, batch_size, shuffle)