-
-
Notifications
You must be signed in to change notification settings - Fork 270
Improving the performance of check_datasets_active, modifying unit test #980
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -333,27 +333,40 @@ def _load_features_from_file(features_file: str) -> Dict: | |||||
| return xml_dict["oml:data_features"] | ||||||
|
|
||||||
|
|
||||||
| def check_datasets_active(dataset_ids: List[int]) -> Dict[int, bool]: | ||||||
| def check_datasets_active( | ||||||
| dataset_ids: List[int], | ||||||
| raise_error_if_not_exist: bool = True, | ||||||
| ) -> Dict[int, bool]: | ||||||
| """ | ||||||
| Check if the dataset ids provided are active. | ||||||
|
|
||||||
| Raises an error if a dataset_id in the given list | ||||||
| of dataset_ids does not exist on the server. | ||||||
|
|
||||||
| Parameters | ||||||
| ---------- | ||||||
| dataset_ids : List[int] | ||||||
| A list of integers representing dataset ids. | ||||||
| raise_error_if_not_exist : bool, optional (default=True) | ||||||
| Flag that if activated can raise an error, if one or more of the | ||||||
| given dataset ids do not exist on the server. | ||||||
|
|
||||||
| Returns | ||||||
| ------- | ||||||
| dict | ||||||
| A dictionary with items {did: bool} | ||||||
| """ | ||||||
| dataset_list = list_datasets(status="all") | ||||||
| dataset_list = list_datasets( | ||||||
| dataset_ids=dataset_ids, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this is a rather important one that hadn't caught my eye first time around 😅
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange, I got a suggestion for that and the function had no argument like that at all :S. Nice catch.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like because of the |
||||||
| status="all", | ||||||
| ) | ||||||
| active = {} | ||||||
|
|
||||||
| for did in dataset_ids: | ||||||
| dataset = dataset_list.get(did, None) | ||||||
| if dataset is None: | ||||||
| raise ValueError("Could not find dataset {} in OpenML dataset list.".format(did)) | ||||||
| if raise_error_if_not_exist: | ||||||
| raise ValueError(f'Could not find dataset {did} in OpenML dataset list.') | ||||||
| else: | ||||||
| active[did] = dataset["status"] == "active" | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.