class_docstr: Abstract Classification Model
class_docstr_tok: ["Abstract","Classification","Model"]
docstr: Generates output predictions for the input samples.
  
  Computation is done in batches.
  
  Args:
      x_data: The input data, as a Numpy array (or list of Numpy arrays if the model has multiple inputs).
      batch_size: Integer. If unspecified, it will default to 32.
      truncating: remove values from sequences larger than `model.embedding.sequence_length`
      multi_label_threshold:
      predict_kwargs: arguments passed to ``predict()`` function of ``tf.keras.Model``
  
  Returns:
      array(s) of predictions.
docstr_tok: ["Generates","output","predictions","for","the","input","samples",".","Computation","is","done","in","batches",".","Args",":","x_data",":","The","input","data",",","as","a","Numpy","array","(","or","list","of","Numpy","arrays","if","the","model","has","multiple","inputs",")",".","batch_size",":","Integer",".","If","unspecified",",","it","will","default","to","32.","truncating",":","remove","values","from","sequences","larger","than","`","model.embedding.sequence_length","`","multi_label_threshold",":","predict_kwargs",":","arguments","passed","to","``","predict","(",")","``","function","of","``","tf.keras.Model","``","Returns",":","array","(","s",")","of","predictions","."]
code: def predict(
      self,
      x_data: TextSamplesVar,
      *,
      batch_size: int = 32,
      truncating: bool = False,
      multi_label_threshold: float = 0.5,
      predict_kwargs: Dict = None,
  ) -> Union[ClassificationLabelVar, MultiLabelClassificationLabelVar]:
      """
      Generates output predictions for the input samples.
  
      Computation is done in batches.
  
      Args:
          x_data: The input data, as a Numpy array (or list of Numpy arrays if the model has multiple inputs).
          batch_size: Integer. If unspecified, it will default to 32.
          truncating: remove values from sequences larger than `model.embedding.sequence_length`
          multi_label_threshold:
          predict_kwargs: arguments passed to ``predict()`` function of ``tf.keras.Model``
  
      Returns:
          array(s) of predictions.
      """
      if predict_kwargs is None:
          predict_kwargs = {}
      with kashgari.utils.custom_object_scope():
          if truncating:
              seq_length = self.sequence_length
          else:
              seq_length = None
          tensor = self.text_processor.transform(
              x_data,
              segment=self.embedding.segment,
              seq_length=seq_length,
              max_position=self.embedding.max_position,
          )
          logger.debug(
              f"predict input shape {np.array(tensor).shape} x: \n{tensor}"
          )
          pred = self.tf_model.predict(
              tensor, batch_size=batch_size, **predict_kwargs
          )
          logger.debug(f"predict output shape {pred.shape}")
          if self.multi_label:
              multi_label_binarizer = self.label_processor.multi_label_binarizer  # type: ignore
              res = multi_label_binarizer.inverse_transform(
                  pred, threshold=multi_label_threshold
              )
          else:
              pred_argmax = pred.argmax(-1)
              lengths = [len(sen) for sen in x_data]
              res = self.label_processor.inverse_transform(
                  pred_argmax, lengths=lengths
              )
              logger.debug(f"predict output argmax: {pred_argmax}")
  
      return res
  
imports: import random
  from abc import ABC
  import numpy
  from typing import List, Dict, Any, Union
  from sklearn import metrics
  from tensorflow import keras
  import kashgari
  from kashgari.embeddings import ABCEmbedding, BareEmbedding
  from kashgari.generators import BatchDataSet, CorpusGenerator
  from kashgari.layers import L
  from kashgari.logger import logger
  from kashgari.metrics.multi_label_classification import multi_label_classification_report
  from kashgari.processors import ABCProcessor
  from kashgari.processors import ClassificationProcessor
  from kashgari.processors import SequenceProcessor
  from kashgari.tasks.abs_task_model import ABCTaskModel
  from kashgari.types import TextSamplesVar, ClassificationLabelVar, MultiLabelClassificationLabelVar
label_desc: Use image node_id 10 for calling the ABCClassificationModel obj's underlying member method code with example usage: obj.predict(x_data) and returns: res