From 0d13b8b6d2f972e225692d031575864f91c10c87 Mon Sep 17 00:00:00 2001 From: Raoul Schram Date: Wed, 6 Mar 2024 11:50:00 +0100 Subject: [PATCH] Fixed an issue in dominance computation The problem was in the case where all values are the same. --- metasyncontrib/disclosure/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metasyncontrib/disclosure/utils.py b/metasyncontrib/disclosure/utils.py index 829ff59..adc6cd3 100644 --- a/metasyncontrib/disclosure/utils.py +++ b/metasyncontrib/disclosure/utils.py @@ -20,6 +20,9 @@ def _compute_dominance(block_values, reverse=False): same_vals = np.all(block_values == max_values, axis=1) diff_sum = diff_values.sum(axis=1) dominance = diff_values[~same_vals].max(axis=1) / diff_sum[~same_vals] + # If all values are the same, then dominance is 0. + if len(dominance) == 0: + return 0 return np.max(dominance)