From 2f36b07c7c85db49dc691af2803a7d0634a1eea6 Mon Sep 17 00:00:00 2001 From: Roman Knyazhitskiy Date: Fri, 23 Aug 2024 12:44:35 +0200 Subject: [PATCH 1/3] Pass kwargs through task to ```get_dataset``` Allows to follow the directions in the warning ```Starting from Version 0.15 `download_data`, `download_qualities`, and `download_features_meta_data` will all be ``False`` instead of ``True`` by default to enable lazy loading.``` --- openml/tasks/task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openml/tasks/task.py b/openml/tasks/task.py index 4ad4cec62..358719053 100644 --- a/openml/tasks/task.py +++ b/openml/tasks/task.py @@ -145,9 +145,9 @@ def _get_repr_body_fields(self) -> Sequence[tuple[str, str | int | list[str]]]: ] return [(key, fields[key]) for key in order if key in fields] - def get_dataset(self) -> datasets.OpenMLDataset: + def get_dataset(self, **kwargs) -> datasets.OpenMLDataset: """Download dataset associated with task.""" - return datasets.get_dataset(self.dataset_id) + return datasets.get_dataset(self.dataset_id, **kwargs) def get_train_test_split_indices( self, From ba8eef41b37987f60f92e7070e4dd3c32a0caaaa Mon Sep 17 00:00:00 2001 From: Roman Knyazhitskiy Date: Tue, 17 Sep 2024 21:49:55 +0200 Subject: [PATCH 2/3] docs: explain that ```task.get_dataset``` passes kwargs --- openml/tasks/task.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openml/tasks/task.py b/openml/tasks/task.py index 358719053..71f8c774a 100644 --- a/openml/tasks/task.py +++ b/openml/tasks/task.py @@ -145,8 +145,11 @@ def _get_repr_body_fields(self) -> Sequence[tuple[str, str | int | list[str]]]: ] return [(key, fields[key]) for key in order if key in fields] - def get_dataset(self, **kwargs) -> datasets.OpenMLDataset: - """Download dataset associated with task.""" + def get_dataset(self, /, **kwargs) -> datasets.OpenMLDataset: + """Download dataset associated with task. + + Accepts the same keyword arguments as the `openml.datasets.get_dataset`. + """ return datasets.get_dataset(self.dataset_id, **kwargs) def get_train_test_split_indices( From 1f29586e2a99988463eda9c5ac77ff5440415f3e Mon Sep 17 00:00:00 2001 From: Pieter Gijsbers Date: Wed, 18 Sep 2024 09:40:39 +0200 Subject: [PATCH 3/3] Update openml/tasks/task.py Remove Py3.8+ feature for backwards compatibility --- openml/tasks/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openml/tasks/task.py b/openml/tasks/task.py index 71f8c774a..1e8671847 100644 --- a/openml/tasks/task.py +++ b/openml/tasks/task.py @@ -145,7 +145,7 @@ def _get_repr_body_fields(self) -> Sequence[tuple[str, str | int | list[str]]]: ] return [(key, fields[key]) for key in order if key in fields] - def get_dataset(self, /, **kwargs) -> datasets.OpenMLDataset: + def get_dataset(self, **kwargs) -> datasets.OpenMLDataset: """Download dataset associated with task. Accepts the same keyword arguments as the `openml.datasets.get_dataset`.