Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b45f6f2
Adding importable helper functions
Neeratyoy Oct 29, 2020
8e7ea0b
Changing import of cat, cont
Neeratyoy Oct 29, 2020
102a084
Merge branch 'develop' into fix_773
Neeratyoy Oct 29, 2020
18a2dba
Better docstrings
Neeratyoy Oct 30, 2020
381c267
Adding unit test to check ColumnTransformer
Neeratyoy Oct 30, 2020
5dbff2e
Refinements from @mfeurer
Neeratyoy Nov 2, 2020
fc4ec73
Editing example to support both NumPy and Pandas
Neeratyoy Nov 2, 2020
8d5cad9
Merge branch 'develop' into fix_773
Neeratyoy Nov 3, 2020
3d66404
Merge branch 'develop' into fix_773
Neeratyoy Nov 4, 2020
90c8de6
Unit test fix to mark for deletion
Neeratyoy Nov 4, 2020
e0af15e
Making some unit tests work
Neeratyoy Nov 10, 2020
14aa11d
Waiting for dataset to be processed
Neeratyoy Nov 16, 2020
31d48d8
Minor test collection fix
Neeratyoy Nov 16, 2020
431447c
Template to handle missing tasks
Neeratyoy Nov 30, 2020
cc3199e
Accounting for more missing tasks:
Neeratyoy Nov 30, 2020
8a29668
Fixing some more unit tests
Neeratyoy Nov 30, 2020
405e03c
Simplifying check_task_existence
Neeratyoy Nov 30, 2020
caf4f46
black changes
Neeratyoy Dec 4, 2020
b308e71
Minor formatting
Neeratyoy Dec 8, 2020
436a9fe
Handling task exists check
Neeratyoy Dec 9, 2020
ddd8b04
Testing edited check task func
Neeratyoy Dec 14, 2020
74ae622
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 14, 2020
50ce90e
Flake fix
Neeratyoy Dec 15, 2020
aea2832
Updating with fixed unit tests from PR #1000
Neeratyoy Dec 15, 2020
56cd639
More retries on connection error
Neeratyoy Dec 16, 2020
8e8ea2e
Adding max_retries to config default
Neeratyoy Dec 17, 2020
d518beb
Update database retry unit test
Neeratyoy Dec 17, 2020
37d9f6b
Print to debug hash exception
Neeratyoy Dec 17, 2020
9bd4892
Fixing checksum unit test
Neeratyoy Dec 17, 2020
dc41b5d
Retry on _download_text_file
Neeratyoy Dec 18, 2020
396cb8d
Update datasets_tutorial.py
mfeurer Dec 21, 2020
8f380de
Update custom_flow_tutorial.py
mfeurer Dec 21, 2020
bc1745e
Update test_study_functions.py
mfeurer Dec 21, 2020
d95b5e6
Update test_dataset_functions.py
mfeurer Dec 21, 2020
d58ca5a
Merge branch 'fix_unit_tests' into fix_773
Neeratyoy Dec 21, 2020
91c6cf5
more retries, but also more time between retries
mfeurer Dec 21, 2020
b43a0e0
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 21, 2020
a9430b3
allow for even more retries on get calls
mfeurer Dec 21, 2020
e9cfba8
Catching failed get task
Neeratyoy Dec 21, 2020
c13f6ce
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 21, 2020
3d7abc2
undo stupid change
mfeurer Dec 21, 2020
94576b1
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 21, 2020
b5e1242
fix one more test
mfeurer Dec 21, 2020
d764aad
Merge branch 'fix_unit_tests' into fix_773
Neeratyoy Dec 21, 2020
f5e4a3e
Refactoring md5 hash check inside _send_request
Neeratyoy Dec 21, 2020
c065dfc
Merge branch 'fix_unit_tests' into fix_773
Neeratyoy Dec 21, 2020
07ce722
Fixing a fairly common unit test fail
Neeratyoy Dec 22, 2020
82e1b72
Reverting loose check on unit test
Neeratyoy Dec 23, 2020
936c252
Merge branch 'fix_unit_tests' into fix_773
Neeratyoy Dec 23, 2020
fc8b464
Merge branch 'develop' into fix_773
PGijsbers Dec 24, 2020
46ab043
Fixing integer type check to allow np.integer
Neeratyoy Jan 22, 2021
1be82c3
Trying to loosen check on unit test as fix
Neeratyoy Jan 25, 2021
dfbf5e5
Examples support for pandas=1.2.1
Neeratyoy Jan 27, 2021
b611f9f
pandas indexing as iloc
Neeratyoy Jan 27, 2021
93833c3
fix example: actually load the different tasks
mfeurer Jan 28, 2021
f6aa7ed
Renaming custom flow to disable tutorial (#1019)
Neeratyoy Jan 28, 2021
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
Next Next commit
Adding importable helper functions
  • Loading branch information
Neeratyoy committed Oct 29, 2020
commit b45f6f20a39600ebdb6cf557e120942e7bda7128
1 change: 1 addition & 0 deletions doc/progress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog

0.11.1
~~~~~~
* MAINT #671: Improved the performance of ``check_datasets_active`` by only querying the given list of datasets in contrast to querying all datasets. Modified the corresponding unit test.

0.11.0
~~~~~~
Expand Down
17 changes: 13 additions & 4 deletions openml/datasets/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def list_datasets(
status: Optional[str] = None,
tag: Optional[str] = None,
output_format: str = "dict",
**kwargs
**kwargs,
) -> Union[Dict, pd.DataFrame]:

"""
Expand Down Expand Up @@ -251,7 +251,7 @@ def list_datasets(
size=size,
status=status,
tag=tag,
**kwargs
**kwargs,
)


Expand Down Expand Up @@ -333,14 +333,22 @@ 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 (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
-------
Expand All @@ -353,7 +361,8 @@ def check_datasets_active(dataset_ids: List[int]) -> Dict[int, bool]:
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"

Expand Down
16 changes: 16 additions & 0 deletions openml/extensions/sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@
__all__ = ["SklearnExtension"]

register_extension(SklearnExtension)


def cont(X):
"""Returns True for all non-categorical columns, False for the rest.
Comment thread
mfeurer marked this conversation as resolved.
"""
if not hasattr(X, "dtypes"):
raise AttributeError("Not a Pandas DataFrame with 'dtypes' as attribute!")
return X.dtypes != "category"


def cat(X):
"""Returns True for all categorical columns, False for the rest.
Comment thread
PGijsbers marked this conversation as resolved.
"""
if not hasattr(X, "dtypes"):
raise AttributeError("Not a Pandas DataFrame with 'dtypes' as attribute!")
return X.dtypes == "category"
3 changes: 2 additions & 1 deletion tests/test_datasets/test_dataset_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ def test_list_datasets_empty(self):
def test_check_datasets_active(self):
# Have to test on live because there is no deactivated dataset on the test server.
openml.config.server = self.production_server
active = openml.datasets.check_datasets_active([2, 17])
active = openml.datasets.check_datasets_active([2, 17, 79], raise_error_if_not_exist=False,)
self.assertTrue(active[2])
self.assertFalse(active[17])
self.assertIsNone(active.get(79))
self.assertRaisesRegex(
ValueError,
"Could not find dataset 79 in OpenML dataset list.",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_study/test_study_examples.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# License: BSD 3-Clause

from openml.testing import TestBase, SimpleImputer, CustomImputer, cat, cont
from openml.testing import TestBase, SimpleImputer, CustomImputer
from openml.extensions.sklearn import cat, cont

import sklearn
import unittest
Expand Down