Learned something today? :-) What? Full course playlist: kzbin.info/aero/PLB0Tybl0UNfYoJE7ZwsBQoDIG4YN9ptyY
@zer0012 ай бұрын
I love your teaching style. I have learned so much from your videos.
@Radu2 ай бұрын
Happy to hear :-) thanks for watching!
@xiaobogong54257 ай бұрын
I have gained a lot from your courses, thank you for your efforts.
@Radu6 ай бұрын
Happy to hear :-) Thanks for watching!
@FarQuZeDesigns Жыл бұрын
Bro you came to my rescue. I was so lost in all the mathematical fundamentals of training an AI and had no clue where to start. Thank you so much for making such valuable information available for free!!! Thank you so much!!!
@Radu Жыл бұрын
Glad to hear it helped!
@aliph-null2 жыл бұрын
Nice, very educative and cool. Your Intro is so nostalgic, I like it.
@Radu2 жыл бұрын
Hi! Thanks :-) I'm happy if you learned something and that you like the intro!
@JanderSilva0111 ай бұрын
This is a unique content, thanks for that Radu.
@Radu11 ай бұрын
Glad you like it. Thanks for watching :-)
@experimentnameuntitled22 Жыл бұрын
Very cool course. I followed this course and implemented this in python with pygame. It worked really well. I had some cars being more thin and the car learned to pass through the tiny gap between the lanes which is very cool.
@Radu Жыл бұрын
Awesome :-) I would be curious to see your python implementation. I have a couple: one with tkinter and one with pygame and they both are lagging slightly compared to the web implementation (not sure why).
@experimentnameuntitled22 Жыл бұрын
@@Radu yes I have noticed as well, when running with 100 cars, it only runs at around half of the fps. I guess it's because python or those libraries are slower?
@Radu Жыл бұрын
@@experimentnameuntitled22 Ok. I thought the same... maybe JavaScript is more optimized when visualizing things.
@experimentnameuntitled22 Жыл бұрын
@@Radu speaking of rendering, could you make something that explores with using WebGL or the new WebGPU? Maybe a simple 3D game or just visuals. I think it would be an interesting topic.
@Radu Жыл бұрын
@@experimentnameuntitled22 I was thinking to expand this to 3D, but not necessarily using webGL... just doing it from scratch :-) but let's see. Currently working on phase 2 which will be a 2D virtual world. Phase 3 will be more advanced neural networks and Phase 4 could be 3D.
@Infinium2 жыл бұрын
This is a really well produced and good quality video! Thank you :)
@Radu2 жыл бұрын
Thank you! Check out the full course if haven't already :-)
@HEWfunkingKNEWitАй бұрын
having way too much fun with this, its my first time going into ML
@RaduАй бұрын
I'm happy to hear :-) You might like phase 3 of this course (understanding AI) it explains how the neural network works internally, by playing with the parameters. I feel that more people should understand that before diving into ML and the bunch of available libraries.
@marcyanus14302 жыл бұрын
Been waiting whole week for this! Thank you Radu!
@Radu2 жыл бұрын
Wow! Thanks for being patient :-)
@JunaidQadir-ls6pb11 ай бұрын
Awesome! i managed to do exactly like this. Love it! Thanks
@Radu11 ай бұрын
Glad you liked it :-)
@andy_lamax2 жыл бұрын
Been following through for a while now. Thanks for your brilliant explanations
@Radu2 жыл бұрын
Thank you for watching :-)
@cianmcnally46942 жыл бұрын
I’m one minute in and I love this channel already
@Radu2 жыл бұрын
Glad to hear :-) Thanks for watching!
@ap666-o8h2 жыл бұрын
As always, incredible lesson.
@Radu2 жыл бұрын
Thank you, Aitor!
@vedprakash-zz6hb2 жыл бұрын
Liked and shared it with all my whatsapp group 😊
@Radu2 жыл бұрын
Wow! Really? Thanks! :-)
@ssikarim2 жыл бұрын
Original content. Thank you very much
@Radu2 жыл бұрын
Thanks and thank you for watching :-)
@ЛюдмилаБаїк-ъ9ь Жыл бұрын
Watched, just wonderful! I would add ref to repl web view where I implemented the project so far but unfortunately posts with references are automatically banned. I wonder if adding more levels or making longer arrays on the levels can really improve existing neural network? I feel like not. A crossover algorithm implies that we identify somehow the best weights from both cars or just pick them randomly?
@Radu Жыл бұрын
Would be cool to see what you did. Maybe send it on my Discord? I will make more content related to the self-driving car soon :-) But neural networks... I will only teach more of that in January, I think.
@ЛюдмилаБаїк-ъ9ь Жыл бұрын
Thanks for the answer, Radu ) I have done nothing outstanding, yet. Just contemplating the work of this simple neuron network and trying to get used to it. Though I would like to make games allowing player to train characters for various gameplays and using them in multiplayer contest so that models compete by themselves) I see that you have a new big neuron course, hope that it will gives me new insights ) Thank you, Radu for all your great work for the popularization of science @@Radu
@Radu Жыл бұрын
@@ЛюдмилаБаїк-ъ9ь Thanks for watching! :-)
@anmolsharma40495 ай бұрын
Hey Radu, amazing course learning a lot from you, just a small question why does you screen shows PAUSED once you click on vscode I can't find where did you implement this. I didn't want to run 1000 cars in background Edit : goto "sources" tab in dev tools and click on pause icon
@Radu5 ай бұрын
I 'implemented' that in Adobe Premiere Pro :-D when editing the video... I didn't want the moving things on the right to distract :-\ Wasn't fun. Maybe I should have used the dev tools feature you describe but I didn't think about it then :-)
@georgelewis73342 жыл бұрын
Awesome
@Radu2 жыл бұрын
Thanks!
@Shalaby20027 ай бұрын
I have a specific question: How does mutation work exactly in this context? It’s mentioned that 100 cars are generated, but what does this mean? Does each car mutate every time it perceives data, or is there a different trigger for the mutation?
@Radu6 ай бұрын
When the page loads, the best car from the previous run is used as a basis. One car is left as such and the other 99 are mutated so each weight and bias are changed a bit.
@elescritoriodejasso2 жыл бұрын
Se ve genial tu proyecto!!! saludos
@Radu2 жыл бұрын
Thanks :-)
@3nt3_2 жыл бұрын
at around 7:00 why did you write cars.find(c => c.y == Math.min(...cars.map(c => c.y))) instead of just cars.sort((a, b) => b.y - a.y)[0]?
@Radu2 жыл бұрын
Both would work... yours is quicker to write but time complexity is O(NlogN) mine is O(N).
@3nt3_2 жыл бұрын
@@Radu math.min still has to map over all elements?
@Radu2 жыл бұрын
@@3nt3_ yes, there are many linear time operations. The mapping, the min search and the find are each O(N). But O(3N) = O(N) as constants are avoided when talking about time complexity. It could be that sorting here is actually faster, because N is so small, but, in general, as N grows towards infinity O(N) is better than O(NlogN) and it's a bad habit to use sorting when all you need is to find the maximum. If you are really looking for the best implementation, write a traditional for loop and min search...
@3nt3_2 жыл бұрын
@@Radu or use reduce
@Radu2 жыл бұрын
@@3nt3_ yes, I think you can use it in some clever way too.
@diegocassinera Жыл бұрын
Great video, but i would like to point out the the function to find the best car even do i looks very small code its very much inefficient and it would just be better implemented in a single loop rather than 3 loops over all the values. First we start with the spread operator which loops over all the cars, then pass that to the min function which also loops over all the values, and finally the find which depending on the order of the array may need to look at all the cars again. I would be faster to just loop over all the cars and keep track of the lowest value.
@Radu Жыл бұрын
Thanks! You are right :-) You can also do even better if you separate the cars in 2 arrays (damaged vs not damaged) and only search in the non-damaged one. I'm not sure why I chose that way of doing it... Maybe because it's common in some environments today (like React) to work like that, for various reasons... Or maybe because I didn't want to implement another function to use just here, actually, it could help when implementing the sensors too (the nearest touch is considered). But current code is not that inefficient, actually. Sure, if we have 1000 cars, it will do roughly 3000 calculations instead of 1000. But if you think about other parts of the app, like the functioning of the sensors, the number is much larger. 5 rays need to be compared against 7 traffic cars, each of them rectangles with 4 sides (not bothering with counting the road border checks). This happens for each of the 1000 cars, so 140,000 segment intersection calculations, which are even more demanding than going through the elements of an array like in those 3000 steps. A similar calculation can be done for collision assessment 4 sides of each of the 1000 cars compared compared against 4 sides of each traffic car, giving 2 orders of magnitude more steps than in deciding the best car. So, major speedup would come if optimizing these other things, maybe I will include a section on how to do this in Phase 2.
@diegocassinera Жыл бұрын
@@Radu Nothin wrong with the code, it works for the context it is in. I just wanted to take a note over the description of code and functional programing. When writing code, when it comes down to make a decision about a line of code should be, functional programing seems to be a simple and good choice. However, when you step back a bit with wider context, some of these solutions hinder efficiency by repeating operations. There is nothing wrong of doing a for loop if you get everything done in one sweep. Most times, more descriptive code achieves faster results, in exchange of more code to read. By the way, love your work and the way you explain things. A fan.
@Radu Жыл бұрын
Well, you were right that it could have been better :-) I'm also not a big fan of quick coding solutions like that, but I guess I got used to them from teaching react at work... At least what I did was still linear time complexity :-D I get many students doing it by first sorting the array (linearithmic time complexity) and then taking the first element (O(1)). I actually wrote a script to make a funny sketch about it, but didn't have the energy to record it this year. Maybe later in the autumn. On holiday now. Thanks for watching :-)
@mrreese23422 жыл бұрын
Perfect, but how to generate random cars with random positions so i can test it better. i've tried but couldn't use a for loop or function inside the traffic array.
@Radu2 жыл бұрын
Hi, not really easy to explain in a comment, but if you join the Discord linked on my channel banner, there is someone (devperate) who posted a solution for that in the general channel. Hope it helps.
@mrreese23422 жыл бұрын
@@Radu yeah thanks i kinda figured it out it's working well just gotta improve it.
@juheehong74452 жыл бұрын
I'm still a little confused by what mutate() does. I see that it's changing weights and biases, but I still don't quite get what exactly the lerp here does/how exactly these weights and biases are being mutated. Also, what exactly is the "amount" used here-?
@Radu2 жыл бұрын
Good question. I didn't describe it that well, I think. Mutate will change the value of a weight and bias from it's current value, towards a random value, depending on the 'amount', so... even if the random value is very different, if the amount is 10%, it will be still 10 times closer to the original value than to the random value. It's just a way to control the amount of change that happens in a given network. Having said that... it's not the only way you could implement such a function. For example, another version of mutate could be to take a random amount of weights and biases (say, 10%) and change these randomly, without touching the others at all. So, here, there wouldn't be a need for the lerp function. I haven't tested if this version is better (if it finds a good brain faster) but both of the strategies will work if repeated enough.
@vladyslav-py-js-go Жыл бұрын
The more clones the better 😁 i hope my laptop has enough amount of chakra😆
@Radu Жыл бұрын
:-))) Good Luck!
@tatwadarshi_hota346710 ай бұрын
I am trying to get best brain by refreshing again and again but always it gets behind a dummy car plays like back and forth. Is there a better algorithm to mutate. Because I don't know how my mutation not working properly though I didn't skip a single part of the video and wrote the complete code by watching the video
@Radu10 ай бұрын
It's possible your mutation is too low. I would increase the value a bit and repeat multiple times. You can learn many things about how neural networks work from phase 3 of this course (the understanding AI playlist). You can also try implementing a system that automatically tries different mutation values, and lets the cars drive for, say... 10 seconds and then saves the best result. Just leave it running for a while and it should progress by itself. Hope this helps :-)
@tatwadarshi_hota346710 ай бұрын
@@Radu Thanks for reply and your suggestion. I would try
@berserks03 Жыл бұрын
24:08 Increase N to 2000, for me better results:)
@Radu Жыл бұрын
Cool :D
@rmsv Жыл бұрын
Ok, I thought you were going to discuss backpropagation / error correcting code.
@Radu Жыл бұрын
Not here... I may mention it in phase 3 of this course (currently still working on phase 2). But I don't understand it well enough to make an explainer that is different from others out there.
@rmsv Жыл бұрын
@@Radu OK, good luck with your project. I think it was also interesting to use a darwinist approach to neural networks evolution. It's also more funny to watch and experiment "growing" neural networks. But originally, I thought you were going to train your neural network using the KEYS car, trying to make your output layer copy your own moves.
@Radu Жыл бұрын
@@rmsv You describe imitation learning. I may do something like that in phase 3... But not sure... In phase 2 I plan to teach how to create a more complex virtual world (so the car can drive in a more 'real' setting). Then the plan is to use the more complex scenarios to explain more sophisticated AI concepts. Let's see...
@rmsv Жыл бұрын
@@Radu in Javascript?
@Radu Жыл бұрын
Yes. I also teach using Python at work, but on this channel I focus on JavaScript.
@Shalaby200211 ай бұрын
Great As Always! How can I add some extra chaos to my surroundings to truly capture the essence of a third-world country? No one respects lanes here; it's like a free-for-all with overlapping traffic.
@Radu11 ай бұрын
There's a lot of chaos coming in Phase 2 of the course (already on the channel). You learn to build a virtual world with intersections, roundabouts, road markings, etc. The cars will go crazy there, at first :-)
@Markard0 Жыл бұрын
I found a faster way to train the cars was to get the best brain with one car in traffic, then 3, then 5, and then finally 7. This allowed always for at least 1 mutated car to get by in 1-3 tries!
@Radu Жыл бұрын
Cool! :-)
@SmilingRob2 жыл бұрын
Wow the payoff of following along this far has been great!
@Radu2 жыл бұрын
Thanks, Robert! Really happy to hear!
@ivanovchinnikov12302 жыл бұрын
Very disappointed with this video. I was waiting for it because I was curious how you would train a neural network. When I opened the video and saw the word "Mutations" in the timecodes, I thought, "Wow, genetic algorithms! Cool! Let's watch!" But no... just a RANDOM SEARCH! In this case, even mutations are not needed - just generate more completely random cars and sooner or later you will be lucky. In such a simple task, this method works, but it cannot be applied anywhere else!
@Radu2 жыл бұрын
Hi, sorry to disappoint. With this course, I wanted to give an overview of how an entire system like this works. But to do that and keep it manageable, I kept each component simple as possible. I am planning a part 2 for this course, where I focus on the neural network, but maybe also on genetic algorithms, let's see. Few more comments: 1. Not 'just' a random search. It's random in the first part and guided in the second. 2. Sooner or later you will be lucky even with a network with a billion nodes and hidden layers (most likely later). 3. Small networks are used in many classification tasks where the number of features is small. They outnumber deep neural networks in real world applications, but the later get more attention because they are seen as a kind of 'true AI', or close to that anyway :-)
@ivanovchinnikov12302 жыл бұрын
@@Radu Hi and thanks for the answer. In any case, it was very interesting course. I found your channel a few days ago and found a lot of useful and interesting videos here. Thank you for your work! In my opinion, recording the second part of this course is a really great idea!
@juheehong74452 жыл бұрын
@@Radu wow I'd be excited for a part 2 of this course! do you know when it might come out?
@Radu2 жыл бұрын
@@ivanovchinnikov1230 Glad you found it interesting, even if not exactly what you were looking for :-) I'll see about the second part when I return to work.
@Radu2 жыл бұрын
@@juheehong7445 I'll get back to work in mid August. Will start planning it then, maybe it will be out this year.
@ScriptRaccoon2 жыл бұрын
This moment where your creatures (in this project: cars) start to evolve, as soon as we put in some mutation, is pure magic :). I really like the visualization. I have a few code suggestions. First of all, we have some for-loops where we didn't need the index at all, so a forEach loop would be easier to write. But more importantly, it is a good idea to refactor function definitions with many arguments in such a way that the meaning of the arguments become clear. For example, the line new Car(road.getLaneCenter(1),-100,30,50,"DUMMY",2) could be replaced by new Car({x : road.getLaneCenter(1), y : -100, width: 30, height : 50, controlType: "Dummy", maxSpeed: 2}). or even by new Car({position: {x : road.getLaneCenter(1), y : -100}, size: {x : 30, y : 50}, controlType: TYPES.DUMMY, maxSpeed: 2}). In the original line, the numbers appear to random numbers whose meaning we have to look up in the definition of the constructor function. In the refactored line, the meaning of every argument is absolutely clear. It is a bit longer to write, and the function definition needs to be updated (once), but in my experience it is really worth it. So basically we have just argument in the function, called options, and get everything from this object with suitable keys (say, via destructuring). Also, TYPES could be an enum in which DUMMY is an available key - this has the advantage that we get auto completion when typing TYPES. and will not misspell the string so easily. The car constructor is just one example in this project where this type of refactoring may be applied. Another example in this part was the mutation function whose function call could be refactored to mutate({network: car[i].brain, amount: 0.2}). By the way I learned all this (and more) from Fireship's great video "Code this, not that".
@Radu2 жыл бұрын
Thanks again for all your tips. I remember seeing Fireship's video a while ago, but knowing about those tips and making them... 'part of my system' is a different story. I really like the idea to use one parameter and destructuring inside the function definition itself. Things are maybe clearer in that way even with just 2 arguments. But somehow I consider 2-3 as the threshold where it's ok to do either way... And then if the function 'grows' I would need to refactor quite a bit, which can be distracting (can happen in many places / files) so, I would need to plan ahead somehow. But again, everything you said is useful, and I'll try to use it in future projects (that I haven't recorded yet :-P) and I'm considering to make a live stream of this self-driving car project sometime in the autumn with all these code improvements.