From 85bb7467c9722416f8ba25062b4ca57e919ff622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20Hedstr=C3=B6m?= Date: Tue, 8 Aug 2023 11:33:41 +0200 Subject: [PATCH 1/2] Fixed issue in max_sensitivity.py Issue addressed: https://github.com/understandable-machine-intelligence-lab/Quantus/issues/288. --- quantus/metrics/robustness/max_sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantus/metrics/robustness/max_sensitivity.py b/quantus/metrics/robustness/max_sensitivity.py index 07cbff612..27970a30c 100644 --- a/quantus/metrics/robustness/max_sensitivity.py +++ b/quantus/metrics/robustness/max_sensitivity.py @@ -383,7 +383,7 @@ def evaluate_batch( b=a_perturbed[instance_id].flatten(), ) numerator = self.norm_numerator(a=sensitivities) - denominator = self.norm_denominator(a=x_batch[instance_id].flatten()) + denominator = self.norm_denominator(a=a_batch[instance_id].flatten()) sensitivities_norm = numerator / denominator similarities[instance_id, step_id] = sensitivities_norm From 748b24b7aadfd2c7ac25194fd1c2ba1e4c9cf7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20Hedstr=C3=B6m?= Date: Tue, 8 Aug 2023 09:35:14 +0000 Subject: [PATCH 2/2] avg sens fixed --- quantus/metrics/robustness/avg_sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantus/metrics/robustness/avg_sensitivity.py b/quantus/metrics/robustness/avg_sensitivity.py index 3b29885f3..3e93e1407 100644 --- a/quantus/metrics/robustness/avg_sensitivity.py +++ b/quantus/metrics/robustness/avg_sensitivity.py @@ -384,7 +384,7 @@ def evaluate_batch( b=a_perturbed[instance_id].flatten(), ) numerator = self.norm_numerator(a=sensitivities) - denominator = self.norm_denominator(a=x_batch[instance_id].flatten()) + denominator = self.norm_denominator(a=a_batch[instance_id].flatten()) sensitivities_norm = numerator / denominator similarities[instance_id, step_id] = sensitivities_norm mean_func = np.mean if self.return_nan_when_prediction_changes else np.nanmean