-
Notifications
You must be signed in to change notification settings - Fork 533
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
Make _get_tags
a class/static method
#3257
Conversation
…ds in inheriting estimators
_get_tags
a class/static method
Please update the changelog in order to start CI tests. View the gpuCI docs here. |
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.
Changes look good. Only one minor suggestion to add an assertion to the tags test to make sure new methods going forward aren't instance or class methods.
python/cuml/test/test_api.py
Outdated
# mod = models[model_name] | ||
# assert hasattr('_get_tags', m) | ||
|
||
# for tag in tags: | ||
# assert | ||
assert hasattr(model, '_get_tags') | ||
|
||
print(model) | ||
if model in (cuml.tsa.auto_arima.AutoARIMA, cuml.tsa.arima.ARIMA, | ||
cuml.tsa.holtwinters.ExponentialSmoothing): | ||
mod = model(cp.ones(10)) | ||
else: | ||
mod = model() | ||
|
||
assert hasattr(mod, '_get_tags') | ||
|
||
model_tags = mod._get_tags() |
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.
Immediately you can see how much better the testing will be with static tags
Co-authored-by: Michael Demoret <42954918+mdemoret-nv@users.noreply.github.com>
rerun tests |
_get_tags
a class/static method _get_tags
a class/static method [skip-ci]
_get_tags
a class/static method [skip-ci]_get_tags
a class/static method
rerun tests |
@mdemoret-nv yeah was just busy debugging other things, will push the changes you request early tomorrow and ping you for a re-review, thanks! |
_get_tags
a class/static method_get_tags
a class/static method [skip-ci]
_get_tags
a class/static method [skip-ci]_get_tags
a class/static method
_get_tags
a class/static method_get_tags
a class/static method [skip-ci]
Co-authored-by: Michael Demoret <42954918+mdemoret-nv@users.noreply.github.com>
Co-authored-by: Michael Demoret <42954918+mdemoret-nv@users.noreply.github.com>
_get_tags
a class/static method [skip-ci]_get_tags
a class/static method
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.
Looks good to me. I think this will be useful to get merged. We can start reworking some of the hard-coded tests to use the mixins.
assert static_tags['preferred_input_order'] == 'F' | ||
assert dynamic_tags['preferred_input_order'] == 'F' |
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.
In this case, wouldnt it be better to error out since this clearly would be an error? Or are you testing this for overriding purposes?
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.
Yeah, this test to be sure that the closest thing to the class in the MRO overwrites the farthest ones, added a quick comment to separate both tests and a quick note on the estimator guide about the MRO resolution and how that can affect tags.
Codecov Report
@@ Coverage Diff @@
## branch-0.19 #3257 +/- ##
===============================================
+ Coverage 71.77% 80.83% +9.05%
===============================================
Files 212 226 +14
Lines 17075 17705 +630
===============================================
+ Hits 12256 14311 +2055
+ Misses 4819 3394 -1425
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@gpucibot merge |
From suggestion and talks with @mdemoret-nv we came to the conclusion that the
_get_tags
function is very useful as a class/static method, so this PR changes it.If we require tags that are instance based, we can extend/modify the method in the future, but for now this seems like the best balance of simplicity and usefulness.