8000 [MRG+1] MNT Use std math lib log1p instead of np.log1p in cython inner loops by amueller · Pull Request #11848 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG+1] MNT Use std math lib log1p instead of np.log1p in cython inner loops #11848

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

Merged
merged 1 commit into from
Aug 18, 2018

Conversation

amueller
Copy link
Member

Reference Issues/PRs

Fixes performance regressions introduced in #11428 as discussed in #11476 (comment)

We should be using low level C functions in inner loops, not numpy functions.

@amueller amueller changed the title use std math lib log1p instead of numpy log1p in cython inner loops use std math lib log1p instead of np.log1p in cython inner loops Aug 17, 2018
@amueller amueller added this to the 0.20 milestone Aug 17, 2018
@amueller
Copy link
Member Author
amueller commented Aug 17, 2018

FYI this if in the logistic function has pretty significant impact of the logistic regression runtime :-/ (or I'm hallucinating, not sure. scipy doesn't use the if right now it seems https://github.com/scipy/scipy/blob/master/scipy/special/_logit.c.src#L31 )

Copy link
Member
@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I can reproduce the regression. Sorry for the regression.

@qinhanmin2014 qinhanmin2014 changed the title use std math lib log1p instead of np.log1p in cython inner loops [MRG+1] MNT Use std math lib log1p instead of np.log1p in cython inner loops Aug 18, 2018
@qinhanmin2014 qinhanmin2014 merged commit 07e909a into scikit-learn:master Aug 18, 2018
@rth
Copy link
Member
rth commented Aug 18, 2018

This failed in Appeveyor 32 bit on master, with,

ball_tree.obj : error LNK2019: unresolved external symbol _log1p referenced in function ___pyx_f_7sklearn_9neighbors_9ball_tree__log_kernel_norm
build\lib.win32-2.7\sklearn\neighbors\ball_tree.pyd : fatal error LNK1120: 1 unresolved externals

@qinhanmin2014
Copy link
Member
qinhanmin2014 commented Aug 18, 2018

This failed in Appeveyor 32 bit on master, with,

This is a rare accident. An error occurred in the PR (other jobs passed) so the failure is not detected. Possible solution might be simply revert the cython part of #11428

@qinhanmin2014
Copy link
Member

FYI I use log instead of log1p to pass the test on 32-bit Windows. See #11852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0