From 846ffa68df31796eeaef7aee3fdef8b44cd4cb31 Mon Sep 17 00:00:00 2001 From: Ben Lonnqvist Date: Sat, 9 Nov 2024 16:28:41 +0100 Subject: [PATCH] cap score to 1 (#1383) Co-authored-by: Kartik Pradeepan --- brainscore_vision/benchmarks/lonnqvist2024/benchmark.py | 3 +++ brainscore_vision/benchmarks/malania2007/benchmark.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/brainscore_vision/benchmarks/lonnqvist2024/benchmark.py b/brainscore_vision/benchmarks/lonnqvist2024/benchmark.py index 73169adc5..9f22c1ae6 100644 --- a/brainscore_vision/benchmarks/lonnqvist2024/benchmark.py +++ b/brainscore_vision/benchmarks/lonnqvist2024/benchmark.py @@ -44,6 +44,9 @@ def __call__(self, candidate: BrainModel, return_raw_responses: bool = False): # Adjust score to ceiling ceiling = self.ceiling score = raw_score / ceiling + # ensure score <= 1.0 + if score.values > 1: + score = Score(np.array(1.)) score.attrs['raw'] = raw_score score.attrs['ceiling'] = ceiling if return_raw_responses: diff --git a/brainscore_vision/benchmarks/malania2007/benchmark.py b/brainscore_vision/benchmarks/malania2007/benchmark.py index 18bc9e7ee..7d6bc5f72 100644 --- a/brainscore_vision/benchmarks/malania2007/benchmark.py +++ b/brainscore_vision/benchmarks/malania2007/benchmark.py @@ -186,6 +186,9 @@ def __call__(self, candidate: BrainModel): # Adjust score to ceiling ceiling = self.ceiling score = raw_score / ceiling + # ensure score <= 1.0 + if score.values > 1: + score = Score(np.array(1.)) score.attrs['error'] = raw_score.error score.attrs['raw'] = raw_score