Skip to content
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

[ENH] add test for all_estimators tag filter #4512

Merged
merged 2 commits into from Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions sktime/registry/tests/test_lookup.py
Expand Up @@ -231,6 +231,25 @@ def test_all_estimators_return_tags_bad_arg(return_tags):
_ = all_estimators(return_tags=return_tags)


@pytest.mark.parametrize("pred_int", [True, False])
def test_all_estimators_tag_filter(pred_int):
"""Test that tag filtering returns estimators as expected."""
NOPROBA_EXAMPLE = "TrendForecaster"
PROBA_EXAMPLE = "ARIMA"

res = all_estimators("forecaster", filter_tags={"capability:pred_int": pred_int})
names, ests = zip(*res)

if pred_int:
assert PROBA_EXAMPLE in names
assert NOPROBA_EXAMPLE not in names
assert [est.get_class_tag("capability:pred_int") for est in ests]
else:
assert PROBA_EXAMPLE not in names
assert NOPROBA_EXAMPLE in names
assert [not est.get_class_tag("capability:pred_int") for est in ests]


@pytest.mark.parametrize("estimator_scitype", BASE_CLASS_SCITYPE_LIST)
def test_scitype_inference(estimator_scitype):
"""Check that scitype inverts _check_estimator_types."""
Expand Down