Skip to content

Commit

Permalink
fix bug with model performnce stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad123 committed Aug 3, 2024
1 parent 8382305 commit 527b284
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src_py/apiServer/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ def get_model_performence_stats(self , confusion_matrix_worker_dict , show : boo
workers_performence = OrderedDict()
for (worker_name, class_name) in confusion_matrix_worker_dict.keys():
workers_performence[(worker_name, class_name)] = OrderedDict()
tn, fp, fn, tp = confusion_matrix_worker_dict[(worker_name, class_name)].ravel()
matrix = confusion_matrix_worker_dict[(worker_name, class_name)]
if len(matrix.shape) == 1 or matrix.shape == (1, 1): # if the matrix is 1D or 1x1 skip to prevent errors in the calculations
continue
tn, fp, fn, tp = matrix.ravel()
if printStats:
LOG_INFO(f"worker {worker_name} class: {class_name} tn: {tn}, fp: {fp}, fn: {fn}, tp: {tp}")
tn = int(tn)
Expand Down

0 comments on commit 527b284

Please sign in to comment.