From 5ea412a2d0824435e94d2e42cd9a6454863e1774 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Mon, 3 Jun 2019 11:43:22 +0200 Subject: [PATCH] Ensure consistent arrays in match_predictions Signed-off-by: Jim Martens --- src/twomartens/masterthesis/evaluate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/twomartens/masterthesis/evaluate.py b/src/twomartens/masterthesis/evaluate.py index 2090f27..150c3b9 100644 --- a/src/twomartens/masterthesis/evaluate.py +++ b/src/twomartens/masterthesis/evaluate.py @@ -142,6 +142,10 @@ def match_predictions(predictions: Sequence[Sequence[Tuple[int, float, int, int, if len(predictions_class) == 0: true_positives.append(true_pos) false_positives.append(false_pos) + cumulative_true_pos = np.cumsum(true_pos) # Cumulative sums of the true positives + cumulative_false_pos = np.cumsum(false_pos) # Cumulative sums of the false positives + cumulative_true_positives.append(cumulative_true_pos) + cumulative_false_positives.append(cumulative_false_pos) continue # Convert the predictions list for this class into a structured array so that we can sort it by confidence. @@ -253,8 +257,6 @@ def get_precision_recall(number_gt_per_class: np.ndarray, """ cumulative_precisions = [[]] cumulative_recalls = [[]] - print(len(cumulative_true_positives)) - print(cumulative_true_positives) # Iterate over all classes. for class_id in range(1, nr_classes + 1):