I got a beer for anyone who can golf it under 5 lines
I got a beer for anyone who can golf it under 5 lines
https://gist.github.com/applecrazy/deda2fac6e83c07b93e001731...
Edit: I literally took newlines, converted to \n in a string, and then exec()ed the whole thing. Here's a repl of it working: https://repl.it/@applecrazy/Code-Golfing-a-Neural-Net
PM address if you want the beer, you sly dog. Obligatory, I'm a normal dude: http://vesche.github.io/
Edit: Wait, you can't PM on here... PM on reddit /u/vesche
* Remove 'import numpy as n' and use __import__('numpy') in place of it everywhere
* Remove s and d functions; inline them where they're called
* Get rid of 'class N', as it's unnecessary. If adding globals is cheating, then you can do '__import__('math').x = x' instead of 'self.x = x' (yes this will work and persist).
* Technically, you don't have to print the result at the end
Where do I go for my beer?