Skip to content

MNT use api.openml.org URLs for fetch_openml #26171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sklearn/datasets/_openml.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__all__ = ["fetch_openml"]

_OPENML_PREFIX = "https://openml.org/"
_OPENML_PREFIX = "https://api.openml.org/"
_SEARCH_NAME = "api/v1/json/data/list/data_name/{}/limit/2"
_DATA_INFO = "api/v1/json/data/{}"
_DATA_FEATURES = "api/v1/json/data/features/{}"
Expand Down
12 changes: 7 additions & 5 deletions sklearn/datasets/tests/test_openml.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def _monkey_patch_webbased_functions(context, data_id, gzip_response):
# monkey patches the urlopen function. Important note: Do NOT use this
# in combination with a regular cache directory, as the files that are
# stored as cache should not be mixed up with real openml datasets
url_prefix_data_description = "https://openml.org/api/v1/json/data/"
url_prefix_data_features = "https://openml.org/api/v1/json/data/features/"
url_prefix_download_data = "https://openml.org/data/v1/"
url_prefix_data_list = "https://openml.org/api/v1/json/data/list/"
url_prefix_data_description = "https://api.openml.org/api/v1/json/data/"
url_prefix_data_features = "https://api.openml.org/api/v1/json/data/features/"
url_prefix_download_data = "https://api.openml.org/data/v1/"
url_prefix_data_list = "https://api.openml.org/api/v1/json/data/list/"

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

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