class_docstr: Abstract Labeling Model
class_docstr_tok: ["Abstract","Labeling","Model"]
docstr: Build a text report showing the main labeling metrics.
  
  Args:
      x_data:
      y_data:
      batch_size:
      digits:
      truncating:
  
  Returns:
      A report dict
  
  Example:
  
      >>> from kashgari.tasks.labeling import BiGRU_Model
      >>> model = BiGRU_Model()
      >>> model.fit(train_x, train_y, valid_x, valid_y)
      >>> report = model.evaluate(test_x, test_y)
                 precision    recall  f1-score   support
          <BLANKLINE>
                ORG     0.0665    0.1108    0.0831       984
                LOC     0.1870    0.2086    0.1972      1951
                PER     0.1685    0.0882    0.1158       884
          <BLANKLINE>
          micro avg     0.1384    0.1555    0.1465      3819
          macro avg     0.1516    0.1555    0.1490      3819
          <BLANKLINE>
      >>> print(report)
          {
           'f1-score': 0.14895159934887792,
           'precision': 0.1516294012813676,
           'recall': 0.15553809897879026,
           'support': 3819,
           'detail': {'LOC': {'f1-score': 0.19718992248062014,
                              'precision': 0.18695452457510336,
                              'recall': 0.20861096873398258,
                              'support': 1951},
                      'ORG': {'f1-score': 0.08307926829268293,
                              'precision': 0.06646341463414634,
                              'recall': 0.11077235772357724,
                              'support': 984},
                      'PER': {'f1-score': 0.11581291759465479,
                              'precision': 0.16846652267818574,
                              'recall': 0.08823529411764706,
                              'support': 884}},
          }
docstr_tok: ["Build","a","text","report","showing","the","main","labeling","metrics",".","Args",":","x_data",":","y_data",":","batch_size",":","digits",":","truncating",":","Returns",":","A","report","dict","Example",":",">",">",">","from","kashgari.tasks.labeling","import","BiGRU_Model",">",">",">","model","=","BiGRU_Model","(",")",">",">",">","model.fit","(","train_x",",","train_y",",","valid_x",",","valid_y",")",">",">",">","report","=","model.evaluate","(","test_x",",","test_y",")","precision","recall","f1-score","support","<","BLANKLINE",">","ORG","0.0665","0.1108","0.0831","984","LOC","0.1870","0.2086","0.1972","1951","PER","0.1685","0.0882","0.1158","884","<","BLANKLINE",">","micro","avg","0.1384","0.1555","0.1465","3819","macro","avg","0.1516","0.1555","0.1490","3819","<","BLANKLINE",">",">",">",">","print","(","report",")","{","'f1-score","'",":","0.14895159934887792",",","'precision","'",":","0.1516294012813676",",","'recall","'",":","0.15553809897879026",",","'support","'",":","3819",",","'detail","'",":","{","'LOC","'",":","{","'f1-score","'",":","0.19718992248062014",",","'precision","'",":","0.18695452457510336",",","'recall","'",":","0.20861096873398258",",","'support","'",":","1951","}",",","'ORG","'",":","{","'f1-score","'",":","0.08307926829268293",",","'precision","'",":","0.06646341463414634",",","'recall","'",":","0.11077235772357724",",","'support","'",":","984","}",",","'PER","'",":","{","'f1-score","'",":","0.11581291759465479",",","'precision","'",":","0.16846652267818574",",","'recall","'",":","0.08823529411764706",",","'support","'",":","884","}","}",",","}"]
code: def evaluate(
      self,
      x_data: TextSamplesVar,
      y_data: TextSamplesVar,
      batch_size: int = 32,
      digits: int = 4,
      truncating: bool = False,
  ) -> Dict:
      """
      Build a text report showing the main labeling metrics.
  
      Args:
          x_data:
          y_data:
          batch_size:
          digits:
          truncating:
  
      Returns:
          A report dict
  
      Example:
  
          >>> from kashgari.tasks.labeling import BiGRU_Model
          >>> model = BiGRU_Model()
          >>> model.fit(train_x, train_y, valid_x, valid_y)
          >>> report = model.evaluate(test_x, test_y)
                     precision    recall  f1-score   support
              <BLANKLINE>
                    ORG     0.0665    0.1108    0.0831       984
                    LOC     0.1870    0.2086    0.1972      1951
                    PER     0.1685    0.0882    0.1158       884
              <BLANKLINE>
              micro avg     0.1384    0.1555    0.1465      3819
              macro avg     0.1516    0.1555    0.1490      3819
              <BLANKLINE>
          >>> print(report)
              {
               'f1-score': 0.14895159934887792,
               'precision': 0.1516294012813676,
               'recall': 0.15553809897879026,
               'support': 3819,
               'detail': {'LOC': {'f1-score': 0.19718992248062014,
                                  'precision': 0.18695452457510336,
                                  'recall': 0.20861096873398258,
                                  'support': 1951},
                          'ORG': {'f1-score': 0.08307926829268293,
                                  'precision': 0.06646341463414634,
                                  'recall': 0.11077235772357724,
                                  'support': 984},
                          'PER': {'f1-score': 0.11581291759465479,
                                  'precision': 0.16846652267818574,
                                  'recall': 0.08823529411764706,
                                  'support': 884}},
              }
  
      """
      y_pred = self.predict(
          x_data, batch_size=batch_size, truncating=truncating
      )
      y_true = [
          seq[: len(y_pred[index])] for index, seq in enumerate(y_data)
      ]
  
      new_y_pred = []
      for x in y_pred:
          new_y_pred.append([str(i) for i in x])
      new_y_true = []
      for x in y_true:
          new_y_true.append([str(i) for i in x])
  
      report = sequence_labeling_report(y_true, y_pred, digits=digits)
      return report
  
imports: from abc import ABC
  from typing import List, Dict, Any, Union, Optional
  import numpy
  import tensorflow
  import kashgari
  from kashgari.embeddings import ABCEmbedding, BareEmbedding
  from kashgari.generators import CorpusGenerator, BatchDataSet
  from kashgari.layers import KConditionalRandomField
  from kashgari.logger import logger
  from kashgari.metrics.sequence_labeling import get_entities
  from kashgari.metrics.sequence_labeling import sequence_labeling_report
  from kashgari.processors import SequenceProcessor
  from kashgari.tasks.abs_task_model import ABCTaskModel
  from kashgari.types import TextSamplesVar
label_desc: Use image node_id 10 for calling the ABCLabelingModel obj's underlying member method code with example usage: obj.evaluate(x_data, y_data, batch_size, digits, truncating) and returns: report