2 years later and you're still replying to comments. respect.
@underpowerjet4 жыл бұрын
yes, i must be respected
@sosodex26514 жыл бұрын
Yess!!
@Mihai-fp7kf4 жыл бұрын
Bruh
@mikefocal57704 жыл бұрын
Respect, and very clear tuto
@puffypillow92663 жыл бұрын
thats called dedication
@Torpidity2 жыл бұрын
I know it's five years past this video's posting, but I derived a ton of utility from this. Connecting the concept of evolutionary neural networks to actual code is great and this walk-through has been incredibly useful in my mini-elementary life simulator. Every question I had was answered in your video, so I just wanted to say thanks and very well-done explanation. I can tell you put a lot of work into these videos, but the complexity of this topic makes it hard for you to get the recognition you deserve. Awesome job and thanks for the content!
@underpowerjet2 жыл бұрын
Thank bro, appreciate it.
@JohnWayne-bm1ty4 жыл бұрын
Afetr 2 Years searching about this I finally understand this, You dont know how I feel, Thankssssssssssssssssss for this Vid
@underpowerjet4 жыл бұрын
gg
@JohnWayne-bm1ty4 жыл бұрын
@@underpowerjet finally understand, now i have to learn about back propagation
@underpowerjet4 жыл бұрын
@@JohnWayne-bm1ty Just refresh yourself on the chain rule. The rest will be pretty easy.
@Fiendel6 жыл бұрын
I love you, my god, the firt person who actually knows how to explain how to do a simple perceptron
@underpowerjet6 жыл бұрын
:D
@Fiendel6 жыл бұрын
thanks to your video I was able to code my first neural network for a self-learning mario-like game ;)
@underpowerjet6 жыл бұрын
Glad to hear it :D When you're comfortable you should look into bigger projects using Python's Tensorflow and Keras.
@temaye9429 Жыл бұрын
I wish I watched this video years ago. You've demystified so much for me. Thanks so much for making it.
@underpowerjet Жыл бұрын
No problem :)
@presente9501 Жыл бұрын
Thank you! More than 6 years past and this video continue to be one of my most preferred videos about Neural Network, you and Sebastian Lague help me a lot with this things in C#. I already know in python but making things in C# is… Different.
@underpowerjet Жыл бұрын
Thanks, appreciate it :)
@aurielklasovsky4537 жыл бұрын
this is gold :), very helpful and the speed is perfect. usually I have to skip forwards in tutorials and then miss important stuff, its nice to learn from someone how assume I know what's what. pleas keep it up!
@underpowerjet7 жыл бұрын
Yep i hate having to skip forward too when I'm trying to learn something :D, and thanks!
@N7D7M75 жыл бұрын
It's nice of you to do this tutorial... My feedback; [louder volume for voice] , [don't cut/skip to the end where the code is done] , [less filler intro, more filler in content] ... thanks for making these videos
@AsitorCorporation7 жыл бұрын
I was coding along but I got really confused when you skipped everything to do with linking it to unity, I have a half finished piece of code here now. But I am grateful that you uploaded this, as I think I know understand how neural networks actually improve themselves, but I didn't really understand what was going on with the code at some points. It's a big concept to grasp first time around, I'd like to see more tutorials from you, perhaps could you do a tutorial for a single cell organism to learn to move across the screen by jumping over boxes? I just couldn't follow easily after the big jump to all the unity stuff, especially as I've never used unity and this is my first time trying out neural networks. Maybe you could even make a short video just explaining how neural networks actually work? I don't feel like I know how they actually do it all at the moment, I'd need to see how the computer thinks and knows what to do. Thanks very much for the tutorial though!
@underpowerjet7 жыл бұрын
I linked the code in the descriptions. Yea, i think skipping explaining the practical was a major mistake. I just wanted to explain how to write a mutating neural network. But I should have also focused on the practical side of it >_
@puffypillow92663 жыл бұрын
i have the same problem. its a great tutorial, just skipped too much.
@l.halawani3 жыл бұрын
@@underpowerjet will you redo this content or upload supplementary video on how to link this stuff up?
@underpowerjet3 жыл бұрын
@@l.halawani I'm so busy bro. I put link to github in description. I would just advice to check it out. Also there are way better tutorials on youtube now days from other much better communicators then me. No point in re-inventing the wheel if you know what I'm saying.
@l.halawani3 жыл бұрын
@@underpowerjet thanks for getting back to me.. Unfortunately I have to disagree , I spent many hours over the last 3 days trying to find something good on NEAT implementation in Unity and there isn't that much. There are some libraries like SharpNEAT or UnityNEAT, but even these have literally just a couple tutorials that are either too basic or too narrow in scope. The solutions provided are not transferable. There are a lot of good conceptual videos, but honestly, having a one good NEAT tutorial, a universal approach, demonstrating how to write a simple EA and use it for more than just one specific project would be awesome. I've tried to find a good read on it too, but this subject is still discussed mainly in the world of acadfemia using language I can't understand and examples that are mainly theoretical. Today (possibly in one of your videos?) I found a solution to my problem, a Weight Agnostic Neural Network, it seems simpler to implement than NEAT and there are a few good videos on it. I'm trying to simulate evolution, but without specified generations . I don't even need fitting, as the world mechanics take care of killing out the ineffective organisms. All I need is just evolving topology, and mutations in mitosis. I need the network to be instantiated together with a gameObject when the parent acquired enough resources to reproduce. Maybe you've got some hits/keywords or something like that for me to look-up. Cheers!!!
@bsprogrammer76322 жыл бұрын
You explanination of things is really good now i understand it way better than before.
@underpowerjet2 жыл бұрын
thank you!
@comedyman4896 Жыл бұрын
"I'm not sure why my [function] wasn't working, I just removed it for now" - the C# Unity mantra
@underpowerjet Жыл бұрын
🤣
@jakubdrazkowski57804 жыл бұрын
LOVE YOUR TUTORIALS BROOO! THANKS A MILLION MY LORD!
@underpowerjet4 жыл бұрын
Thanks bro, that means a ton.
@butterfingers43216 жыл бұрын
Fantastic! I love this format- no time wasted! I'm new to Unity (coming from Processing.) I'm trying to get comfortable coding in C#, this kind of tut is exactly what I need. Thanks!
@underpowerjet6 жыл бұрын
no problem :)
@revilo7b7 жыл бұрын
Great video! I've made neural networks myself before but your way was so much easier. So thanks for making this video and showing me how to improve my neural networks a lot.
@underpowerjet7 жыл бұрын
You're welcome. Always good to improve :D
@leonardosciuto4012 жыл бұрын
really good video, i hope it can make me learn something new! Btw you scared me when you said to write more comments
@underpowerjet2 жыл бұрын
Part of code maintenance and longevity is having other people understand what it does and trust in it. Test cases can do a pretty good job at keeping code maintenance. But if someone doesn't understand why it was written there is always a chance it will be replaced. Comments tend to help provide additional context that can somtime be lost with lots of lines of code that can be explained with a single sentence :D.
@_Garm_7 жыл бұрын
great tutorial!, might help to show the picture when talking about which layer you currently working on, it would give us a visual que on which layer you working etc.. it would help me quite a bit , to use picture with the code :D i also really like that your working in unity aswell
@underpowerjet7 жыл бұрын
Thanks, yea i should have used pictures as I explain some of the more complicated parts. Lessons for future tutorials haha
@jakebullard34097 жыл бұрын
I found this really helpful! Thanks! I hope in the future you do a tutorial series where you go through everything step by step in both Unity and VS. Maybe less jumping around if you can help it.
@underpowerjet7 жыл бұрын
You got it :). Thought the jumping around was not that confusing since I had already finished the main NN code. Looking back it's pretty annoying to see random jumps with code change haha.
@kerduslegend2644 Жыл бұрын
Finally... A neural network tutorial that isn't involving python and numpy. Literally 50% of the struggle of making neural network is elevated if using numpy.. And that's cheating. Not to mention how python is formed making it hard to understand since you don't really know what's the variable they use
@Den696992 жыл бұрын
Thanks . 5 years later and you helped me
@nicholaswetta66447 жыл бұрын
I appreciate you putting out this video. It's been a nice resource to get some of the basics of Artificial Neural Networks figured out. I'm still a little confused about how the FeedForward function ends up producing the output, but I'm sure I'll figure it out.
@underpowerjet7 жыл бұрын
I suggest you read this. stevenmiller888.github.io/mind-how-to-build-a-neural-network/ Makes forward propagation pretty clear. If I have a sum it up in simple terms Feed forward is just "computing your function compositions" Neuron A -> Weight -> Neuron B Neuron B = Neuron A * Weight. Neuron B = SomeTransferFunction(Neuron B) That's it! There is nothing really more to Neural networks. Think of Neuron B = Neuron A * weight as a line graph formula y = mx + b. What if you wanted to teach the output y to learn a line where the slope is 2. Well in that case you would need to train the network so that it learns weight = 2. Because weight in this scenario is m.
@KomeranLP7 жыл бұрын
This tutorial is awesome! I won't say anything about how you could improve it because people already stated that in other comments for you :) I'm glad I have actual unity c# scripts for reference now to implement NNs in my own projects! And for me it was easy to follow your explanations. All I needed was a general direction on how to start anyway and the rest was increasingly obvious codewise^^ Please keep making awesome tutorials like this one! :) I'm definitely gonna watch at least some of them as I think you have a certain talent to explain these sorts of things to others^^
@underpowerjet7 жыл бұрын
Thanks :D I was getting scared I did a terrible job at explaining things. This certainly puts me at ease :D. I'll defiantly make more tutorials in the future.
@experiFilm2 жыл бұрын
This is amazing!! You really know your stuff!! Thank you for explaining this in such a straightforward way.
@komegaming3500 Жыл бұрын
This video helped me so much! Thank you for your videos!
@underpowerjet Жыл бұрын
No problem :)
@marvinchia-hanyeh17337 жыл бұрын
Great tutorial and detailed explanation! This is indeed the best tutorial clip on neural network. Thanks!
@underpowerjet7 жыл бұрын
Thank you! :D
@Eregrith6 жыл бұрын
As uncle bob martin said it: "A comment is a failure to express yourself in code. If you fail, then write a comment; but try not to fail." Don't comment your code just for the sake of commenting.
@underpowerjet6 жыл бұрын
Exactly.
@vickylance7 жыл бұрын
@6:40 the line, float [ ] [ ] [ ] weights = new float [ numberOfLayers ] [ ] [ ] should be, float [ ] [ ] [ ] weights = new float [ numberOfLayers - 1 ] [ ] [ ]
@underpowerjet7 жыл бұрын
Yes that is correct :). The Array list of weights at 15:06 when converted to jagged array creates float[][][] weights = new float[numberOfLayers - 1][][]. Thanks for pointing it out :)
@vickylance7 жыл бұрын
Hey thanks for the reply :) I just finished watching this video and its awesome. I was just wondering can you make a tutorial on how to connect Keras with Unity3d?
@underpowerjet7 жыл бұрын
In my HandGesture detection video i have a code which connected from Unity to Python. It's done with simple socket communication. Nothing fancy needed haha
@HowToMakeMobileGames7 жыл бұрын
Awesome. I was looking for a good intro tutorial to neural networks. Great vid, thanks for doing it :)
@underpowerjet7 жыл бұрын
No problem :D
@NicolaiRathjen7 жыл бұрын
Thanks for this tutorial. I was able to follow it even though I write in F# and not C# :-) You make something that is hard to grasp feel easy :)
@underpowerjet7 жыл бұрын
Thanks :D Glad to know it was easy to understand.
@AlfaTigerAlfa7 жыл бұрын
Great guide, mate. Looking forward to playing with it come summer. The one thing I think could've been explained better is how these neural networks learn. I didn't get the feeling that you explained how these evolved, the mechanism involved to grade how "well" a network was doing etc. Might be I overlooked something. The visual example sorta looked like normal pathfinding to me? Thanks a lot though, really appreciate it, you've earned yourself a new subscriber in me!
@underpowerjet7 жыл бұрын
Yeah i kinda....sped through that part near the end. I eventually added a fitness variable. And yes...I skipped the process where the neural networks are "tested" and ranked. I didn't think it was necessary to explain that part since it didn't have anything to do with the main NeuralNetwork.cs file. However...looking back..........I think I should have >_
@TheOffGridFamily4 жыл бұрын
Brilliant video. Thanks for sharing your knowledge
@arturoordonez-hernandez15346 жыл бұрын
I think this tutorial definitely helped. I'll have to see if I can fit this into my project to see if I really did understand this but, as you said, Neural Nets (and even Genetic Algorithms) are really quite simple
@newcooldiscoveries5711 Жыл бұрын
Wow! That was an awesome video! Thanks
@foodlover195_6 жыл бұрын
I just recently started research neural nets; and sure at first it was confusing but once I got a good grasp of the concepts it's really simple for what is seemly advance future tech. Anyway, wasn't really sure how I was going to implement the concept into code, so your tutorial was really great. Thanks :)
@underpowerjet6 жыл бұрын
No problem :). And they are not really future tech, the concept has been around since 1990's. It's just that we have the necessary computing power (faster GPU) to be able to solve very complex problems that were previously impossible. If you are interested, I would suggest you look into "Deep Convolution Neural Networks" and text mining with "Long Short Term Memory Networks" to get a full grasp of what they are being used for in the industry.
@foodlover195_6 жыл бұрын
Will do, thanks :)
@typicalhog7 жыл бұрын
Awesome, I'll watch it as soon as I catch some time off school. :D
@underpowerjet7 жыл бұрын
I see....so you're saying School is more important than my video? How dare you! (╯°□°)╯︵ ┻━┻ ┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻
@johnybravo72537 жыл бұрын
Great tutorial, I read about AI but I needed practical knowledge and it really helped me :) Thanks
@underpowerjet7 жыл бұрын
No problems :D. I added another tutorial recently on back-propagation if your interested.
@ghostdog98286 жыл бұрын
Well then.... thanks for helping me create Skynet!!
@SZvosec7 жыл бұрын
Thanks for the tutorial. Keep it up, I can't wait for the next one. Its nice to see a tutorial for neural networks in Unity. I have been waiting to find one since carykh released his videos on Evolv.io evolution sim. Glad to see you are making these. quill18creates has some good tutorials, you might be able to pick up some tips on how to make your tutorials better. I like his "code along" style where he explains as he types the code out instead of copy/pasting code in and then explaining it. It is easier to understand the code and feels more engaging. Copy/pasting tends to lead to cuts/jumps in the video which can be hard to follow if you are coding along. Good example of that is 23:07, when you jump forward to having a working idea in Unity then jump back to the code and explain it.
@underpowerjet7 жыл бұрын
Hummm, you're right. I honestly went with this method of adding in a little bit of code and explaining format, because it was a lot easier to do compared to the way quill18creates does it. I actually tried doing the code along style and kept messing up haha. I could not keep my mind straight and kept forgetting what I'm supposed to do. I think I need a bit more practice with this way of explaining a concept. I'll defiantly watch some of his videos and try to learn how I can improve.
@SZvosec7 жыл бұрын
One of his tricks for the code along is he has the code or snippets of code already typed out off screen on another monitor. He basically just retypes it on video, adding some stuff off the top of his head and explains as he goes. That way most of the hard work (coding wise) is done.Then you can spend your time when recording the videos, explaining what the code does. It also gives you a blueprint/map to know in what direction you can go next with the tutorial. I did like how you did the diagrams at the beginning explaining the different layer arrays and neurons. They really helped to visualize how the code worked. Ultimately you have to find what works best for you too. The more work it is the less fun it becomes, if you don't enjoy what you do you won't want to do it any more.
@original_anu7 жыл бұрын
Awesome tutorial dude
@underpowerjet7 жыл бұрын
Thanks :D
@ryanrizzo38666 жыл бұрын
Another great video, very helpful but I have one suggestion. It would have been great if during the coding phase, you referred back to the original neural network schematic you drew and explain what exactly is being iterated over and which values are being stored/copied etc. Sometimes it gets a little hard to follow. (First time programming a neural network as you can tell) You do go a bit fast at times, but other than that it was extremely insightful and thank you for taking the time to make this tutorial.
@underpowerjet6 жыл бұрын
Haha, yea a few people said I should have reffed back to the original schematic. I defiantly should have. I'm going to now reply to the other comment you sent about why each mutation has 0.2% chance, because you-tube is not letting me reply to that comment....So i'll just reply here. So the random number is from 1-1000. There are 4 types of mutation which range from 1 to 8. That means the overall chance of mutation is 8/1000 = 0.8%. But, EACH mutation within this 0.8% only gets a range of 2 values! (1-2), (3-4),(5-6),(7,8). So each individual mutation only has 2/1000 chance of occurring which is 0.2%.
@ryanrizzo38666 жыл бұрын
Thanks for your answer! I do have one other question... :D When controlling a real robotic system and modelling it in Unity (like the one of the walking robot) do you have to build the Neural Network on Unity in C# and in Java (separately), in your case? Couldn't you have programmed it just in C#, and then transferred the values directly to Arduino by saving it to a file or did you use the NN in Java for a different reason?
@Imperial_Dynamics7 жыл бұрын
I love C#. THANK you my friend
@underpowerjet7 жыл бұрын
No problem :D. If you're interested in back-propagation tutorial that will be coming out this weekend :D
@rey12427 жыл бұрын
youre the best on neural networks thx for the tutorial
@underpowerjet7 жыл бұрын
No problem :D
@VidimusWolf6 жыл бұрын
Hey! Thanks for this tutorial! It is really good, albeit a tad unclear sometimes (probably due to my current lack of knowledge in Neural Networks). I just wanted to ask how come, in the mutate function (and maybe other functions) your random weight generation goes from -0.5f to 0.5f and it should be -1f to 1f? Thanks!
@acez286 ай бұрын
Very helpful man... very helpful 🎉 Instant sub
@TheTechpreneurs4 жыл бұрын
Thank you soo much.....nicely explained...
@stevecoxiscool7 жыл бұрын
Fantastic explanation of how neurons and weights are laid out in code. Great to see more people using Unity to experiment with NNs. Sorry your professor was tough on you about commenting your code, take it from me, the comments are not for others, once you have written thousands of lines of code in a production system, those "comments" are for YOU !!! LOL ... trust me, you will be reading your own code and be like, "wfa" wrote this sh*t, it's totally wrong ... oh, .... me ;)
@underpowerjet7 жыл бұрын
I am VERY diligent in commenting at work! I don't think my manager would believe I write code without commenting if he saw my personal projects hahaha. My commenting in personal projects is almost non existent since I give my methods very specific names that I have learnt to trust over many personal projects. Saves me a great amount of time, plus it's a good memory management practice. Having to remember tiny details across various projects helps to create a good aptitude for memorizing bug/situations that would otherwise be overlooked.
@conor64037 жыл бұрын
Great video! I have done some work with genetic algorithms myself and came across a clone method using serialisation, I'm no expert in computer science so this may be far less efficient than your method but it's much easier to transfer between projects. static objectType Clone(objectType source) { // Don't serialize a null object, simply return the default for that object if (Object.ReferenceEquals(source, null)) { return default(objectType); } IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); using (stream) { formatter.Serialize(stream, source); stream.Seek(0, SeekOrigin.Begin); return (objectType)formatter.Deserialize(stream); } }
@underpowerjet7 жыл бұрын
I guess this kind of thing could be good, if you want a serialized class to be delivered to a different server for testing or training (multiple server training).
@andriibessarab3 жыл бұрын
Nice tutorial! it helped a lot!
@bulalaish7 жыл бұрын
wow perfect. great tutorial mate
@underpowerjet7 жыл бұрын
No problem :D
@allypearlman55693 жыл бұрын
Hey, the download seems to be down, or private either way, would it be possible to reupload it? as im still slightly confused on how to feed inputs and outputs through the Nural Network
@underpowerjet3 жыл бұрын
Yea, it's all on github now. github.com/InderPabla
@shiryu1057 жыл бұрын
Great tutorial, the implementation of layers of the Neural Network is explained very clearly. However, at @18:14 I don't understand how the input affects the outputs, the calculation is very confusing to me. Also I am trying to generate locomotion in virtual creatures. Would you say using a forward feed NN is appropriate? or would something like back propagation be more suitable for generating sequences of movements. Thank you for the tutorial by the way.
@underpowerjet7 жыл бұрын
At 18:14 a feed-forward is happening. It's really hard to explain it in the comments haha. I'll provide some links which should give a better explanation. You can keep looking back at the code to see how it works. Check out this link. ujjwalkarn.me/2016/08/09/quick-intro-neural-networks/ Understanding feedforward process is C R U T I A L before you move on to coding it!!! Locomotion generally requires some memory from the creatures past actions and past states. Yes neural network are perfect for it. But you would need a recurrent neural network to get the virtual creature to learn complex movement patterns. The easiest solution would be to just add more output neurons and then loop those neurons back into the input. So example, the creature has 4 leg joints. Input neurons would looks like this Inputs: {Leg 1 State, Leg 2 State, Leg 3 State, Leg 4 State, Previous Leg 1 Action, Previous Leg 2 Action, Previous Leg 3 Action, Previous Leg 4 Action, Previous Output State 1, Previous Output State 2, Previous Output State 3, Previous Output State 4 } Outputs: {New Leg 1 Action, New Leg 2 Action, New Leg 3 Action, New Leg 4 Action, New Output State 1, New Output State 2, New Output State 3, New Output State 4}. This way the creature gets to have some memory of it's past actions and it can learn to use these "Output States" at some kind of internal memory system.
@shiryu1057 жыл бұрын
The One Ah, I see what you mean. Thank you for the explanation and the links. I will definitely take a look. Another question is, if I was to use the feed-forward approach for the creature to learn locomotion, what should kind of results should I expect? Would it be a complete failure?
@underpowerjet7 жыл бұрын
You should see results within seconds of traning if the network and the underlying code for the creature is done properly :D. The result will be.........you being mind blown by a creature walking that you evolved. I have some videos on locamotion if you are interested. In "Evolving Neural Networks Of Bipedal Creatures" video I used a NEAT (Neuro Evolution Of Augmenting Topologies) brain. In "Walking Robot with Evolving Brain Simulation" video I used a Recurrent Neural network brain. And finally in my "Evolving Neural Networks Of Joint Segmented Line Creatures" video (probably my fav project :D) I used a Recurrent Neural network also. I have a tendency to give up on my projects and move on. You can achieve 100x cooler stuff than this if you put more time into it. It will DEFIANTLY not be a failure. It will be time well spent :D :D
@shiryu1057 жыл бұрын
The One Thank you very much! Will definately take a look.
@typicalhog7 жыл бұрын
Awesome! Also, what do you think about making creatures learn from the player (or maybe even other creatures) with backpropagation? Do you think that would be doable?
@typicalhog7 жыл бұрын
I think this could be interesting because we would be able to guide the creatures towards the certain type of behavior and let them continue improving by switching back to the mutation based algorithm when we want.
@underpowerjet7 жыл бұрын
It's certainly do able. It won't quite be very fun with this boomerang thing. And training a creature to walk (an example) would be too complicated in terms of key presses. There probably needs to be a more fun agent to train. So it's actually fun to train it and not boring or too hard.
@clemens11863 жыл бұрын
how long will you answer comments ? (This is a good Tutorial thanks for everything)
@brendlambert7 жыл бұрын
Thanks!!! This is exactly what I need!
@underpowerjet7 жыл бұрын
No problem :D
@jonathankriesler20374 жыл бұрын
Finally I understand how neutral networks work. I’ve been trying to figure it out for weeks and you are the first one to make sense! Great video! I want to copy the code but all the cutting makes it really hard. And I can’t find where this project is in the GitHub you linked. Can you please tell me where this code is so I can finally start working on neural networks?
@DubezOniner3 жыл бұрын
check this awesome C# Q-Learning algorithm kzbin.info/www/bejne/poXKepJjrr6feKM, it has source code on github
@strahd78643 жыл бұрын
Thanks for the tutorial😀
@alessandrogerelli7 жыл бұрын
Hi, really good tutorial: thank you for the skipping the part of the connection with Unity and for the deepening about the nerual net. Only one question: why dou you have decided to remove the neuron biases? Thank you for reading and sorry for my english
@underpowerjet7 жыл бұрын
I........have........no.......idea.....what the past me was thinking. I ask my self that too now....
@beyond-axis6 жыл бұрын
I'm trying to add the neuron biases into your script, but I'm a little confused, could you explain the modifications you would need to make to implement the biases?
@nimbo94927 жыл бұрын
@The One: Hi, Thanks for your video. It's been very helpful on learning ANN creation. My Plan is to make a robot circuit that is self-learning. Is this the same method that i need to follow for implementing the evolving neural network on a physical circuit?
@underpowerjet7 жыл бұрын
Yeah similar method. I have a video where I train a robot to learn to walk using the same process shown in this video. It's a simple process you need to follow: 1. Have a population of brains. 2. Give your robot/circuit thing brain and let it do what it was going to do. 3. Rank the robot/circuit on how it preformed. 4. Do, step 2 and 3 for all the brains. 5. After you're done testing you have to breed the best. In my robot learning video, I removed 50% worst and and makes mutated copies of the other 50%. 6. Restart from 1. Once you're done testing and you think you have a decent brain, save it to a file and use it again in the future :D
@nimbo94927 жыл бұрын
Thanks a lot. I will definitely watch that video as well. I am honestly a noobie into this stuff and right now I am working on a project to build a complex neuron circuit, so i appreciate if you could bear with me. Just got another question. Why did you decide to start your neural network with 4 layers of 4*4*3*2 neurons? so what does each input and output mean?
@underpowerjet7 жыл бұрын
That was just an example! I just wanted to talk about the structure of the neural network. That image of 4*4*3*2 was ONLY for demonstrations, and I used it to show how a neural network data structure is created from these layers. What is an input? Input is something that you pass into your neural network. It's generally an array. In the video I create a method called "FeedForward" which took in an input array as parameter and returned an output array. The input could be anything! Suppose you want to predict cancer based on a some *input array = [size of cell, weight of cell, deformation of cell in %, other cell properties]* and then the output would be *output array = [cancer, not cancer]* Which ever output value was higher that would be the answer.
@thomaslowen24747 жыл бұрын
Great video! I never tried C# but in the FeedForward method when taking the inputs, can't you just do neuron[0] = inputs instead of iterating over all of them individually? Maybe somebody else has already pointed this out (I didn't read all the comments) or maybe I'm just wrong and it doesn't work like that but I was just wondering. Anyways, keep up the good work!
@underpowerjet7 жыл бұрын
Yes, you can do neuron[0] = inputs. But, in general it's best practice in programming to not affect referenced parameters because it might cause serious debugging headaches. But yes, you can do that too. And thank you!
@Gorvvb4 жыл бұрын
i have 3 errors when i make this the first one is "the type or namespace neame 'NeuralNetwork' could not be found", "Method must have a return type" x2 can you help?
@underpowerjet4 жыл бұрын
1) Could be some issue with your VS configuration. 2) Which method? This also sounds like issue with VS configuration. 3) Can you check if your files are stuck in "Miscellaneous" state in VS? - If they are stuck in Miscellaneous state. You will need to re-add them into the project.
@Gorvvb4 жыл бұрын
@@underpowerjet Thank you for the quick response! and thank you for wanting to help me. i rewached your video and saw that the namespace problem was a mistake in my code! 1. i dont think so. 2.The to public NeuralNetwork() has to return a type! 3. no its Assembly-CSharp.
@underpowerjet4 жыл бұрын
@@Gorvvb hummm very interersting... where u able to resolved the issue? Not gonna lie have not looked at that code in a long time. I don't recall any issues with return type.
@Gorvvb4 жыл бұрын
@@underpowerjet no i have not been able to fix it but it wants me to have public "void" "name", instead of public "name"
@underpowerjet4 жыл бұрын
@@Gorvvb I just downloaded and ran the project with no issues. Can you provide a stacktrace screenshot on imgur? I have no idea what method this error is complaning about, or what line it's occuring at. I might be able to debug if I can see what the error actually is. And, if i'm not intruding too much I would suggest looking into some C# programming tutorials so you can get familiar with the language.
@thenaturalpeoplesbureau4 жыл бұрын
Thank you very much this is excellent stuff..
7 жыл бұрын
Nice video! I actually made a neural network in unity myself with exactly this method. While it works great I ran into quite some performance problems as soon as I increased the simulation speed. To use all 4 cores I already created 4(to 8) different threads that work through their individual queue of "brain calculations". But after this 4* speed boost I have no other ideas how to improve! Do you have any performance tricks as addition to this tutorial? ;)
@underpowerjet7 жыл бұрын
How big was this neural network and what where you trying to do with it? I would NEVER use C# neural network for a very large neural network (100,000+ connections). It would be very slow. To train a large neural network I recommend looking at Keras or TesnorFlow libaries for Python. Which can be set to compile the neural network down to low level C with the use of GCC. And this can be incredibly fast! If your neural network was not very large, I would need more information on how you created this neural network. Did you use classes instead of a matrix format? And Thanks :D
7 жыл бұрын
I indeed started with classes - even game objects - because i thought being able to visualize it would be nice. But I switched to a matrix with a calculation just like in your video. After that change I never knew how many connections existed (evolutional genetic algorithm - I tried something like LSES in a 3D world with the single food sources being networks them selves) Currently a "tree" has 40 connections and an average animal has 232 connections. A quick implementation showed, I get about 8000 connections per FixedUpdate, which should be safe. This analysis revealed that my problem is something else... almost looks like a memory leak.. I'll look into it after work - you send me into the right direction with your question, thanks a lot! I would love to include TensorFlow into Unity, but i guess that's not too easy with a neural net that still is getting trained?
@underpowerjet7 жыл бұрын
Yeah, 8000 does not sound like a lot at all. It should not have been that slow. In LSES I could easily get 3M-4M connections across ~2000+ neural networks simulating before I started seeing issues. This is the issue with evolution sims >_
@wellwild7 жыл бұрын
Brilliant. Thanks a lot. I have some basic knowledge and I was able to understand enough. Thumbs up and sub ;)
@underpowerjet7 жыл бұрын
Thanks :D Your comment by the way was detected as spam for some reason and KZbin put it in my spam box. -_-
@omg_look_behind_you7 жыл бұрын
love it. thanks, bro
@underpowerjet7 жыл бұрын
No problem :D
@etto44253 жыл бұрын
Good evening! I have followed your amazing tutorial, but when I feed the feedforward function for 2 inputs, a bunch of errors pop out saying that the index is out of range. Any solution? Thanks.
@beyond-axis6 жыл бұрын
How would you add a constant bias neuron to this Neural Network?
@rotemalbukrek2444 жыл бұрын
hey, how can i implement the neural network that you built in the video into a project like the game in the end of the video?
@InfernalMave7 жыл бұрын
Hey there, great video! System.DateTime.Today.Millisecond() always results 0, maybe that was the problem with your random values. Keep it up!
@underpowerjet7 жыл бұрын
yeah that seemed to be the issue....I works perfectly fine in my other code so I'm just confused....>_
@rainbowhype7 жыл бұрын
Thanks so much! I can't wait to try this in 3D, especially in VR. Could you open up the sharing permissions on your Google Drive? I'm trying to download the Unity files, but it's telling me "Failed - Forbidden."
@underpowerjet7 жыл бұрын
I just downloaded it on a separate account and it worked fine. I reloaded the link just in-case. If you're still having problems, I recommend clearing your cache. And no problem :D
@rainbowhype7 жыл бұрын
Bizarre--it worked fine when I logged out of Gmail. I have your brain files now :P Thanks for checking on this and keep up the great work!
@underpowerjet7 жыл бұрын
Noooo not my brain!!! It's copyrighted!
@jawbuzzer31355 жыл бұрын
I am new to neural networks, but isn't the CopyWeigths method superfluous since you can use the Weights component of the parent network? Great vid!
@underpowerjet5 жыл бұрын
The weights need to be deep copied. So that making a change in one does not affect the other.
@jawbuzzer31355 жыл бұрын
@@underpowerjet I see. Thank you for the reply!
@drummerman8834 жыл бұрын
Thanks, Very Helpful!
@zvisger5 жыл бұрын
How many generations do I need to let this train before getting similar results to what you got in the video? Trying to figure out if I did something wrong. They are just going in circles and occasionally one will wander out of the pack doing somewhat more intelligent movements but then they seem to die off and I just have a mob of bots going in circles not making any progress. Currently at Gen #117. Any help or tips would be appreciated, let me know if you need any additional info from me. THANK YOU
@neslihanyakay33146 жыл бұрын
this is amazing ill definitely try this but i have a question you had only 4 layers right? more layers mean more precision everytime we add a new layer does the matrix grows more? like lets say 10 layers and 10 neurons each. is it a way to make this more dynamic?
@underpowerjet6 жыл бұрын
The way I designed it, you can have any number of neurons in any layer. You can have 10 layers, maybe the first layer has 2 neurons, second has 34 neurons, third has 10 neurons etc... Is this what you mean?
@neslihanyakay33146 жыл бұрын
no i mean the matrix like lets say a[][][] later you get more neurons and layers does it become like a[][][][] so on?
@underpowerjet6 жыл бұрын
OKAY I THINK I KNOW WHAT YOU MEAN! You mean a dynamically changing neural network? Like if a network had 100 neurons in it's first hidden layer and then some time later it had 105 neurons? It can't be done with a normal neural network. Most neural networks such as MLP, RNN, CNN require you have have a set designed model structure which is static and CANNOT change! There are neural networks that can change however! The concept behind that is called "Evolving Neural Networks". I have a few videos on that where the network evolves and creates connections over time to get better "Evolving Neural Networks NEAT With 3D Cars + Tutorial"
@neslihanyakay33146 жыл бұрын
wow thats so cool thank you :D
@underpowerjet6 жыл бұрын
No problem :). If you're interested in this concept of Neural Network look up the NEAT research paper. It's very easy to understand the way it's written.
@robertozamora22202 жыл бұрын
Hi there! First of all I want to thank you by your video, its been very helpful. I'm starting learning neural networks and what I don't understand, and may be my question may not make sense is: Why you're not taking care of the BIAS vaule in your code? Thank you very much
@underpowerjet2 жыл бұрын
I forgot to.
@underpowerjet2 жыл бұрын
It should be pretty easy to make bias variable as well and mutateable.
@robertozamora22202 жыл бұрын
@@underpowerjet thank you for your answer! I just asked you because I got a little confused and not know if in this aproach was necessary or not. I could add it in my code easily! Again, thank you for your work that is very helpful for us!
@underpowerjet2 жыл бұрын
@@robertozamora2220 No probs! :D
@MWorks087 жыл бұрын
'Gonna watch it right now!! :D
@underpowerjet7 жыл бұрын
Guud guud!
@wesleycats26516 жыл бұрын
First of all thanks for this video! It helped me so much to understand how to build a network and how it works. So again thanks for that. I did a question though: In the feedforward method after you have itterated over all neurons and summed the off all weights connections of that neuron with their values in previous layer, you set that current neuron to the hyperbolic tangent of the value, but why do you use the hyperbolic tangent? Thanks in advance. P.S. I don't know an alternative or something, I'm just trying to understand. :P
@underpowerjet6 жыл бұрын
hyperbolic tangent, softmax, sigmod, or RELU etc, these are what are called "activation functions". Their job is simply to squash the input and keep them within a range (Example: hyperbolic tangent keeps it between -1 and 1, where as sigmoid keeps it between 0 and 1). What this allows the network to do is, to learn non-linear relations which might otherwise be hard to pick . Another way to think of this is, your output MIGHT change faster or slower as you linearly increase your input (Example: [Input 1, output 2]. [Input 2, output 4]. [Input 3, Output 9]). Trying to map a non-linearly changing output with a simple y= mx, is not always easy. So that's why instead a squashing function can be used to make it y = some_activation_function_to_make_it_non_linear(mx).
@fisslewine12226 жыл бұрын
I loved this tutorial, but would love to see how to implement backwards propagation, and use the neural network for other things, such as a bodyguard ai, where the ai follows and protects the player from enemies...
@underpowerjet6 жыл бұрын
Already have a video on it :) I got pretty in-depth with how to calculate it on paper and then program it.
@jazzj27 жыл бұрын
i took this version and gave it the ability to randomly create/remove new neurons. any idea if that actually helps in any way?
@underpowerjet7 жыл бұрын
That is defiantly not going to be very useful if you're removing and adding neurons in the hidden layers because each new neuron you added with randomized weights will hurt previous evolution (because each neuron will connect to every neuron in the forward layer thus affecting them all adversely)!!!. Removing and adding neurons in the input and output layers is understandable since that could mean a new sensor is being added or a new action output is added. If you want to have a mutating network structure then I would recommend you look at the NEAT algorithm (Neuro-Evolution of Augmenting Topologies). In NEAT the entire hidden layer structure is built from the ground up through evolution, new neurons and connections get added and removed over time. An addition of a neuron does not destroy the previously learnt behavior because each neuron may only make 1 connection when it's created. Where as with normal neurons network the number of connections would be the # of neurons in the forward layer. This creates and much easier learning experience for the network itself.
@Promar226 жыл бұрын
How is it that you can change the position of the target (the yellow hexagon) and they still know where to go, does that mean during training you continuously varied the position of the target? and I'm assuming the final clip of the boomerangs is after they have undergone several generations?
@underpowerjet6 жыл бұрын
The input to the boomerang is the degree of change required for the boomerang to "look" at the hexagon (it's actually radians and not degree). So when the hexagon changes location, so does the degree of change for the boomerang. Now the boomerang has to adjust and turn in a certain direction to look at the hexagon again. It didn't take very long for the boomerangs to learn ~5 generations.
@botalex48454 жыл бұрын
This is not the easiest tutorial in C# that i could find but this is the ONLY one that i could find. Debug.Log("Thank you");
@agungbencong84683 жыл бұрын
How many input layer you made of this video....iam very confuse when you start code
@thomaslinssen14266 жыл бұрын
Turn on subtitles at 19:21
@underpowerjet6 жыл бұрын
lel
@nikolacekic63176 жыл бұрын
Great tutorial! I love it. What's the song in the background?
@faceless83374 жыл бұрын
Thanks so much for making this tutorial, easy to understand. But i still am confused on how to do the input part. I want to create a 2D Character learn how to jump and run over obstacles to the end point. What inputs should i use?
@SteamfriedShorts4 жыл бұрын
I have a problem with the code. neurons = new neuronsList.ToArray(); returns an error because "neuronsList is a variable but its used like a type" I have no idea what to try here.
@devonsparkle20124 жыл бұрын
It's supposed to be neurons = neuronsList.ToArray(); It shouldn't be new
@brendanbrowne21035 жыл бұрын
hey dude saw your video on teaching a robot to walk via evolving neural networks. Do you haves sources where i can learn how to do this. Very interested in making a bipedal robot.
@underpowerjet5 жыл бұрын
I supposed you can seperate into 2 categories. Hardware and Software. Hardware: - Arduino - Blutooth Slave Shield - 4x 9 gram Servos Software: A way to communicate with Arduino via Blutooth. 1) Arduino is a microcontroller (VERY easy to learn). You can buy it from Amazon. Buy some 5mm LEDs and you can learn some basic Arduino program in less than 5 minutes. 2) Next play around with the Serovs with the Arduino and write some basic program to move then around. (Also very simple ~5-10 minutes). 3) Next you will need to learn how to hook up Blutooth Shield with the Arduino (this is a little tricky and takes some time to learn). There's plenty of online code explaining how to do this with JAVA. But, you have to kind of play around with it. Eventually you will be able to send data to your Arduino from your PC. Once you are comfortable with 1) and 2), the rest should become pretty clear. Also just note that you will need a Blutooth adapter on ur PC. Otherwise you might need to buy a Wifi Shield.
@raymondbenjamins58846 жыл бұрын
9:18 That seems way too complicated. Why not just say: this.layers = layers; There's absolutely no need for a loop there. Since the parameter and the field are the same data type, you can just assign it like this. EDIT: Just got to the part where he explains why he did that. That actually makes sense now, so thanks for that! Might have been better to explain it earlier though... At 9:51 you use a for loop. The code would be simplified if you were to use a foreach loop instead. This is more a matter of preference though, but personally, I find the foreach to be way more readable. It'd become: foreach(var layer in layers) { neuronsList.Add(new float[layer]); } But that entire method can actually be reduced to one line using System.Linq: neurons = layers.Select(l => new float[l]).ToArray(); This is definitly not as beginner friendly as the other code is though.
@raymondbenjamins58846 жыл бұрын
Note: this is not meant as critique or anything negative. Just trying to help improve on this.
@underpowerjet6 жыл бұрын
I do not see this as a critique :). You are right. And yes, shorter single line linq library style copying also works and is much more elegant than something that takes up lines :D.
@owendorsey58666 жыл бұрын
Thank you so much for this
@underpowerjet6 жыл бұрын
No probs
@MrPiggybank19747 жыл бұрын
I think a List of a lists would of been better then a List of array types e.g. List just an idea for you, nice idea though.
@underpowerjet7 жыл бұрын
I am pretty sure List cannot directly be converted to float[][], I could be wrong. Also List computation would be incredibly slow compared to float[][]. But yes it can be done :D
@MrPiggybank19747 жыл бұрын
Hi Derek, it was not about computation it was about how to hold the data itself, although memory wise the array e.g [][] is smaller, because of the overhead of the list generic, but your neuronslist video "11:21" is actually a list that holds an array, which may change from stack to heap or the other way around, I can never remember which goes where, mitigation the extra speed, but really good tut though :)
@MrPiggybank19747 жыл бұрын
I just wrote a detailed rely and pressed reply and it went, not happy. I'm assuming that this form of pattern could be used in a building simulator like "THE Settlers" Amiga game? e.g.
@liammmmmmm963 жыл бұрын
so how do you save the model you have created and input that saved data etc for a continueing project>?
@underpowerjet3 жыл бұрын
You can't from what I showed. But you could write some logic to serialize and save the weights matrix.
@kH-ul4hk4 жыл бұрын
Hi, I get an error at this line: public float[] FeedForward(float[] inputs) { //Add inputs to the neuron matrix for (int i = 0; i < inputs.Length; i++) { neurons[0][i] = inputs[i]; //this one, The error is: IndexOutOfRangeException: Index was outside the bounds of the array } why?
@underpowerjet4 жыл бұрын
Because the index was out of range.
@kH-ul4hk4 жыл бұрын
Yeah but how did that happen. I did exactly the same as you did. I only made the inputs and outputs larger, but that should be the problem right? The layers in my object class i need the NN for is public int[] layers = new int[] { 9, 10 , 10, 4} and the input array i put in the feed forward is an array with 9 variables inside. Did I forget smth? Where does it go wrong
@underpowerjet4 жыл бұрын
@@kH-ul4hk Add a few logs and see where the sizes mismatch.
@codelinker63187 жыл бұрын
Oh the comments Lost 10% too !!! You share me the same pain ;(
@underpowerjet7 жыл бұрын
It was a tragic day :(. It will always be remembered.
@IgorAherne7 жыл бұрын
//feed forward this network with a given input array float [] FeedForward(float[] input){} Captain Obvious :)
@underpowerjet7 жыл бұрын
You never know man, there's always someone that will get confused :D
@noahbennett80742 жыл бұрын
I want to build a neural network to build foot prints for part decals in pads layout using C#. Any suggestions? the idea is it would take a pdf of a part I need to make and generate the pins, the distances between all the pins and the size of the parts body near instantaneously. I know virtually nothing about making a neural network but I am pretty well-versed on the subject. My background is that I am a recent college graduate with a engineering major and computer science major. I know C# (highly experienced), java(highly experienced), python (rudimentary to practically none), C (fairly to very familiar with) and a hand full of other unhelpful languages. I have looked into things like Marl/O and a few other similar projects, but haven't been able to really sink my teeth into the subject.
@matesatacker3 жыл бұрын
what are the weights?
@drewmileham2025 жыл бұрын
How would I just make a boomerang with the same neural network as another boomerang durning runtime? I basically just want to duplicate one boomerang.
@dantecavallin82294 жыл бұрын
Actually the weights collection is called a tensor as matrices are 2D and tensors are 3D. :)
@hirshagarwal7 жыл бұрын
Really cool videos! Are you a CS student or professional or is this just a hobby? Just curious :) Love you stuff!
@underpowerjet7 жыл бұрын
Graduated last year. I guess I am a "professional" now haha. But this is just a side hobby.
@speediplayz_gaming4 жыл бұрын
the thing that always confuses me is what do i do with the inputs, like from my understanding they are between 0 and 1, so how would i use that to do something such as a rotation? because i understand basic boolean ones where its either you jump or you dont, its either true or false, 1 or 0
@underpowerjet4 жыл бұрын
All rotations can be clamped between 0 and 1 (radian/(2*Pi)). True or false aka 1 or 0, is a good input too. The goal is to let the system learn the the mapping between input and output over many training sets. You just need to ensure the the fitness function and the neural network rankings is as fair as it can be.
@enciphered76507 жыл бұрын
why didn't you just use array.clone method ? is there a drawback to using array.clone method ?
@underpowerjet7 жыл бұрын
It only does a shallow copy and not a deep copy. float[][] someArray = (float[][])anotherArray.Clone(); Both someArray and anotherArray have the same reference in memory! Only 1D array can be cloned at a time.
@enciphered76507 жыл бұрын
OMFG this explains all the bugs I'm having >.>
@underpowerjet7 жыл бұрын
Yeah I remember testing Clone to make sure it was going to work before I used it haha.
@enciphered76507 жыл бұрын
I'm gonna be trying to make a convolutional network using c# for OCR now that I get the concept of a neural network... I swear to god before I actually tried recreate your code and I kinda got what people were saying but I just didn't understand it to this level... After recreating your code I'm confident I can make any type of neural network just by looking at the structure of the neural network :') Thanks man...
@enciphered76507 жыл бұрын
Just one more question... Would it be a good idea to train my neural network using evolution instead of back propagation ? I'm probably gonna try to keep the number of weights to a minimum but for some reason I don't feel like evolution method will work