Live data from Hacker News

Neural network from scratch

sirupsen.com

21–30 of 43 posts

Re: Neural network from scratch

#21
post #20

I think NNs are going to be a challenge as complexity grows. I'm trying to make mobs behave autonomously in my 3D action MMO. The memory (depth) I would need for that to succeed and the processing power to do it in real-time is making my head spin. Let's hope Raspberry 5 has some hardware to help with this. At this point I'm probably going to have some state machine AI (think mobs in Minecraft; basically check range…

Have you tried using something more efficient and precise, for example a flocking algorithm?

https://www.oreilly.com/library/view/ai-for-game/0596005555/...

Neural nets and machine learning in general are good for problems whose solutions are hard to hand-code. If you can hand-craft a solution there's no real need for machine learning and it might simply take up resources you need more elsewhere.

Re: Neural network from scratch

#22

Earlier quoted context omitted.

The difference is that autograd isn't something you should already know if you're learning neural networks. Many "from scratch" tutorials implement backprop because this is a key part. I think your comment is a bit facetious and you're not acting in good faith.

I could definitely see an argument that knowing gradient descent is a requisite just as much as knowing matrix multiplication. Both of these mathematical concepts are being abstracted over and are being used by the author's neutral network implementation. Now whether you consider using other people's libraries for this as being "from scratch" is up to you.

[deleted]

Re: Neural network from scratch

#23
Interesting read, but there's a few things I haven't understood. In the training [function](https://colab.research.google.com/drive/1YRp9k_ORH4wZMqXLNkc...):

1- In the instruction `hidden_layer.data[index] -= learning_rate * hidden_layer.grad.data[index]`where was the `hidden_layer.grad` value updated?

2- from what I've understood, we'll update the hidden_layer according to the inclination of the error function (because we want to minimize it). But where are `error.backward()` and `hidden_layer.grad` interconnected?

Re: Neural network from scratch

#24

If you actually want to understand and implement neural nets from scratch, look into 3Blue1Brown's videos as well as Andrew Ng's course. https://www.3blue1brown.com/topics/neural-networks https://www.coursera.org/learn/machine-learning

I completed Andrew Ng's Coursera course and one thing it did not do is make me understand neural nets from scratch. Probably, you and I have different interpretation of "from scratch".

Re: Neural network from scratch

#25
post #23

Interesting read, but there's a few things I haven't understood. In the training [function]( https://colab.research.google.com/drive/1YRp9k_ORH4wZMqXLNkc... ): 1- In the instruction `hidden_layer.data[index] -= learning_rate * hidden_layer.grad.data[index]`where was the `hidden_layer.grad` value updated? 2- from what I've understood, we'll update the hidden_layer according to the inclination of the error function (be…

Great questions, I struggled with this part the most when I was learning it.

`.grad` is set by `autograd` when calling `backward()`

Probably the easiest way to understand this is to play a bit with `.grad` and `backward()` on their own, with the first code sample in the `autograd` section [1].

[1]: https://sirupsen.com/napkin/neural-net#automagically-computi...

Re: Neural network from scratch

#26
post #20

I think NNs are going to be a challenge as complexity grows. I'm trying to make mobs behave autonomously in my 3D action MMO. The memory (depth) I would need for that to succeed and the processing power to do it in real-time is making my head spin. Let's hope Raspberry 5 has some hardware to help with this. At this point I'm probably going to have some state machine AI (think mobs in Minecraft; basically check range…

Have you tried using something more efficient and precise, for example a flocking algorithm? https://www.oreilly.com/library/view/ai-for-game/0596005555/... Neural nets and machine learning in general are good for problems whose solutions are hard to hand-code. If you can hand-craft a solution there's no real need for machine learning and it might simply take up resources you need more elsewhere.

This is actually something I see as complementary, so the AI on the server has to decide the general direction and then on the client these flocking simulations can be applied for scale if you have the processing power.

I'm thinking each group of mobs has a server directed leader, who's position is server deterministic and then to save bandwidth the PvE minions and their movements can be generated on each client, just tracking when they are killed.

I'm not scared of desyncing in the details. As long as the PvP stuff is coherent.

Re: Neural network from scratch

#27
post #20

I think NNs are going to be a challenge as complexity grows. I'm trying to make mobs behave autonomously in my 3D action MMO. The memory (depth) I would need for that to succeed and the processing power to do it in real-time is making my head spin. Let's hope Raspberry 5 has some hardware to help with this. At this point I'm probably going to have some state machine AI (think mobs in Minecraft; basically check range…

[deleted]

Re: Neural network from scratch

#28
post #23

Interesting read, but there's a few things I haven't understood. In the training [function]( https://colab.research.google.com/drive/1YRp9k_ORH4wZMqXLNkc... ): 1- In the instruction `hidden_layer.data[index] -= learning_rate * hidden_layer.grad.data[index]`where was the `hidden_layer.grad` value updated? 2- from what I've understood, we'll update the hidden_layer according to the inclination of the error function (be…

Great questions, I struggled with this part the most when I was learning it. `.grad` is set by `autograd` when calling `backward()` Probably the easiest way to understand this is to play a bit with `.grad` and `backward()` on their own, with the first code sample in the `autograd` section [1]. [1]: https://sirupsen.com/napkin/neural-net#automagically-computi...

Thank you!

Re: Neural network from scratch

#30

If you actually want to understand and implement neural nets from scratch, look into 3Blue1Brown's videos as well as Andrew Ng's course. https://www.3blue1brown.com/topics/neural-networks https://www.coursera.org/learn/machine-learning

I actually tried to implement a neutral network from scratch by following 3blue1Browns videos, and using the same handwritten number data set. But I got stumped when I realized I didn't have a clue how to choose the step size in gradient descent, and it's not covered in the videos. Despite that problem I'd say the 3B1B videos are excellent for learning the fundamentals of neural networks.
Post reply on HN