Use scipy.special.xlogy to avoid indefinite limit in 0 for x*log(y) #12915
Merged
qinhanmin2014 merged 3 commits intoscikit-learn:masterfrom Jan 3, 2019
Merged
Use scipy.special.xlogy to avoid indefinite limit in 0 for x*log(y) #12915qinhanmin2014 merged 3 commits intoscikit-learn:masterfrom
qinhanmin2014 merged 3 commits intoscikit-learn:masterfrom
Conversation
rth
commented
Jan 3, 2019
| learning_rate_init=0.2) | ||
| mlp.fit(X, y) | ||
| assert_equal(mlp.score(X, y), 1) | ||
| assert_greater(mlp.score(X, y), 0.97) |
Member
Author
There was a problem hiding this comment.
This fails otherwise, as the score is 0.98 in this case.
Testing that mean test accuracy is exactly 1 on this random dataset with those parameters doesn't sound too robust, and the change of the numerical accuracy in log loss might have been enough to break this condition.
TomDLT
approved these changes
Jan 3, 2019
qinhanmin2014
approved these changes
Jan 3, 2019
Member
|
I guess we don't need tests and what's new here. |
adrinjalali
pushed a commit
to adrinjalali/scikit-learn
that referenced
this pull request
Jan 7, 2019
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…r x*log(y) (scikit-learn#12915)" This reverts commit 6b476ca.
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…r x*log(y) (scikit-learn#12915)" This reverts commit 6b476ca.
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
x*log(y)is undefined when bothxandyare zero,currently we avoid this by clipping
xandyto a very small value (e.g. 1e-10) instead of 0.A cleaner solution is to use
scipy.special.xlogy,which produces the correct limit in 0 and has a comparable performance otherwise.