Live data from Hacker News

Implementing a Neural Network from Scratch in Python

victorzhou.com

11–20 of 104 posts

Re: Implementing a Neural Network from Scratch in Python

#11

"We’ll use an optimization algorithm called stochastic gradient descent (SGD) that tells us how to change our weights and biases to minimize loss. It’s basically just this update equation: w1 ← w1 − η ∂w|∂L η is a constant called the learning rate that controls how fast we train. All we’re doing is subtracting η ∂w|∂L from w1: - If ∂L | ∂w1 is positive, w1 will decrease, which makes L decrease - If ∂L | ∂w1 is positi…

?

Re: Implementing a Neural Network from Scratch in Python

#12

"We’ll use an optimization algorithm called stochastic gradient descent (SGD) that tells us how to change our weights and biases to minimize loss. It’s basically just this update equation: w1 ← w1 − η ∂w|∂L η is a constant called the learning rate that controls how fast we train. All we’re doing is subtracting η ∂w|∂L from w1: - If ∂L | ∂w1 is positive, w1 will decrease, which makes L decrease - If ∂L | ∂w1 is positi…

I think this comment is facetious (apologies if I’m reading it incorrectly), so I want to offer that this is “simple”, but opaque to someone who is unfamiliar with the syntax or background context.

Andrew Ng’s course on machine learning from Stanford (on Coursera, which you should be able to audit for free) gives great intuitive explanations of these topics, if you’re curious enough to invest a couple solid weekends to get the foundations. The foundations alone will get you very far indeed.

Re: Implementing a Neural Network from Scratch in Python

#13

"We’ll use an optimization algorithm called stochastic gradient descent (SGD) that tells us how to change our weights and biases to minimize loss. It’s basically just this update equation: w1 ← w1 − η ∂w|∂L η is a constant called the learning rate that controls how fast we train. All we’re doing is subtracting η ∂w|∂L from w1: - If ∂L | ∂w1 is positive, w1 will decrease, which makes L decrease - If ∂L | ∂w1 is positi…

I think it's supposed to be dL/dw1. As in the loss function derived wrt w1.

Re: Implementing a Neural Network from Scratch in Python

#14
I started playing around with NN-s recently and this looked like a good tutorial until the partial derivatives :) It would have been so much better to turn a complex math concept like that to code in smaller chunks because it's hard to extract from the full sample which part refers to which equation.

Also, the bias is not explained at all.

- Why is it there?

- What does it do?

- What value should it have?

Re: Implementing a Neural Network from Scratch in Python

#15
post #2

My first reading of this headline was "Implementing a Neural Network in Scratch". Now that I would like to see. https://scratch.mit.edu/

That would be a challenge.

Back in the heyday of expert systems and original Mac’s, I did an expert system in Hypercard. Not really production worthy. But interesting from perspective of exploring UI.

Re: Implementing a Neural Network from Scratch in Python

#18

I started playing around with NN-s recently and this looked like a good tutorial until the partial derivatives :) It would have been so much better to turn a complex math concept like that to code in smaller chunks because it's hard to extract from the full sample which part refers to which equation. Also, the bias is not explained at all. - Why is it there? - What does it do? - What value should it have?

I currently publish a series of detailed articles that cover exactly that.

https://dragan.rocks/articles/19/Deep-Learning-in-Clojure-Fr...

Re: Implementing a Neural Network from Scratch in Python

#19
post #2

My first reading of this headline was "Implementing a Neural Network in Scratch". Now that I would like to see. https://scratch.mit.edu/

Ha, that's an excellent idea. Someone's already started by creating a program for matrix multiplication: https://scratch.mit.edu/projects/18640517/

Re: Implementing a Neural Network from Scratch in Python

#20
I didn't have time to read all of it, but half way through. So far it has bee a pretty good write up, however, just one question.

Can the author or anyone explain how were the amount for values shifted chosen? I.e. Weight (minus 135) and Height (minus 66). Why was -135 and -66 chosen? An explanation would be helpful. Thanks!

Post reply on HN