Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[dupe] A Neural Network in 11 Lines of Python (iamtrask.github.io)
82 points by devy on March 28, 2016 | hide | past | favorite | 16 comments


I 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.


Per 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...


I love your blog, keep up the good work.


Thank you!


I 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).



I 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.


Cool 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.


@froh42: What browser you were using? I read the article using Firefox on my PC (Windows 7) and I don't have any problems.


derivative of sigmoid is wrong. should be sigmoid(x)*(1 - sigmoid(x))


It 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.


Correct. I believe most implementations do it this way for efficiency... but my naming could be better.


bad python code (why `if var==True:` instead just `if var:`) also linting would go crazy, use spaces ;)

great example though!! ;)


Looks like a nice article with lots of relevant content and code! Thanks for the in-depth piece iamtrask.


perhaps 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.


12 lines. He forgot to import numpy. Pretty cool though.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: