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

Add support for included_model_types #3239

Merged
merged 4 commits into from
May 31, 2023

Conversation

yinweisu
Copy link
Collaborator

Issue #, if available:
#1458

Description of changes:

  • Added ModelFilter as a util class to exclude and include models
  • Added included_model_types support

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yinweisu yinweisu requested a review from Innixma May 25, 2023 20:12
Copy link
Contributor

@Innixma Innixma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, had some minor comments

missing_models = set(included_model_types) - set(included_models)
if len(missing_models) > 0:
logger.warning(
f"The following models: {missing_models} are not present in model list specified by the user: {models.keys() if isinstance(models, dict) else models}. Will ignore."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The models types {missing_models} are not present in the model list specified by the user and will be ignored:"

Comment on lines 6 to 33
@pytest.mark.parametrize(
"models,included_model_types,excluded_model_types,expected_answer",
[
({"dummy": {}}, ["dummy"], None, {"dummy": {}}),
({"dummy": {"dummy": 1}}, ["dummy"], None, {"dummy": {"dummy": 1}}),
({"dummy": {}}, ["foo"], None, {}),
({"dummy": {}, "foo": {}}, ["foo"], None, {"foo": {}}),
({}, ["foo"], None, {}),
({"dummy": {}}, None, ["dummy"], {}),
({"dummy": {"dummy": 1}}, None, ["dummy"], {}),
({"dummy": {}}, None, ["foo"], {"dummy": {}}),
({"dummy": {}, "foo": {}}, None, ["foo"], {"dummy": {}}),
({}, None, ["foo"], {}),
({"dummy": {}}, ["dummy"], ["dummy"], {"dummy": {}}),
({"dummy": {"dummy": 1}}, ["dummy"], ["dummy"], {"dummy": {"dummy": 1}}),
({"dummy": {}}, ["foo"], ["dummy"], {}),
({"dummy": {}, "foo": {}}, ["foo"], ["dummy"], {"foo": {}}),
({}, ["foo"], ["foo"], {}),
(["dummy"], ["dummy"], None, ["dummy"]),
(["dummy"], ["foo"], None, []),
(["dummy", "foo"], ["foo"], None, ["foo"]),
([], ["foo"], None, []),
(["dummy"], None, ["foo"], ["dummy"]),
([], None, ["foo"], []),
(["dummy"], None, ["dummy"], []),
(["dummy", "foo"], None, ["dummy"], ["foo"]),
],
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be easier to have 1 line per argument for each test with proper use of whitespace, otherwise it is very hard to verify correctness by simply looking at this block.


@staticmethod
def include_models(
models: Union[Dict[str, Any], List[str]], included_model_types: List[str]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why support both list and dict input for models? When is list ever used? Ditto for exclude_models

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at TimeSeries implementation of excluded_model_types and it was using list. We could of course change how TimeSeries is implementing the logic but I feel it could be a valid use case while not adding too much difficulty in maintaining

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on list support: include=['RF', 'NN'] is a valid use case.

tabular/src/autogluon/tabular/predictor/predictor.py Outdated Show resolved Hide resolved
tabular/src/autogluon/tabular/predictor/predictor.py Outdated Show resolved Hide resolved
tabular/src/autogluon/tabular/predictor/predictor.py Outdated Show resolved Hide resolved
common/src/autogluon/common/model_filter/__init__.py Outdated Show resolved Hide resolved
@github-actions
Copy link

Job PR-3239-91f10e1 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3239/91f10e1/index.html

@github-actions
Copy link

Job PR-3239-01ced30 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-3239/01ced30/index.html

@yinweisu yinweisu merged commit 109b773 into autogluon:master May 31, 2023
29 checks passed
@yinweisu yinweisu deleted the include_model_types branch May 31, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants