Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8b05e0

Browse files
authored
MNT use api.openml.org URLs for fetch_openml (#26171)
1 parent fb02c17 commit d8b05e0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sklearn/datasets/_openml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
__all__ = ["fetch_openml"]
2424

25-
_OPENML_PREFIX = "https://openml.org/"
25+
_OPENML_PREFIX = "https://api.openml.org/"
2626
_SEARCH_NAME = "api/v1/json/data/list/data_name/{}/limit/2"
2727
_DATA_INFO = "api/v1/json/data/{}"
2828
_DATA_FEATURES = "api/v1/json/data/features/{}"

sklearn/datasets/tests/test_openml.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ def _monkey_patch_webbased_functions(context, data_id, gzip_response):
7373
# monkey patches the urlopen function. Important note: Do NOT use this
7474
# in combination with a regular cache directory, as the files that are
7575
# stored as cache should not be mixed up with real openml datasets
76-
url_prefix_data_description = "https://openml.org/api/v1/json/data/"
77-
url_prefix_data_features = "https://openml.org/api/v1/json/data/features/"
78-
url_prefix_download_data = "https://openml.org/data/v1/"
79-
url_prefix_data_list = "https://openml.org/api/v1/json/data/list/"
76+
url_prefix_data_description = "https://api.openml.org/api/v1/json/data/"
77+
url_prefix_data_features = "https://api.openml.org/api/v1/json/data/features/"
78+
url_prefix_download_data = "https://api.openml.org/data/v1/"
79+
url_prefix_data_list = "https://api.openml.org/api/v1/json/data/list/"
8080

8181
path_suffix = ".gz"
8282
read_fn = gzip.open
@@ -85,7 +85,9 @@ def _monkey_patch_webbased_functions(context, data_id, gzip_response):
8585

8686
def _file_name(url, suffix):
8787
output = (
88-
re.sub(r"\W", "-", url[len("https://openml.org/") :]) + suffix + path_suffix
88+
re.sub(r"\W", "-", url[len("https://api.openml.org/") :])
89+
+ suffix
90+
+ path_suffix
8991
)
9092
# Shorten the filenames to have better compatibility with windows 10
9193
# and filenames > 260 characters

0 commit comments

Comments
 (0)