class_docstr: Controller control the sample-score flow in the 1st phase.
  It records the results in the history.
class_docstr_tok: ["Controller","control","the","sample-score","flow","in","the","1st","phase",".","It","records","the","results","in","the","history","."]
code: def _re_rank_model_id(self, model_id: str, alg_score: dict):
      # todo: re-rank everything, to make it self.ranked_models more accurate.
      model_new_rank_score = {}
      current_explored_models = 0
      for alg, score in alg_score.items():
          for rank_index in range(len(self.history[alg])):
              current_explored_models = len(self.history[alg])
              ms_ins = self.history[alg][rank_index]
              # rank = index + 1, since index can be 0
              if ms_ins.model_id in model_new_rank_score:
                  model_new_rank_score[ms_ins.model_id] += (
                      rank_index + 1
                  )
              else:
                  model_new_rank_score[ms_ins.model_id] = rank_index + 1
  
      for ele in model_new_rank_score.keys():
          model_new_rank_score[ele] = (
              model_new_rank_score[ele] / current_explored_models
          )
  
      self.ranked_models = [
          k
          for k, v in sorted(
              model_new_rank_score.items(), key=lambda item: item[1]
          )
      ]
      new_rank_score = model_new_rank_score[model_id]
      return new_rank_score
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/controller/controler.py
imports: import time
  from src.controller.core.sample import Sampler
  from src.third_pkg.models import CellStructure
label_desc: Use image node_id 6 for calling the SampleController obj's underlying member method code with example usage: obj._re_rank_model_id(model_id, alg_score) and returns: new_rank_score