class_docstr: API for creating and training a text classification model.
class_docstr_tok: ["API","for","creating","and","training","a","text","classification","model","."]
docstr: Overrides Classifier.evaluate().
  
  Args:
    data: Evaluation dataset. Must be a TextClassifier Dataset.
    batch_size: Number of samples per evaluation step.
    desired_precisions: If specified, adds a RecallAtPrecision metric per
      desired_precisions[i] entry which tracks the recall given the constraint
      on precision. Only supported for binary classification.
    desired_recalls: If specified, adds a PrecisionAtRecall metric per
      desired_recalls[i] entry which tracks the precision given the constraint
      on recall. Only supported for binary classification.
  
  Returns:
    The loss value and accuracy.
  
  Raises:
    ValueError if `data` is not a TextClassifier Dataset.
code: def evaluate(
      self,
      data: ds.Dataset,
      batch_size: int = 32,
      desired_precisions: Optional[Sequence[float]] = None,
      desired_recalls: Optional[Sequence[float]] = None,
  ) -> Any:
      """Overrides Classifier.evaluate().
  
      Args:
        data: Evaluation dataset. Must be a TextClassifier Dataset.
        batch_size: Number of samples per evaluation step.
        desired_precisions: If specified, adds a RecallAtPrecision metric per
          desired_precisions[i] entry which tracks the recall given the constraint
          on precision. Only supported for binary classification.
        desired_recalls: If specified, adds a PrecisionAtRecall metric per
          desired_recalls[i] entry which tracks the precision given the constraint
          on recall. Only supported for binary classification.
  
      Returns:
        The loss value and accuracy.
  
      Raises:
        ValueError if `data` is not a TextClassifier Dataset.
      """
      # This override is needed because TextClassifier preprocesses its data
      # outside of the `gen_tf_dataset()` method. The preprocess call also
      # requires a TextClassifier Dataset instead of a core Dataset.
      if not isinstance(data, text_ds.Dataset):
          raise ValueError("Need a TextClassifier Dataset.")
  
      processed_data = self._text_preprocessor.preprocess(data)
      dataset = processed_data.gen_tf_dataset(
          batch_size, is_training=False
      )
  
      with self._hparams.get_strategy().scope():
          return self._model.evaluate(dataset)
  
imports: import abc
  import os
  import tempfile
  from typing import Any, Optional, Sequence, Tuple
  import tensorflow
  from tensorflow_addons import optimizers
  import tensorflow_hub
  from mediapipe.model_maker.python.core.data import dataset
  from mediapipe.model_maker.python.core.tasks import classifier
  from mediapipe.model_maker.python.core.utils import hub_loader
  from mediapipe.model_maker.python.core.utils import loss_functions
  from mediapipe.model_maker.python.core.utils import metrics
  from mediapipe.model_maker.python.core.utils import model_util
  from mediapipe.model_maker.python.core.utils import quantization
  from mediapipe.model_maker.python.text.text_classifier import bert_tokenizer
  from mediapipe.model_maker.python.text.text_classifier import dataset
  from mediapipe.model_maker.python.text.text_classifier import hyperparameters
  from mediapipe.model_maker.python.text.text_classifier import model_options
  from mediapipe.model_maker.python.text.text_classifier import model_spec
  from mediapipe.model_maker.python.text.text_classifier import model_with_tokenizer
  from mediapipe.model_maker.python.text.text_classifier import preprocessor
  from mediapipe.model_maker.python.text.text_classifier import text_classifier_options
  from mediapipe.tasks.python.metadata.metadata_writers import metadata_writer
  from mediapipe.tasks.python.metadata.metadata_writers import text_classifier
label_desc: Use image node_id 3 for calling the TextClassifier obj's underlying member method code with example usage: obj.evaluate(data, batch_size, desired_precisions, desired_recalls) and returns: self