Commit 96ec7a24 authored by Alain Shakour's avatar Alain Shakour

Fix score and rate driven widgets

parent 1df4e717
...@@ -62,12 +62,12 @@ def ca_rate_driven_threshold_selection(input_dict): ...@@ -62,12 +62,12 @@ def ca_rate_driven_threshold_selection(input_dict):
previous = float('inf') previous = float('inf')
current = previous current = previous
for i in range(n): for i in range(n):
current = list_score[i][1] current = sorted_score[i][1]
current_rank = current_rank + 1 current_rank = current_rank + 1
if current_rank > rank: if current_rank > rank:
output_dict['bin_thres'] = (previous + current) / float(2) output_dict['bin_thres'] = (previous + current) / float(2)
break break
previous = list_score[i][1] previous = sorted_score[i][1]
return output_dict return output_dict
def ca_score_driven_threshold_selection(input_dict): def ca_score_driven_threshold_selection(input_dict):
...@@ -128,7 +128,7 @@ def get_value(method, TP, TN, P, N): ...@@ -128,7 +128,7 @@ def get_value(method, TP, TN, P, N):
if method == 'recall': if method == 'recall':
return recall return recall
if TP + FP > 0: if TP + FP > 0:
precision = TP / float(TP + P) precision = TP / float(TP + FP)
if method == 'precision': if method == 'precision':
return precision return precision
if precision + recall > 0: if precision + recall > 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment