From 4937b7173a917e802766f1a309f24fd69ca47c1c Mon Sep 17 00:00:00 2001 From: rohansen856 Date: Thu, 25 Dec 2025 14:45:57 +0530 Subject: [PATCH 1/3] refactor: updated OpenMLEvaluation to use dataclass decarotor Signed-off-by: rohansen856 --- openml/evaluations/evaluation.py | 69 +++++++++----------------------- 1 file changed, 19 insertions(+), 50 deletions(-) diff --git a/openml/evaluations/evaluation.py b/openml/evaluations/evaluation.py index 6d69d377e..126b77c5b 100644 --- a/openml/evaluations/evaluation.py +++ b/openml/evaluations/evaluation.py @@ -1,6 +1,8 @@ # License: BSD 3-Clause from __future__ import annotations +from dataclasses import asdict, dataclass + import openml.config import openml.datasets import openml.flows @@ -8,8 +10,7 @@ import openml.tasks -# TODO(eddiebergman): A lot of this class is automatically -# handled by a dataclass +@dataclass class OpenMLEvaluation: """ Contains all meta-information about a run / evaluation combination, @@ -48,55 +49,23 @@ class OpenMLEvaluation: (e.g., in case of precision, auroc, recall) """ - def __init__( # noqa: PLR0913 - self, - run_id: int, - task_id: int, - setup_id: int, - flow_id: int, - flow_name: str, - data_id: int, - data_name: str, - function: str, - upload_time: str, - uploader: int, - uploader_name: str, - value: float | None, - values: list[float] | None, - array_data: str | None = None, - ): - self.run_id = run_id - self.task_id = task_id - self.setup_id = setup_id - self.flow_id = flow_id - self.flow_name = flow_name - self.data_id = data_id - self.data_name = data_name - self.function = function - self.upload_time = upload_time - self.uploader = uploader - self.uploader_name = uploader_name - self.value = value - self.values = values - self.array_data = array_data + run_id: int + task_id: int + setup_id: int + flow_id: int + flow_name: str + data_id: int + data_name: str + function: str + upload_time: str + uploader: int + uploader_name: str + value: float | None + values: list[float] | None + array_data: str | None = None def _to_dict(self) -> dict: - return { - "run_id": self.run_id, - "task_id": self.task_id, - "setup_id": self.setup_id, - "flow_id": self.flow_id, - "flow_name": self.flow_name, - "data_id": self.data_id, - "data_name": self.data_name, - "function": self.function, - "upload_time": self.upload_time, - "uploader": self.uploader, - "uploader_name": self.uploader_name, - "value": self.value, - "values": self.values, - "array_data": self.array_data, - } + return asdict(self) def __repr__(self) -> str: header = "OpenML Evaluation" @@ -123,7 +92,7 @@ def __repr__(self) -> str: "Run ID", "OpenML Run URL", "Task ID", - "OpenML Task URL" "Flow ID", + "OpenML Task URLFlow ID", "OpenML Flow URL", "Setup ID", "Data ID", From aa86f327bf57428191322187e66b30b28ad5cf6b Mon Sep 17 00:00:00 2001 From: rohansen856 Date: Fri, 26 Dec 2025 14:48:32 +0530 Subject: [PATCH 2/3] fix: updated order list with correct items Signed-off-by: rohansen856 --- openml/evaluations/evaluation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openml/evaluations/evaluation.py b/openml/evaluations/evaluation.py index 126b77c5b..36cf955f2 100644 --- a/openml/evaluations/evaluation.py +++ b/openml/evaluations/evaluation.py @@ -88,12 +88,12 @@ def __repr__(self) -> str: } order = [ - "Uploader Date", + "Upload Date", "Run ID", "OpenML Run URL", "Task ID", - "OpenML Task URLFlow ID", - "OpenML Flow URL", + "OpenML Task URL", + "Flow ID", "Setup ID", "Data ID", "Data Name", From 481610cbf09a9a528df0fb4426370e740ff8b60c Mon Sep 17 00:00:00 2001 From: rohansen856 Date: Fri, 26 Dec 2025 16:08:42 +0530 Subject: [PATCH 3/3] fix: added missing OpenML Flow URL field in order list Signed-off-by: rohansen856 --- openml/evaluations/evaluation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openml/evaluations/evaluation.py b/openml/evaluations/evaluation.py index 36cf955f2..5db087024 100644 --- a/openml/evaluations/evaluation.py +++ b/openml/evaluations/evaluation.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: "Task ID", "OpenML Task URL", "Flow ID", + "OpenML Flow URL", "Setup ID", "Data ID", "Data Name",