-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[dask] add tests on warnings, fix incorrect variable in log #3865
Conversation
Could you please setup Line 42 in 066720e
|
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.
Thanks! Just one proposal for even more informative name.
dask_regressor = dask_regressor.fit(X, y, client=client) | ||
|
||
assert dask_regressor.fitted_ | ||
assert dask_regressor.get_params()['tree_learner'] == tree_learner |
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.
Just wonder: is it possible to access params via attributes like it can be done in sklearn-wrapper?
dask_regressor.tree_learner
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! I haven't tested. I didn't actually know the sklearn interface supported that.
But either way, I have a preference for get_params()
here because it also gives us some confidence that this is working:
LightGBM/python-package/lightgbm/dask.py
Lines 419 to 420 in 59153b2
self.set_params(**model.get_params()) | |
self._copy_extra_params(model, self) |
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.
Exactly set_params()
should set attributes btw
LightGBM/python-package/lightgbm/sklearn.py
Lines 358 to 376 in b4b1b75
def set_params(self, **params): | |
"""Set the parameters of this estimator. | |
Parameters | |
---------- | |
**params | |
Parameter names with their new values. | |
Returns | |
------- | |
self : object | |
Returns self. | |
""" | |
for key, value in params.items(): | |
setattr(self, key, value) | |
if hasattr(self, '_' + key): | |
setattr(self, '_' + key, value) | |
self._other_params[key] = value | |
return self |
Co-authored-by: Nikita Titov <[email protected]>
sure! Sounds like an excellent |
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
While working on #3756 , I've been running
mypy python-package/
. This caught a bug in my refactoring from recent PRs (not sure which one).This PR fixes that, and adds unit tests to cover the behavior under the two warnings in
lightgbm.dask._train()
.