Repository navigation
[MRG] speed up RBM training with scipy.special.expit - #2882
Conversation
|
Ping @vene, @ogrisel, @IssamLaradji. |
|
+1 for using scipy expit implementation. Ok for the |
|
+1 for the implementation. Undecieded between |
|
In any case, both functions refer to each other and I already got a patch in SciPy to make their documentation less confusing (I found |
Same thing here. But the name is so confusing that each import should say |
There was a problem hiding this comment.
I think that it would be good to keep a backward-compatible symbol for one or two versions, as some people might be using it.
|
I am of course +1 for merge, but I have two comments:
|
SciPy 0.10 already has an implementation of the logistic function called scipy.special.expit. Using this makes RBM training 12% faster, as measured by observing the time per iteration as reported by the plot_rbm_logistic_classification.py example, disregarding the first iteration as an outlier (it's consistently faster than the rest, not sure why). The speedup is in the expit function, not the inplace operations; those are there to make benchmarking easier, but they certainly won't hurt.
For backward compat only, so immediately deprecated.
|
Ok, reinstated |
|
As far as I am concerned, this is good to merge. I have one additional nitpick (optional): can/should the |
|
That's a Cython function. |
I am sorry. I made this comment in St Pancras, before boarding the 👍 for merge. Thanks for your work, as always! |
|
That's ok :) +1 from Gaël and Olivier, merging; Vlad, if you object to the (shorter) function name, feel free to change it in master. |
Speed up RBM training with scipy.special.expit
|
I am honored to be pinged and to have a say in this (I hope it wasn't by mistake :P), it indeed has made multilayer perceptron faster. In one test case, it decreased the running time from 10.15 seconds to 8.4 seconds; that's around 17% decrease! |
You are an active contributor knowledgeable on this part of the codebase. Gaël |
+1, Thank you thank you :) ~Issam |
|
I think |
|
Just thought I'd point out that |
|
Hmm... it passes our stability tests, and I haven't seen trouble with it yet. Maybe we need some better tests. |
|
Confirmed, when I crank the logit in the test up to 710, I get NaN. 710 is not even an extreme number of features or hidden units... |
|
@argriffing: what's 'recently'? For what scipy version should we start |
|
@GaelVaroquaux I think the PR I linked has made it into 0.14 which is in the process of being released. |
OK, thanks. So I am afraid that that means that we can support scipy's |
Fixes issue reported by @argriffing at #2882: expit is buggy in SciPy < 0.14 (to be released). Switch implementation back to old one based on stability test; toughened unit tests.
|
@larsmans did you run the test on scipy master branch (future 0.14 release)? do the test pass? Is the speed up still as important with scipy 0.14's expit implementation? |
|
Also @larsmans what do you think of @mblondel's observation at #2882 (comment) ? I think I tend to agree with him. |
|
@ogrisel I used SciPy 0.12. The next release should get an even faster expit. As for the name, feel free to change it back. I don't like "expit" either, but I went for compatibility. |
|
FYI: SciPy 1.8.0 will have I see there is no love for the name |
SciPy 0.10 already has an implementation of the logistic function called
scipy.special.expit. Moved ourlogistic_sigmoidtofixes.expit, keeping its log-of-logistic functionality aslog_logistic(should that belog_expit? I don't like the nameexpitat all.)Using this makes RBM training 12% faster, as measured by observing the time per iteration as reported by the
plot_rbm_logistic_classification.pyexample, disregarding the first iteration as an outlier (it's consistently faster than the rest, not sure why). The speedup is in theexpitfunction, not the inplace operations; those are there to make benchmarking easier, but they certainly won't hurt.