File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,11 @@ def choose_weights(**importance: float) -> list[float]:
6262 return [v / total for v in importance .values ()]
6363
6464
65- def normalize (values : list [float ]) -> list [float ]:
66- mn , mx = min ( values ), max (values )
67- if mx == mn :
65+ def normalize_by_max (values : list [float ]) -> list [float ]:
66+ mx = max (values )
67+ if mx == 0 :
6868 return [0.0 ] * len (values )
69- return [( v - mn ) / ( mx - mn ) for v in values ]
69+ return [v / mx for v in values ]
7070
7171
7272def create_score_dictionary_from_metrics (weights : list [float ], * metrics : list [float ]) -> dict [int , int ]:
Original file line number Diff line number Diff line change 3838 file_name_from_test_module_name ,
3939 get_run_tmp_file ,
4040 module_name_from_file_path ,
41- normalize ,
41+ normalize_by_max ,
4242 restore_conftest ,
4343 unified_diff_strings ,
4444)
@@ -198,8 +198,8 @@ def _process_refinement_results(self) -> OptimizedCandidate | None:
198198 runtime_w , diff_w = REFINED_CANDIDATE_RANKING_WEIGHTS
199199 weights = choose_weights (runtime = runtime_w , diff = diff_w )
200200
201- runtime_norm = normalize (runtimes_list )
202- diffs_norm = normalize (diff_lens_list )
201+ runtime_norm = normalize_by_max (runtimes_list )
202+ diffs_norm = normalize_by_max (diff_lens_list )
203203 # the lower the better
204204 score_dict = create_score_dictionary_from_metrics (weights , runtime_norm , diffs_norm )
205205 top_n_candidates = int ((TOP_N_REFINEMENTS * len (runtimes_list )) + 0.5 )
You can’t perform that action at this time.
0 commit comments