How to build a simple neural network in 9 lines of Python code

Steve D'Aprano steve+python at pearwood.info
Tue Jun 27 21:20:47 EDT 2017


On Wed, 28 Jun 2017 05:34 am, Marko Rauhamaa wrote:

> John Ladasky <john_ladasky at sbcglobal.net>:
>> OK, that's cheating a bit, using Numpy. It's a nice little program,
>> but it leverages a huge, powerful library.
> 
> What would *not* be cheating? A language without a library would be
> dead.

Its not really nine lines of Python. It's nine lines of Python, to call a
library of many thousands of lines of C, Fortran and Python.

And its not really a neural *network* as such, more like just a single neuron.

Starting from scratch with just the Python language and standard library, no
external third party code, how quickly can you write a neural network? I think
the answer is probably a wee bit more than "nine lines".



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list