docstr: Add error analysis for classification
  
  Args:
      mode (str): Model Model - classification/regression model
      error_stats (dict): A dictionary maps the label to its aggregated statistics
      stats_type (str): The defined stats_type for statistical analysis
      k (int): The k value of the defined stats_type
      top (int): the number of top explanation to display
      notes(str): text to explain the block
docstr_tok: ["Add","error","analysis","for","classification","Args",":","mode","(","str",")",":","Model","Model","-","classification\/regression","model","error_stats","(","dict",")",":","A","dictionary","maps","the","label","to","its","aggregated","statistics","stats_type","(","str",")",":","The","defined","stats_type","for","statistical","analysis","k","(","int",")",":","The","k","value","of","the","defined","stats_type","top","(","int",")",":","the","number","of","top","explanation","to","display","notes","(","str",")",":","text","to","explain","the","block"]
code: def draw_error_analysis(
      self,
      notes: str,
      *,
      mode: str,
      error_stats: dict,
      stats_type: str,
      k: int,
      top: int = 15,
  ):
      """
      Add error analysis for classification
  
      Args:
          mode (str): Model Model - classification/regression model
          error_stats (dict): A dictionary maps the label to its aggregated statistics
          stats_type (str): The defined stats_type for statistical analysis
          k (int): The k value of the defined stats_type
          top (int): the number of top explanation to display
          notes(str): text to explain the block
      """
      from xai.graphs import graph_generator
  
      # -- Draw Content --
      self.pdf.add_new_line(notes)
      self.pdf.add_new_line(
          "Statistical type: %s with K value: %d" % (stats_type, k),
          style="I",
      )
      for (gt_class, predict_class), (
          _explanation_dict,
          num_sample,
      ) in error_stats.items():
          if mode == MODE.CLASSIFICATION:
              title = (
                  "%s sample from class [%s] is wrongly classified as class[%s]"
                  % (num_sample, gt_class, predict_class)
              )
              self.pdf.add_new_line(title)
              self.pdf.add_new_line(
                  " - Top reasons that they are predicted as class[%s]"
                  % predict_class
              )
          else:
              title = "sample for regression model"
              self.pdf.add_new_line(title)
              self.pdf.add_new_line(
                  " - Top reasons in regression prediction"
              )
          image_path = "%s/feature_importance_%s.png" % (
              self.figure_path,
              predict_class,
          )
          importance_ranking = [
              (key, value)
              for key, value in _explanation_dict[predict_class].items()
          ][:top]
          image_path = graph_generator.FeatureImportance(
              figure_path=image_path,
              data=importance_ranking,
              title=title,
          ).draw()
          self.pdf.add_large_image(image_path)
  
      self.pdf.ln()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import tempfile
  import warnings
  import numpy
  import shutil
  from typing import Tuple, Dict, List
  from xai import MODE
  from xai.data.constants import DatetimeResolution
  from xai.data.explorer import CategoricalStats, NumericalStats, TextStats, DatetimeStats
  from xai.formatter.contents import Title, SectionTitle, Header
  from xai.formatter.portable_document.publisher import CustomPdf
  from xai.formatter.report.section import OverviewSection, DetailSection
  from xai.formatter.writer import Writer
label_desc: Use image node_id 28 for calling the PdfWriter obj's underlying member method code with example usage: obj.draw_error_analysis(notes) without return types