code: def generate_global_rank(
      ml_data_score_dic: dict, alg_name_list: List
  ) -> dict:
      """
      ml_data_score_dic: { model_id: {alg: score1, alg2: score2} }
      return: { model_id: {alg1_alg2: rank_score} }
      """
  
      history = {}
      for alg in alg_name_list:
          history[alg] = []
  
      for arch_id, arch_score in ml_data_score_dic.items():
          # add model and score to local list
          for alg, score in arch_score.items():
              if alg in alg_name_list:
                  binary_insert_get_rank(
                      history[alg], [str(arch_id), float(score)]
                  )
  
      # convert multiple scores into rank value
      model_new_rank_score = {}
      current_explored_models = 0
      for alg in alg_name_list:
          current_explored_models = len(history[alg])
          for rank_index in range(len(history[alg])):
              ms_ins = history[alg][rank_index]
              # rank = index + 1, since index can be 0
              if ms_ins[0] in model_new_rank_score:
                  model_new_rank_score[ms_ins[0]] += rank_index + 1
              else:
                  model_new_rank_score[ms_ins[0]] = rank_index + 1
  
      for ele in model_new_rank_score.keys():
          model_new_rank_score[ele] = {
              "_".join(list(alg_name_list)): model_new_rank_score[ele]
              / current_explored_models
          }
  
      return model_new_rank_score
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/tools/compute.py
imports: from typing import List
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: generate_global_rank(ml_data_score_dic, alg_name_list) and returns: model_new_rank_score