-
Notifications
You must be signed in to change notification settings - Fork 861
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
Fix AutoMM usage of text in TabularPredictor #2628
Conversation
Job PR-2628-384e3f4 is done. |
@@ -1606,8 +1606,14 @@ def _ag_params(self) -> set: | |||
def _features(self): | |||
return self._features_internal | |||
|
|||
def _get_tags(self): | |||
collected_tags = {} | |||
def _get_tags(self) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussion point: maybe call these capabilities
vs tags
? Tags seems too generic and not pointing to the main purpose of this labeling: what functionality is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the API used by sklearn for this logic, so I'd prefer to be consistent with them.
|
||
@classmethod | ||
def _class_tags(cls): | ||
return {'handles_text': False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move these constants to a separate constant class where they can be fully documented + reduces likelihood of typos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scikit-learn just uses strings: https://github.com/scikit-learn/scikit-learn/blob/ac665ad80be586a90c7d353ed37f1e64a4f547a1/sklearn/neighbors/_classification.py#L712-L713
I think we can also just use strings unless it becomes a problem.
is_advanced_hyperparameter_type = False | ||
for key in hyperparameters: | ||
if isinstance(key, int) or key == 'default': | ||
is_advanced_hyperparameter_type = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add break
to skip the rest of the cycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
if is_advanced_hyperparameter_type: | ||
for key in hyperparameters: | ||
for m in hyperparameters[key]: | ||
models_in_hyperparameters.add(m) | ||
else: | ||
for key in hyperparameters: | ||
models_in_hyperparameters.add(key) | ||
models_in_hyperparameters_raw_text_compatible = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for key, m in hyperparameters.items():
models_in_hyperparameters.add(m if is_advanced_hyperparameter_type else key)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x = {1: {'GBM': {}}}
a = set()
is_advanced_hyperparameter_type = True
for key, m in x.items():
a.add(m if is_advanced_hyperparameter_type else key)
Traceback (most recent call last):
File "/Users/neerick/workspace/virtual/autogluon38/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-8-2d35d45650af>", line 2, in <module>
a.add(m if is_advanced_hyperparameter_type else key)
TypeError: unhashable type: 'dict
The proposed code is not the same and will error.
Job PR-2628-58f7dac is done. |
Issue #, if available:
Description of changes:
handles_text=True
in_class_tags
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.