Live data from Hacker News

How to build your own neural network from scratch in Python

towardsdatascience.com

31–40 of 46 posts

Re: How to build your own neural network from scratch in Python

#31
post #19

Earlier quoted context omitted.

Naive solution (1 line): 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

Oh dear, I got played. 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

Well, I don't drink (see my bio), but thanks for the offer. :P

Re: How to build your own neural network from scratch in Python

#32
Honest question: what are the reasons to code this up using OOP, creating a neural network object plus methods, instead of data structures and functions that operate on them?

If it’s just personal preference, I’m fine with that, I’m not trying to start a flame war.

Re: How to build your own neural network from scratch in Python

#33
This is not as glorified as it sound. 100 of thousands of students around the world build neural net from scratch as their homework. People please move on, spend your time somewhere else which is more productive. I coded neural network using c++ in 2009 as homework. But I never though about showing this to people.

Re: How to build your own neural network from scratch in Python

#34

This is not as glorified as it sound. 100 of thousands of students around the world build neural net from scratch as their homework. People please move on, spend your time somewhere else which is more productive. I coded neural network using c++ in 2009 as homework. But I never though about showing this to people.

> People please move on

Strange reaction to a “beginner’s guide”, how can someone move on before they learn the basics?

Re: How to build your own neural network from scratch in Python

#35
post #2

Too often you see articles like this and they start with $ import a_whole_bunch_of_stuff Good to see that this is not the case here :) The fast.ai course has a similar exercise in the beginning, but you'll still import the weights from somewhere else. Their fast.ai v1 library has a very short implementation too (loading the MINIST example dataset and then using Resnet18): from fastai import * from fastai.data import…

How is your example not "$ import a_whole_bunch_of_stuff"?

This notebook from fast.ai is more in line with what op mentioned. It starts from nothing but Python and slowly swaps out chunks of code with functions/classes from Torch/fastai:

https://github.com/fastai/fastai/tree/master/courses/dl1

Re: How to build your own neural network from scratch in Python

#36
post #19

Earlier quoted context omitted.

Naive solution (1 line): 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

Oh dear, I got played. 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

I will accept the beer in his stead.

Re: How to build your own neural network from scratch in Python

#38

Earlier quoted context omitted.

You always have to start somewhere. Do you want to code all the OS from the ground up, or do you have minimal expectations about the environment your software will run on? Do you want to look at all the tiny details, or do you wish to focus on a specific aspect of the problem? The article author could also give an explanation of linear algebra, but I guess he expects the reader to be familiar with this part of the pr…

> I guess that there's always a software layer which may be considered "backbone". The point is that you don't need any software layers at all to code up a basic neural network implementation. A programming language with basic floating-point operations is all you need. The algorithms are not complicated so even x86 Assembly is practical for this purpose if you're already experienced with it. So the "backbone" can sim…

> The point is that you don't need any software layers at all to code up a basic neural network implementation.

I grafted my answer to the wrong post, I meant to respond to the guy talking about the project implicitely using Numpy.

Offtopic remark: It would be nice to be able to move a post to a different thread, or make a single answer to several messages.

Re: How to build your own neural network from scratch in Python

#39

I suggest a remarkably useful device: Four circular disks when attached to a cart make it easy to move the cart from location to another. Furthermore you could put goods in that cart and move them too. A lot easier than carrying the goods on you back or an animal. A brief search of the internet finds this is a new idea.

What do the disks do? A cart already moves pretty easily on it's wheels, so how much improvement have you made by attaching these disks to it?

Re: How to build your own neural network from scratch in Python

#40
post #32

Honest question: what are the reasons to code this up using OOP, creating a neural network object plus methods, instead of data structures and functions that operate on them? If it’s just personal preference, I’m fine with that, I’m not trying to start a flame war.

Python, both the language and community, are very strong proponents of OOP. While you can do a lot of more functional stuff, esp. w/ functools, the community at large tends to discourage that. "Never use map/filter" is a weirdly common phrase among pythonistas. So this, like most python-driven examples, is doing things in a pythonic way.

Coming from the R side, I tend to prefer structures & functions as well, but if I tried to write Python that way I'd be wary about showing that code to anyone more entrenched in the Pythonic way of thinking.

Post reply on HN