Skip to content

Commit

Permalink
Merge pull request #200 from galilasmb/master
Browse files Browse the repository at this point in the history
Fixing best combination
  • Loading branch information
pauloborba authored Sep 24, 2024
2 parents d71b493 + 9722de8 commit 0ab1b13
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/experiment_static_analysis/generate_best_combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def convert_list_to_tuple(out):
result = []
for index in range(len(out[0])):
val = [x[index] for x in out]
result.append(tuple(val))
result.append(tuple(float(v) for v in val))
return concat_tuple(result)

info_LOI = ['project', 'class', 'method', 'merge commit']
Expand Down Expand Up @@ -358,7 +358,7 @@ def convert_list_to_tuple(out):

data = {
'Metric': ['Precision', 'Recall', 'F1-score', 'Accuracy'],
'Value': [round(best.higher_precision_value, 2), round(best.higher_recall_value, 2), round(best.higher_F1_value, 2), round(best.higher_accuracy_value, 2)],
'Value': [round(float(best.higher_precision_value), 2), round(float(best.higher_recall_value), 2), round(float(best.higher_F1_value), 2), round(float(best.higher_accuracy_value), 2)],
'Analyses': [str(to_string_as_set(get_reverse_name(remove_nested_best(best.higher_precision_analyses_names))))[:255],
str(to_string_as_set(get_reverse_name(remove_nested_best(best.higher_recall_analyses_names))))[:255],
str(to_string_as_set(get_reverse_name(remove_nested_best(best.higher_F1_analyses_names))))[:255],
Expand Down Expand Up @@ -490,7 +490,12 @@ def convert_list_to_tuple(out):
actual_dict = best.confusion_matrix(count_fp_fn(m_smaller), smaller)
l_aux = []
for m in merged_dict['Metrics']:
l_aux.append(format(actual_dict[m], '.2f'))
#l_aux.append(format(actual_dict[m], '.2f'))
try:
l_aux.append(format(float(actual_dict[m]), '.2f'))
except ValueError:
print(f"ValueError: Cannot convert {actual_dict[m]} to float.")
l_aux.append(actual_dict[m])

original_name = sum(get_reverse_name([smaller]), [])
key = ' or '.join(original_name)
Expand Down

0 comments on commit 0ab1b13

Please sign in to comment.