A highly optimized version of Andrew Trask's Sentiment Classification from Deep Learning ND on Udacity
I have taken Andrew Trask's notebook on Sentiment Classification and have tried to hyper optimize a number of routines following a set of two rules,
- Use vectorization as much as possible
- Avoid loops at all costs
To search for the optimizations directly, do a Ctrl+F
and look for the My Implementation
tag.
You would use such techniques in writing production ready code in Python. My optimizations are on an average 25% faster than the default solution, with over 250% (2.5x!) performance gain in a few places.
PS - I think Andrew Trask didn't use the complicated expressions in order to keep the whole tutorial beginner friendly - Kudos to him!