Skip to content

Commit a5b35e6

Browse files
authored
Allow datasets without qualities to be downloaded. (openml#847)
* Allow datasets without qualities to be downloaded. * Remove future tense to bring comply with the character limit * move downloading qualities back into main try/except * Write warning message to log if no qualities could be found when getting a dataset.
1 parent b1dae0b commit a5b35e6

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

examples/20_basic/simple_suites_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
print(tasks)
5151

5252
####################################################################################################
53-
# and iterated over for benchmarking. For speed reasons we'll only iterate over the first three tasks:
53+
# and iterated over for benchmarking. For speed reasons we only iterate over the first three tasks:
5454

5555
for task_id in tasks[:3]:
5656
task = openml.tasks.get_task(task_id)

openml/datasets/functions.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
import logging
23
import os
34
import re
45
from typing import List, Dict, Union, Optional
@@ -28,6 +29,7 @@
2829

2930

3031
DATASETS_CACHE_DIR_NAME = 'datasets'
32+
logger = logging.getLogger(__name__)
3133

3234
############################################################################
3335
# Local getters/accessors to the cache directory
@@ -498,10 +500,17 @@ def get_dataset(
498500
remove_dataset_cache = True
499501
description = _get_dataset_description(did_cache_dir, dataset_id)
500502
features = _get_dataset_features(did_cache_dir, dataset_id)
501-
qualities = _get_dataset_qualities(did_cache_dir, dataset_id)
502503

503-
arff_file = _get_dataset_arff(description) if download_data else None
504+
try:
505+
qualities = _get_dataset_qualities(did_cache_dir, dataset_id)
506+
except OpenMLServerException as e:
507+
if e.code == 362 and str(e) == 'No qualities found - None':
508+
logger.warning("No qualities found for dataset {}".format(dataset_id))
509+
qualities = None
510+
else:
511+
raise
504512

513+
arff_file = _get_dataset_arff(description) if download_data else None
505514
remove_dataset_cache = False
506515
except OpenMLServerException as e:
507516
# if there was an exception,

0 commit comments

Comments
 (0)