From 1121ca4426edaa2d349a4e4478f9b1679cba2000 Mon Sep 17 00:00:00 2001 From: Nick Erickson Date: Sun, 3 Nov 2024 01:41:31 -0700 Subject: [PATCH] Update amlb/benchmark.py Co-authored-by: Pieter Gijsbers --- amlb/benchmark.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/amlb/benchmark.py b/amlb/benchmark.py index 58d678648..b6c2840df 100644 --- a/amlb/benchmark.py +++ b/amlb/benchmark.py @@ -334,12 +334,11 @@ def _in_job_history(self, task_def, fold): @staticmethod def _validate_job_history(job_history): - required_columns = ['framework', 'constraint', 'id', 'fold'] - actual_columns = list(job_history.columns) - for c in required_columns: - if c not in actual_columns: - raise AssertionError(f'job_history missing required column "{c}"! ' - f'Columns: {actual_columns}') + required_columns = {'framework', 'constraint', 'id', 'fold'} + actual_columns = set(job_history.columns) + if missing_columns := (required_columns - actual_columns): + quoted_columns = ', '.join(repr(c) for c in missing_columns) + raise AssertionError(f'job_history missing required column(s) {quoted_columns}! ') def _skip_job(self, task_def, fold): if fold < 0 or fold >= task_def.folds: