5 ms·
A Neural Network in 11 Lines of Python
- ktRolster 11y agoI thought it would be using a library, and I thought to myself, "of course, 11 lines is easy." But all it uses is numpy. Pretty cool.
- froh42 11y agoCool article, absolutely annoying CSS theme - as I tend to scroll back a little the title bar is jiggling in and out all the time. A number of sites uses this and this is SOOO distracting.
- skypather 11y ago@froh42: What browser you were using? I read the article using Firefox on my PC (Windows 7) and I don't have any problems.
- kbenson 11y ago12 lines. He forgot to import numpy. Pretty cool though.
- gambler 11y agoI am sick of reading about anything "deep" and "neural" on Hacker News (especially hype/puff pieces), but this blog post is so well-written that I'm upvoting it despite being about ANNs. I guess proper knowledge is the opposite of hype anyway. I wish research papers on AI were a bit more like this and bit less like what they are.
- iamtrask 11y agoPer your last comment, I'm thinking about changing this blog series to be a "blog" version of academic papers... starting with this one. https://iamtrask.github.io/2016/02/25/deepminds-neural-stack-machine/ https://iamtrask.github.io/2016/02/25/deepminds-neural-stack...
- partycoder 11y agoI love your blog, keep up the good work.
- williamtrask 11y agoThank you!
- gambler 11y agoI think that's a great idea. At this point in time, there is so much stuff going on the CS/AI/ML domain that translating research papers into something people can read without incalculable suffering might be as important and valuable as research itself. After all, many of those papers concern things that almost anyone with access to a computer can actually implement and use. PS: Bonus points for anything that diverges from the current mainstream (like SVMs or boosting).
- zem 11y agoyou should appreciate this one too: http://makerstutorial.blogspot.com/2008/08/how-to-build-electronic-neuron.html http://makerstutorial.blogspot.com/2008/08/how-to-build-elec...
- roguas 11y agobad python code (why `if var==True:` instead just `if var:`) also linting would go crazy, use spaces ;) great example though!! ;)
- qmmm 11y agoderivative of sigmoid is wrong. should be sigmoid(x)*(1 - sigmoid(x))
- zodiac 11y agoIt seems like when he passes deriv=True in line 36 the first argument is the output of a previous nonlin, so it actually is the correct derivative.
- williamtrask 11y agoCorrect. I believe most implementations do it this way for efficiency... but my naming could be better.
- zenlikethat 11y agoLooks like a nice article with lots of relevant content and code! Thanks for the in-depth piece iamtrask.
- senthil_rajasek 11y agoperhaps the best thing I learned from this blog post is (in the author's own words), "I worked with neural networks for a couple years before performing this exercise..." This contradicts the title. It may be 11 lines of python but not before 2 years of learning neural networks.