Skip to content

Commit

Permalink
Merge pull request #382 from leondavi/model_performance_issue
Browse files Browse the repository at this point in the history
fix bug in model performence stats
  • Loading branch information
leondavi authored Aug 3, 2024
2 parents 8382305 + 527b284 commit 1b5505f
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 1b5505f

Please sign in to comment.