code: def get_class_reliability_diagram_image_list(
      label_key, visualization_result, TOP_K_CLASS=9
  ):
      rd_image_path_list = []
      predicted_class_count = dict()
      for label in visualization_result.keys():
          data = visualization_result[label]
          num_sample = len(data[constants.KEY_GROUNDTRUTH])
          predicted_class_count[label] = num_sample
  
      sorted_class_size = sorted(
          predicted_class_count.items(), key=operator.itemgetter(1)
      )[::-1]
      warnings.warn(
          message="Top predicted classes: {}".format(sorted_class_size)
      )
      top_classes = [a for (a, _) in sorted_class_size]
  
      for class_label in top_classes:
          data = visualization_result[class_label]
          num_sample = len(data[constants.KEY_GROUNDTRUTH])
          if num_sample > 0:
              rd_image_path = gg.ReliabilityDiagramForMultiClass(
                  data,
                  "%s_%s_ReliabilityDiagram" % (label_key, class_label),
              ).draw(current_class_label=class_label)
              rd_image_path_list.append(rd_image_path)
          if len(rd_image_path_list) >= TOP_K_CLASS:
              break
  
      return {
          "image_set": rd_image_path_list,
          "grid_spec": graph_constants.ABSOLUTE_RESULT_3_EQUAL_GRID_SPEC,
      }
  
file_path: contextual-ai/xai/graphs/generate_combo_figures.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import operator
  import os
  import warnings
  from xai import constants
  from xai.graphs import format_contants
  from xai.graphs import graph_generator
label_desc: Use image node_id 3 for calling a global function with example usage: get_class_reliability_diagram_image_list(label_key, visualization_result, TOP_K_CLASS) and returns: dict