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 Check for nonfinite in mlp models #22150
ENH Check for nonfinite in mlp models #22150
Conversation
7727878
to
d9fc9ca
Compare
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.
Thank you for the PR @chritter !
for coef, inter in zip(self.coefs_, self.intercepts_) | ||
] | ||
): | ||
raise ValueError("Solver produced non-finite parameter weights.") |
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.
Similar comment from https://github.com/scikit-learn/scikit-learn/pull/22149/files#r780722680 We can adjust the message so users know what they can do about it.
raise ValueError("Solver produced non-finite parameter weights.") | |
raise ValueError("coefs or intercepts have non-finite parameter weights. " | |
"The input data may contain large values and need to be " | |
"preprocessed.") |
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.
May you include the second part of the message?
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.
May you include the second part of the error message?
Co-authored-by: Norbert Preining <norbert@preining.info>
d9fc9ca
to
3f4c5e1
Compare
test_nonfinite_params test data now generated; test parameter in mlp with itertools Co-authored-by: Norbert Preining <norbert@preining.info>
Great suggestions @thomasjpfan which I adopted. Thank you! |
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 for the update!
doc/whats_new/v1.1.rst
Outdated
:mod:`sklearn.neural_network` | ||
............................. |
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.
Nit: May we move this header up such that the modules are in alphabetical order?
for coef, inter in zip(self.coefs_, self.intercepts_) | ||
] | ||
): | ||
raise ValueError("Solver produced non-finite parameter weights.") |
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.
May you include the second part of the message?
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 for the update!
for coef, inter in zip(self.coefs_, self.intercepts_) | ||
] | ||
): | ||
raise ValueError("Solver produced non-finite parameter weights.") |
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.
May you include the second part of the error message?
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.
I left a minor comment, otherwise LGTM!
doc/whats_new/v1.1.rst
Outdated
@@ -462,6 +470,7 @@ Changelog | |||
left corner of the HTML representation to show how the elements are | |||
clickable. :pr:`21298` by `Thomas Fan`_. | |||
|
|||
|
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 change is unrelated. Can you revert?
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.
@Thomas9292 This change entry was not introduced in this PR, so I believe no change is needed. Could you clarify?
Note that
- |Enhancement| :func:`utils.estimator_html_repr` displays an arrow on the top
left corner of the HTML representation to show how the elements are
clickable. :pr:`21298` by `Thomas Fan`_.
is a unique entry.
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.
There is an extra newline added 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.
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 for the clarification.
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.
LGTM after addressing @thomasjpfan's comments.
improved changelog description Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
@jjerphan Thank you for the review and for the suggestions. Adopted. |
* non-finite check in mlp params. Co-authored-by: Norbert Preining <norbert@preining.info> * added changelog entry * updated changelog * simplied nonfinite param check and test; test_nonfinite_params test data now generated; test parameter in mlp with itertools Co-authored-by: Norbert Preining <norbert@preining.info> * reformatting test file * update changelog formatting to pass circleci check * update changelog location alphabetic, extended error message and test * removed empty line in whatsnew * Apply suggestions from code review improved changelog description Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Norbert Preining <norbert@preining.info> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Reference Issues/PRs
Addresses #17925.
What does this implement/fix? Explain your changes.
This implements check for non-finite values of estimator parameters: as produced from optimizers in MLP models.
Any other comments?
Work done with @norbusan.
Originally part of larger PR #22092