You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following change increases the performance of typical calls to sigmoid and sigmoid_prime by roughly 50x.
Total performance impact on dlgo/nn/run_network.py is around 100% improvement.
The reason is roughly that np.vectorize just coerces types to be able to call a non-numpy (scalar) function. It doesn't smartly compile it to ufuncs or anything.
@jeffhgs thanks for your addition. Actually, we're completely aware of this. Two things:
a) Chapter 5 is "optimized" for readability, aimed at beginners. I hope you see how your performance bump is a little less readable for someone getting started.
b) The master branch should stay in sync with the book. Exceptions: clarifications and bug fixes / errata.
Having said that, I don't want your work to go to waste. I'm thinking about having an improvements branch people can open PRs against. Would that work for you? I'll put this on the readme as well. 👍
Note for contributors: To ensure the book stays in sync, consider requesting changes and submitting pull requests against the improvements branch, instead of master (which we keep reserved for bug fixes etc.).
Sure, a branching policy to preserve book sync totally seems appropriate.
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
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.
Hi guys, loving the new book. Great job.
The following change increases the performance of typical calls to sigmoid and sigmoid_prime by roughly 50x.
Total performance impact on dlgo/nn/run_network.py is around 100% improvement.
The reason is roughly that np.vectorize just coerces types to be able to call a non-numpy (scalar) function. It doesn't smartly compile it to ufuncs or anything.
Docs:
Below are a few benchmarks of variations on the sigmoid functions to illustrate the phenomena. Tested with jupyter's "%timeit" on a 2015 Macbook Pro.