class_docstr: ```
  Main class used to tune and train Keras models for text classification using Array data.
  ```
class_docstr_tok: ["``","`","Main","class","used","to","tune","and","train","Keras","models","for","text","classification","using","Array","data",".","``","`"]
docstr: ```
  Makes predictions on validation set
  ```
docstr_tok: ["``","`","Makes","predictions","on","validation","set","``","`"]
code: def predict(self, val_data=None):
      """
      ```
      Makes predictions on validation set
      ```
      """
      if val_data is not None:
          val = val_data
      else:
          val = self.val_data
      if val is None:
          raise Exception(
              "val_data must be supplied to get_learner or predict"
          )
      if hasattr(val, "reset"):
          val.reset()
      classification, multilabel = U.is_classifier(self.model)
      preds = self.model.predict(self._prepare(val, train=False))
      if hasattr(
          preds, "logits"
      ):  # dep_fix: breaking change in transformers==4.0.0 - also needed for Longformer
          # if type(preds).__name__ == 'TFSequenceClassifierOutput': # dep_fix: undocumented breaking change in transformers==4.0.0
          # REFERENCE: https://discuss.huggingface.co/t/new-model-output-types/195
          preds = preds.logits
  
      # dep_fix: transformers in TF 2.2.0 returns a tuple insead of NumPy array for some reason
      if isinstance(preds, tuple) and len(preds) == 1:
          preds = preds[0]
  
      if classification:
          if multilabel:
              return keras.activations.sigmoid(
                  tf.convert_to_tensor(preds)
              ).numpy()
          else:
              return keras.activations.softmax(
                  tf.convert_to_tensor(preds)
              ).numpy()
      else:
          return preds
  
file_path: ktrain/ktrain/text/learner.py
imports: from ..None import utils
  from ..core import ArrayLearner, GenLearner, _load_model
  from ..imports import *
  from .preprocessor import TransformersPreprocessor
label_desc: Use image node_id 4 for calling the TransformerTextClassLearner obj's underlying member method code with example usage: obj.predict(val_data) and returns: preds, keras, keras