Great video! Since you asked for further suggestions ;) 1) In the feedForward method in the Level class, we can refactor various things: a) The first for-loop may be simply replaced by level.inputs = givenInputs. b) The nested for-loop, where the sum is computed, can be replaced by using the array method "reduce". c) The if-clause can be replaced by a ternary operator. 2) In the feedForward method in the NeuralNetwork class, we can get rid of the code duplication as follows: Initialize ouputs = givenInputs. Then start the for-loop with index i=0.
Thanks :-) For 1 a), I don't remember why I did that. It could be something not obvious at this stage... maybe we need a deep copy later when parallelizing and visualizing things. But now I can already imagine you saying level.inputs = [... givenInputs] :-)) All others are nice ideas as well, especially since I don't use "reduce" at all during this course. Will keep them in mind for future courses.
Full self-driving car course playlist (3 lectures still to come on visualization, optimization and fine-tuning): czcams.com/play/PLB0Tybl0UNfYoJE7ZwsBQoDIG4YN9ptyY.html
@@Radu It's all been smart 😀 Don't sell yourself short. You're tackling a problem I typically am not exposed to, so it's been fun to think about how I would do it and compare to your work. I also don't know much about building NNets, and your explanation was fantastic and easy to follow. Thank you for that :)
Awesome as always Radu. Just one question (so far). This code is like that (in this specific order) because you have decided it, right? if (this.useBrain){ this.controls.forward=outputs[0]; this.controls.left=outputs[1]; this.controls.right=outputs[2]; this.controls.reverse=outputs[3]; } I mean, the order can be different and the neural network will 'adjust' to it, right?
Hi Radu, this was an incredible video and I'm really grateful for it. The best part was the visualisation aling with the code. Just a small suggestion, the graphs and animation (particularly line slope animation) could have been a bit bigger. Hope to see more advanced content :)
Well, I accidentally joined this course at Level 6 XD But... I was able to code along with it. So thanks, that shows how good your teaching technique is!! On to the visualiser...
It took me a long time before I could understand why he was able to code such interesting projects. This guy is a genius, and has great passion for his subjects, as well as a great humor. Thank you so much for the content.
@@Radu You are very humble but my first job was definitely from doing your tutorials. I got a job offer for 50k starting. It was after this I completed this video (I put in a good year of programming too).
Thank you much Mr Radu. It's so entertaining but more important, it's so useful the lessons you teach us here. I immediately subscribe after watching this video. Anyway Mr Radu, at 21:31 Can we teach the car / the brain to randomly move slight right or left when we meet a condition like that. I am trying to teach the car's brain but unfortunately, even my own brain do not understand yet about any of these :")
Hi, I learned and enjoyed a lot in this series. One question. Why is 6 used in middle level. What will happen if I use a bigger or small number in place of 6 there?
It's an arbitrary number :-) The system supports if you remove that layer entirely [inputs, outputs], or if you add few more hidden layers, like [inputs, 6, 5, 4, outputs]. The number of the neurons on each layer is related to how difficult the task is, more complicated tasks will require more complexity (like brains of different animals enable them to do less or more intelligent things) but they are also more difficult to train (like human brains take years to develop while some species know what to do days or even hours after being born). Our algorithm for optimizing the network (2 videos after this one) is not very sophisticated, so, training a large network will take quite a long time.
@@Radu We did it, my girlfriend and I. We really enjoyed it! I will be doing the whole series now, she will be doing some reading to get into ML Great stuff man, we’re subbed 😄
Thank you for your amazing video - I am having an error in my code at 18:29 in the video, when you define outputs and link the neural network to car.js. This is the error: network.js:61 Uncaught TypeError: Cannot read properties of undefined (reading 'inputs') - in my code this is pointing to the initial for loop in the feedForward method of the Level class. Do you know where the issue might be? Thanks
Hello, great video :D, but I didn't quite understand the reason behind choosing this amount of neurons in the hidden layer. What is the impact for adding more or fewer layer/neuron ? Why bother adding a hidden layer in the first place ? And if more layers/neurons is better (I imagine this is the case), why not add 10 layers with 8 neurons each for example (or make 1 "super layer" with 80 neurons in it, or make 40 layers with 2 neurons each to reduce the amount of connections per layer) ?
In short, more layers / neurons means a more complex network, meaning that it can do more things... Here, I don't think the hidden layer is necessary to accomplish what is needed, I just showed it because I wanted to show that the code is general and can work with many layers and different neuron counts. Larger networks can be more powerful, but finding optimum weights and biases is also more difficult. Our way of training here (trial and error, pretty much) is not fantastic, so, a complex network may perform worse than a simple one. I will make a part 2 and 3 to this course in the future. In part 2 I will design more complicated scenarios and in part 3 we will learn more about neural networks. So, stay tuned :-)
I recommend you watch phase 3 of the course. The 'Understanding AI' playlist on the channel. The first few lessons there talk about the math behind neural networks. And you can watch that now with no problem. It doesn't depend on phase 2 of the course.
@@Radu sure will do that, well i want to master machine learning, and have no idea how to do that where to learn what to learn. I m thinking of completing self driving car and then ur machine learning course and leaning some maths from 3b1b. is that right approach for now as a beginner who knows how to make simple 2d stuff in directx using c++
@SeraphicFrost if you want to understand how things work, that sounds like a good plan. But keep in mind that once you know what you're doing, switching to python gives you access to a lot of advanced methods, already implemented in various libraries.
Hi Marc! I'm coding them with the same techniques I used to make the neural network visualizer (my next video in the series). I render them on a green canvas, record the screen and then crop it and remove make the green parts transparent in editing.
Hmmm put a breakpoint when the sensor reads something and try to reproduce and see if all the touches are detected. You can also share your code if you want.
I assume you mean 'self-learning'? If by that, you mean that an agent doesn't learn anything, you are right... Once it gets assigned a brain it is 'fixed' and never changes throughout it's 'lifetime'. But the entire system is evolving or... learning what to do because the best of each generation is kept and mutated upon. So... it depends on the viewpoint.
@@ertemeren I think I do teach how to store the brain in localStorage and continue to evolve on top of it... I also have phase 3 of the course now (Understanding AI playlist). It explains the math of neural networks much better than here and you can jump into it right away.
why static methods ?? why not normal methods? i know that static methods belongs to class and not to the individual object. but how does that logic applies here? and sir, What do you mean by 6:45 "i want to serialize this object afterwards"?
You answered your own question, kind of :-) Serializing means I want to store later the brain so it 'survives' refreshing the page. If you do that, it only stores the object attributes (like the weights, biases, in this case). Not the methods (like the feedforward algorithm). I use static methods because they are part of the class (we don't serialize that), not the objects (which we serialize). Hope this helps.
Good job at explaining a very complex subject in a digestible byte. The only stopping point for me is when I connect the NeuralNetwork to the car, the browser tab spins until it crashes. I commented out the code where we are adding the Levels in the NeuralNetwork constructor then then project loads up fine. It’s late now gonna give my neurons a break. Anything you can think of that I a, doing wrong?
@@Radu Thank you for your answer. I'm a neurophysiologist (i.e. I study the 'mechanics' of the nervous system), and when I heard at 01:18 that "a single neuron does something really simple", especially after such a naive and over simplistic description of what a neuron is/does, it made me startle. I don't think you ask the right question. It's not what I would add to this explanation that's important, because there would be thousands of pages to add in order to give a more accurate description of what a neuron is and does, and that would be out-of-scope here. I would rather subtract the part pretending a real neuron does something simple because this is just not true. I am going to give you a few informative examples, but that will be just examples to prove my point and definitely not suggestions about what to add to your video. You said there were "branch-like structures that received the signals", i.e. dendrites. First dendrites are not only "receivers", they can also be "senders" (see dendritic release), even though this phenomenon is not well-known. Dendrites will not just receive signals, they will modulate their receptors, grow, "ungrow", produce variable delays, produce combinatorial computations based on branches (akin to logic gates or mathematical functions), transmit "reconfiguration signals" to the neuron nucleus so that the neuron behaves differently (modulating output, producing spontaneous rhythms, etc.), produce oscillations, etc., the list is long. This means there will be very complex computations happening there, that go way beyond a mere summation of inputs. Again, I'm not saying such a video should be an introduction to neurobiology, I'm merely saying, one should be careful pretending a neuron is something simple without first having a serious read about it. On a different note, I think your videos are cool and will probably help beginners understanding how to create a simulation and implement some AI algorithms along the way.
@@rmsv Ok. I can see why you were startled by this :-) My goal was to simplify and make the concepts more approachable. Definitely not to give a lesson in biology / physiology (I said I explain it as good as I can = high-school level). I do know a few more things than that... but they are not very relevant to artificial neural lessons so, I left them out. I know that some species have fewer, but more complex neurons than others making them more intelligent than others. This sounds a bit like your explanation of the dendrites above. But if dendrites really do complex computations like that then they can be modeled as smaller neural networks as well :-))
@@rmsv @Veritasium has a good video from about a year ago about analog computing explaining how they may make a comeback and how they can be used to implement neural networks.
@@Radu sir can you jus share the video or tell what it do coz i am seeing this first time in javascript that would be really helpul thankyou you are great teacher
@@shivamdubey4783 It's a method that belongs to the class itself, not to the object you instantiate from it. I use it because at some point, later, I serialize the neural network, and traditional methods don't serialize. Static ones don't either... but they remain available as such.
You're a great instructor. Looking forward to more advanced topics, as you mentioned.
Thank you. I'll try to come up with something in the future!
Seeing my car accidentally avoid the car in front of it was super cool! Love this series!
Glad you enjoy it! :-)
I really want you to teach more about the math, you're such a good explainer.
I will try to make time for it. Thanks for watching :-)
Great video!
Since you asked for further suggestions ;)
1) In the feedForward method in the Level class, we can refactor various things: a) The first for-loop may be simply replaced by level.inputs = givenInputs. b) The nested for-loop, where the sum is computed, can be replaced by using the array method "reduce". c) The if-clause can be replaced by a ternary operator.
2) In the feedForward method in the NeuralNetwork class, we can get rid of the code duplication as follows: Initialize ouputs = givenInputs. Then start the for-loop with index i=0.
Thanks :-)
For 1 a), I don't remember why I did that. It could be something not obvious at this stage... maybe we need a deep copy later when parallelizing and visualizing things. But now I can already imagine you saying level.inputs = [... givenInputs] :-))
All others are nice ideas as well, especially since I don't use "reduce" at all during this course. Will keep them in mind for future courses.
@@Radu
Bro, I'm stuck.
I need your help.
Full self-driving car course playlist (3 lectures still to come on visualization, optimization and fine-tuning):
czcams.com/play/PLB0Tybl0UNfYoJE7ZwsBQoDIG4YN9ptyY.html
2:43 this backdown is 🔥
:-) glad you liked it
This is fun! I looking forward to the next one! 😀
Thanks for watching :-)
Next one is on visualizing the network. And one after that is when we get it to do something smart.
@@Radu It's all been smart 😀 Don't sell yourself short. You're tackling a problem I typically am not exposed to, so it's been fun to think about how I would do it and compare to your work. I also don't know much about building NNets, and your explanation was fantastic and easy to follow. Thank you for that :)
@@coachtroop I'm really happy you find value in this :-) Thanks for the uplifting comment!
Radu, merci pentru munca care o faci, invat multe lucruri noi de la tine!
Ma bucur!
Thank you sincerely for the informative video.
My car is now doing doughnuts 😂.
I'm excited for the next lesson.
Cool :-D
Awesome as always Radu.
Just one question (so far). This code is like that (in this specific order) because you have decided it, right?
if (this.useBrain){
this.controls.forward=outputs[0];
this.controls.left=outputs[1];
this.controls.right=outputs[2];
this.controls.reverse=outputs[3];
}
I mean, the order can be different and the neural network will 'adjust' to it, right?
Exactly. Won't matter at all in the end!
Thanks a lot for making this video. I probably understand only half of it, but it's very interesting. Please make more contents like this.
Thank you :-) and thanks for watching!
You are a gem radu.
Glad you like the content :-)
simpliest way to show. He is legend.
Glad it was helpful!
without the "jingle" at the beginning learning would have been a whole different experience.
Haha, thanks!
Coding train did it
Hi Radu, this was an incredible video and I'm really grateful for it. The best part was the visualisation aling with the code. Just a small suggestion, the graphs and animation (particularly line slope animation) could have been a bit bigger. Hope to see more advanced content :)
Thanks for the tip. I'll try to keep it in mind :-)
Well, I accidentally joined this course at Level 6 XD But... I was able to code along with it. So thanks, that shows how good your teaching technique is!! On to the visualiser...
Wow, good job :-)
Hope you like the rest!
best tutorial for coding neural networks. thank you so much !
You are welcome! :-)
bro you're literally saving my life
How so? :-)
Brother You really deserved a lot more and more subscribers and attention !! Your videos are really best !!!!!!!!!
Thanks :-)
Truly amazing visualisations, Thanks!
You're welcome :-)
It took me a long time before I could understand why he was able to code such interesting projects. This guy is a genius, and has great passion for his subjects, as well as a great humor. Thank you so much for the content.
Thanks for the nice comment, but I'm not a genius :-) I've just spent a lot of time practicing.
@@Radu You are very humble but my first job was definitely from doing your tutorials. I got a job offer for 50k starting. It was after this I completed this video (I put in a good year of programming too).
Oh, wow, congrats :-)
Phase 2 is coming out today, btw ;-)
Daaamn. Nice Explanation!
Thank you! :-)
Absolutely great vid! Looking forward for more content like that ☺️
Thanks! :-) I'll try to make more like this in the future.
Great explanation of neural network with so much clarity
Glad you liked it :-)
Thank you sir for opening my third eye... 😱
My pleasure! :-)
Good explanation of basic concepts 👍👍👍. It's interesting topic. Thanks.
Thank you :-)
Really Awesome Dude 👍
Thanks :-)
Thank you much Mr Radu. It's so entertaining but more important, it's so useful the lessons you teach us here. I immediately subscribe after watching this video. Anyway Mr Radu, at 21:31 Can we teach the car / the brain to randomly move slight right or left when we meet a condition like that.
I am trying to teach the car's brain but unfortunately, even my own brain do not understand yet about any of these :")
Sure, it's explained in an upcoming lecture, after the visualizing part.
Radu, good tutorial, keep up the good work, also eng and ro?
Thanks! I'll try :-) but I'll stick to English language, otherwise I alienate 99.2% of my viewers :-)
@@Radu nice
They are really incredible, but are you thinking of making it using Python? Please.
At work I teach it using Python, but I don't plan to make videos about it. I like keeping one main language on the channel.
HUGE and mad production thx man
No problem :-) Glad you liked it!
Hi, I learned and enjoyed a lot in this series.
One question. Why is 6 used in middle level. What will happen if I use a bigger or small number in place of 6 there?
It's an arbitrary number :-)
The system supports if you remove that layer entirely [inputs, outputs], or if you add few more hidden layers, like [inputs, 6, 5, 4, outputs]. The number of the neurons on each layer is related to how difficult the task is, more complicated tasks will require more complexity (like brains of different animals enable them to do less or more intelligent things) but they are also more difficult to train (like human brains take years to develop while some species know what to do days or even hours after being born). Our algorithm for optimizing the network (2 videos after this one) is not very sophisticated, so, training a large network will take quite a long time.
@@Radu Thanks
@@sharmarahul384 No problem :-)
This is so well made! Keep it up :)
Thank you! And thanks for watching :-)
Please consider tensorflow
It's a good library.
Awesome. I will be doing this today 🙂
Cool! Good luck :-)
@@Radu We did it, my girlfriend and I. We really enjoyed it! I will be doing the whole series now, she will be doing some reading to get into ML
Great stuff man, we’re subbed 😄
@@morezco Awesome :-)
Thank you for your amazing video - I am having an error in my code at 18:29 in the video, when you define outputs and link the neural network to car.js. This is the error: network.js:61 Uncaught TypeError: Cannot read properties of undefined (reading 'inputs') - in my code this is pointing to the initial for loop in the feedForward method of the Level class. Do you know where the issue might be? Thanks
It's a little hard to say without seeing your code. If you share it somehow (like on my Discord), I can have a look.
Hello, great video :D, but I didn't quite understand the reason behind choosing this amount of neurons in the hidden layer. What is the impact for adding more or fewer layer/neuron ? Why bother adding a hidden layer in the first place ? And if more layers/neurons is better (I imagine this is the case), why not add 10 layers with 8 neurons each for example (or make 1 "super layer" with 80 neurons in it, or make 40 layers with 2 neurons each to reduce the amount of connections per layer) ?
In short, more layers / neurons means a more complex network, meaning that it can do more things... Here, I don't think the hidden layer is necessary to accomplish what is needed, I just showed it because I wanted to show that the code is general and can work with many layers and different neuron counts.
Larger networks can be more powerful, but finding optimum weights and biases is also more difficult. Our way of training here (trial and error, pretty much) is not fantastic, so, a complex network may perform worse than a simple one.
I will make a part 2 and 3 to this course in the future. In part 2 I will design more complicated scenarios and in part 3 we will learn more about neural networks. So, stay tuned :-)
@@Radu Thanks for the explanation !
No problem. Btw, phase 2 is coming out later today. Phase 3 probably in January.
how line slope animation is related to y = mx + c in our case and how should i visualize it to understand?
I recommend you watch phase 3 of the course. The 'Understanding AI' playlist on the channel. The first few lessons there talk about the math behind neural networks. And you can watch that now with no problem. It doesn't depend on phase 2 of the course.
@@Radu sure will do that, well i want to master machine learning, and have no idea how to do that where to learn what to learn. I m thinking of completing self driving car and then ur machine learning course and leaning some maths from 3b1b.
is that right approach for now as a beginner who knows how to make simple 2d stuff in directx using c++
@SeraphicFrost if you want to understand how things work, that sounds like a good plan. But keep in mind that once you know what you're doing, switching to python gives you access to a lot of advanced methods, already implemented in various libraries.
What are you using for the explanatory animations?
Hi Marc! I'm coding them with the same techniques I used to make the neural network visualizer (my next video in the series). I render them on a green canvas, record the screen and then crop it and remove make the green parts transparent in editing.
hey buddy! could you make a tutorial on backpropagation as well?
Someday, if I figure out how to teach it differently than others do.
@@Radu i have gotten into neural networks with the help of your self-driving car course
@@Radu i was trying to find a nice tutorial on it but just couldn't find one so i figured i would ask the man himself!
@@champx549 as I mentioned in the video, 3b1b has a really good one.
@@champx549 nice :-)
Under certain conditions my sensors will be yellow through the body of the traffic car. Any debugging tips?
^ when the ray length is beyond the size of the traffic car
Hmmm put a breakpoint when the sensor reads something and try to reproduce and see if all the touches are detected. You can also share your code if you want.
@@Radu I have sent some things in the discord! Thank you for this amazing series and any help you could provide!! :)
I think that there is no seft-learning stage for this system am I right?
I assume you mean 'self-learning'?
If by that, you mean that an agent doesn't learn anything, you are right... Once it gets assigned a brain it is 'fixed' and never changes throughout it's 'lifetime'. But the entire system is evolving or... learning what to do because the best of each generation is kept and mutated upon. So... it depends on the viewpoint.
@@Radu Is it possible to extend project like saving data for keep it evolving on this? by the way being a new commer on this topic can be confusing
@@ertemeren I think I do teach how to store the brain in localStorage and continue to evolve on top of it... I also have phase 3 of the course now (Understanding AI playlist). It explains the math of neural networks much better than here and you can jump into it right away.
why static methods ?? why not normal methods?
i know that static methods belongs to class and not to the individual object. but how does that logic applies here?
and sir, What do you mean by 6:45 "i want to serialize this object afterwards"?
You answered your own question, kind of :-)
Serializing means I want to store later the brain so it 'survives' refreshing the page. If you do that, it only stores the object attributes (like the weights, biases, in this case). Not the methods (like the feedforward algorithm). I use static methods because they are part of the class (we don't serialize that), not the objects (which we serialize). Hope this helps.
@Radu yeah!, It does help!
But I got the answer later in the video itself😂
I asked the question before watching the complete video!
Sorry!🙇♂️
Ok. I forgot all I said in the video :-D
Good job at explaining a very complex subject in a digestible byte.
The only stopping point for me is when I connect the NeuralNetwork to the car, the browser tab spins until it crashes. I commented out the code where we are adding the Levels in the NeuralNetwork constructor then then project loads up fine.
It’s late now gonna give my neurons a break. Anything you can think of that I a, doing wrong?
Can't really say from just reading your comment. Maybe you share the code with me somehow? I have a discord link on my channel banner, for example.
I overwrote my network.js file with yours and it’s working now. I will compare later to see what caused that issue
@@zedzulzur ok :-)
La multi ani!
Merci :-) de unde știi?
Bro this is nice, neural network program.pls is this Vs code
Yes, it's VS Code.
@@Radu Thanks
No problem.
@@Radu although, its hard to install Python in Vscode.its just downloads and stops
Well, this code is not python...
Nu te-o contactat inca Elon sa-i dai codu la self drive car?
Nu :-( ... dar e pe github... Cred ca l-a luat singur :-)
Elon e ocupat cu Twitter acum.😂😂😂
@@remus1667 sigur. Hmmm... prevad un self-tweeting car in the near future.
@@Radu Asta mai lipseste sa ma faca de rusine masina mea pentru ca is in urma cu Service-ul😂😂😂😂
@@remus1667 haha! Good one :-)
🔥🔥🔥🔥🔥🔥🔥🔥🔥
Someone's excited :-)
@@Radu yeeeeeeeeeees
@@Radu Me also!
@@sharmarahul384 Great!
@@yorvymeza1546 :-)
❤❤❤❤😊
:-)
Yo!
Hi!
You should read a little more neurobiology, because your idea of what a real neuron is is oversimplified.
Interesting. What would you add to this explanation?
@@Radu Thank you for your answer. I'm a neurophysiologist (i.e. I study the 'mechanics' of the nervous system), and when I heard at 01:18 that "a single neuron does something really simple", especially after such a naive and over simplistic description of what a neuron is/does, it made me startle. I don't think you ask the right question. It's not what I would add to this explanation that's important, because there would be thousands of pages to add in order to give a more accurate description of what a neuron is and does, and that would be out-of-scope here. I would rather subtract the part pretending a real neuron does something simple because this is just not true. I am going to give you a few informative examples, but that will be just examples to prove my point and definitely not suggestions about what to add to your video. You said there were "branch-like structures that received the signals", i.e. dendrites. First dendrites are not only "receivers", they can also be "senders" (see dendritic release), even though this phenomenon is not well-known. Dendrites will not just receive signals, they will modulate their receptors, grow, "ungrow", produce variable delays, produce combinatorial computations based on branches (akin to logic gates or mathematical functions), transmit "reconfiguration signals" to the neuron nucleus so that the neuron behaves differently (modulating output, producing spontaneous rhythms, etc.), produce oscillations, etc., the list is long. This means there will be very complex computations happening there, that go way beyond a mere summation of inputs. Again, I'm not saying such a video should be an introduction to neurobiology, I'm merely saying, one should be careful pretending a neuron is something simple without first having a serious read about it. On a different note, I think your videos are cool and will probably help beginners understanding how to create a simulation and implement some AI algorithms along the way.
@@rmsv Ok. I can see why you were startled by this :-) My goal was to simplify and make the concepts more approachable. Definitely not to give a lesson in biology / physiology (I said I explain it as good as I can = high-school level). I do know a few more things than that... but they are not very relevant to artificial neural lessons so, I left them out. I know that some species have fewer, but more complex neurons than others making them more intelligent than others. This sounds a bit like your explanation of the dendrites above. But if dendrites really do complex computations like that then they can be modeled as smaller neural networks as well :-))
@@Radu No, because the computations of dendrites are mainly analogue, not digital.
@@rmsv @Veritasium has a good video from about a year ago about analog computing explaining how they may make a comeback and how they can be used to implement neural networks.
what is leve1.#randomize(this); how this basically works
It is Level.#randomize, not leve1.#randomize.
It is calling the private static method #randomize from the Level class.
@@Radu sir can you jus share the video or tell what it do coz i am seeing this first time in javascript that would be really helpul thankyou you are great teacher
@@shivamdubey4783 It's a method that belongs to the class itself, not to the object you instantiate from it. I use it because at some point, later, I serialize the neural network, and traditional methods don't serialize. Static ones don't either... but they remain available as such.
@@Radu thankyou so much sir totally understood you are a great teacher