Thanks for stopping by! Today we will encounter a problem we can't easily solve with our normal algorithmic tools so we deep dive into a class of algorithms called: GENETIC ALGORITHMS! I hope you find it as interesting as I do. *What would you use them for?*
I first learned about evolutionary algorithms from this TED talk www.ted.com/talks/bill_gross_a_solar_energy_system_that_tracks_the_sun/ Since then I have wanted to use them to write a program that attempts to learn how to write brainf***. BF seems like a good language choice since there are only a handful of symbols and writing/instrumenting an interpreter to also evaluate an objective function to feed back into the evolutionary algorithm would be simple! I haven't gotten around to it yet, but perhaps soon!
This guy explained everything from 2 weeks long boring lecture in under 12 minutes with extremely clear explanation. I love you because you just saved my degree.
Do you know how he calculated the total number of combinations in a naive brute force approach? I did permutations and combinations and the values were not equal.
This is why I love watching RUclips. Sure, 95% of the time is trivia and entertainment, but then you stumble upon things you either where looking for or not, and you learn them in minutes instead of the years it takes from professional lecturing. (Granted, processing that information is a whole other ordeal, but at least you have it on hand)
According to me, his video is THE BEST explanation on RUclips on Genetic Algorithms. My mates and I understood Genetic Algorithms like never before, loved it, and implemented it in our University Course Project. Thank you, Kie.
This video was AMAZING. I can't believe the amount of time and effort you took to explain this topic so clearly. It sucks that you stopped making videos. What can I do to motivate you to make an algorithm series?
Dude, Your videos are higher quality then Pewdiepie and Dream combined Not exaggerated I have literally understood a concept u have tried to learn from past 10 months
Excellent video! One of the better selection algorithms and more typical is a tournament selection. Rather than choosing the best fitness genes for the next generation, each gene is given a probability of selection based on their fitness. Better genes have a higher probability of selection, and worse genes have a lower probability of selection, but the odds of selection are not 100% and 0% respectively. This takes a bit longer when it comes to finding a solution, but it gives a better search of the solution space.
Great video! I've been facinated by genetic algorithms after seeing people use it to beat levels in Super Mario Bros. There's just something so fascinating about watching a computer "learn" how to get better at doing something.
Thank you Aliticx. This comment really means a lot to me. 🙏 Having people to really understand what I try to explain is way more worth to me than subscribers and views. Thank you.
Hi Kie, congratulations on the clarity of your explanation. It gave me some suggestions on how to improve the way I explain these algorithms. I work in Italy as a physics researcher and in my group we routinely employ these kinds of algorithms to optimize the performance of particle accelerators redesgning them (with a similar approach to the antenna problem you mentioned). I can confirm that they work wonders at solving systems whose dynamics are extremely complex (especially when due to highly correlated variables)! I wanted to tell you that in our code we apply elitism as the last thing (even following mutation) to be sure that the best fitness value never goes down in subsequent generations. If you apply mutation later, you risk losing the best solution from the previous cycle. Nothing catastrophic though, the genetic information to reconstruct the best solution is mixed in the rest of the population anyway and will probably re-emerge soon anyway.
Hi thanks for sharing your insight! It is very instructive and helps me clarify the confusion about the top performers of the previous generation being mutated instead of kept intact in the video. But this video really offers a great explanation.
After watching the video I opened the channel expecting to see millions of subscribers. You deserve much more!! What an awesome video. Simple and right to the main points! Keep up the good work!
Wow. Thanks for your kind and motivating words Mo. I will try my best. To be honest I wouldn’t be ready for millions of subs. Glad to hopefully hit a 1000 till 2021. Have a great day! 🙏
@@KieCodes dude your videos are extraordinary! I couldn’t resist 🤷🏻♂️ Wish you best of luck man! Can’t tell you how happy and excited I am to see what you have next!
Wow your video is awesome! You explained a pretty complex algorithm in a simple way. I've always wanted to use genetic algorithms for one of my videos, this is a fantastic intro to the field! btw I love your video quality, it looks soo good.
this is awesome!!!!!!! I am a mechanical engineer with 0 knowledge in these type of algorithms but for the sake of a project on scheduling using the genetic algorithm I was surfing youtube, this is the best explanation I ever had and it is very clear if possible, please suggest algorithms similar to this which are good for job shop scheduling.
I can't thank you enough. Tomorrow's my AI exam and your video helped me prepare for it. I wish your channel explodes with magnitudes of subs. Thank you so much!
Good overview. I would suggest a fitness function that goes negative for non-solutions, so even if you have no solution, because the problem is so hard, you still keep the genomes that are closest to a real solution. With having fitness=0 for all non-solutions, you can't distinguish how bad or close the genomes are.
All is fine and useful from this video and I will recommend it to my students as a quick introduction, BUT this is not natural selection - it is called "directed" or "purposeful" selection. It is similar to what you have in ML for supervised learning - there is an aim (manifested by the elitist genomes)... Natural selection works aimlessly and randomly. The biggest difference between the two is the speed of convergence - as Natural selection is a notoriously slow process.
really good explanation , better than most of videos that i have seen and better than my teacher's lecture , keep up the good work , greetings from algeria
Sure. In this problem I want to have the most value in my backpack whithout over-reaching it's capacity. So for each genome, that defines a set of items inside my backpack, I add all the weight. If the weight is already heavier than I can carry in my backpack, then the solution is not valid and its fitness is 0. If the weight of the set of items fits inside the backpack, I add up all the values of the different items and the accumulated value of all items is the fitness. So a genome with a solutions that provides more value is fitter than a solution that provides less. In my follow up video you will see the code explained and a link to a github repository in the description. I hope that helps. Happy coding!
@@KieCodes so that means the mathematical function is that the sum of the weights must be equal to or less than 3 kg? I think I am struggling more because the last time I used C++ was 10 years ago! Alright now next question is that in your video each item is assigned a binary digit either 1 or 0. How do you decide which is 1 and which is 0? Sorry if that's a stupid question.
The binary representation is to encode a solution. 0 means not inside the backpack and 1 means it is inside. These genomes are generated randomly. After that they are evaluated (fitness function) and recombined (crossover function) and slightly changed (mutation function) and thus way we get a new set of solutions/genomes. It is an algorithm based on the idea of evolution and it surprisingly works to get better and better solutions with every step of the process. I hope that clears it up a little but more.
*The Best Solution* [Phone, Headphones,Baseball Cap,Laptop,Coffee Mug] Weight: 2980 grams *My Genetic Algorithm* [Phone,Headphones,Mints,Notepad,Tissues,Laptop] Weight: 2998 grams. ooop made one before watching your other video to test myself so not sure if you found this in that video. but this video is great
Great video! You should explain that the number of comb is 2^n being n the set, because of each item you can or can not choose it. So, due to that possible decision over every item, you get 2^n. Instead, the all possible combination should be the factorial of 5; computer mug pencil, computer pencil mug, pencil computer mug, pencil mug computer and so on.. Amazing work!
@@KieCodes Pattern search like Hooke Jeeves would be great. Also, new programmers face problem which approach to use: objective function or array as input values into optimisation problem. Would be great to hear some advices when to use which method.
Hey. Thank you. This is something you need to try out. If the genes are very large you will need a larger generation size, but too large is not good as well because it slows everything down.
3:10 This version of the Knapsack problem that is the 0-1 Knapsack problem is very well solvable in O(n) time where n is the number of items using Dynamic Programming. I am not sure what you meant there. But yes there are some problems which cannot be solved in polynomial time by any algorithm termed as the NP-hard problems. Some examples include the Travelling Salesman.
Yes a very specific version of the Knappsack problem is. It was just an easy to understand example for NP-hard problems, I choose. Maybe I chose unwisely. 😅
Thanks for stopping by! Today we will encounter a problem we can't easily solve with our normal algorithmic tools so we deep dive into a class of algorithms called: GENETIC ALGORITHMS!
I hope you find it as interesting as I do. *What would you use them for?*
I first learned about evolutionary algorithms from this TED talk www.ted.com/talks/bill_gross_a_solar_energy_system_that_tracks_the_sun/
Since then I have wanted to use them to write a program that attempts to learn how to write brainf***. BF seems like a good language choice since there are only a handful of symbols and writing/instrumenting an interpreter to also evaluate an objective function to feed back into the evolutionary algorithm would be simple!
I haven't gotten around to it yet, but perhaps soon!
Thanks, you just helped me solved a vector problem I was having.
Oddly, I didn’t even use an algorithm.
very interesting ! let us know if you applied this to trading !
This guy explained everything from 2 weeks long boring lecture in under 12 minutes with extremely clear explanation. I love you because you just saved my degree.
You are more than welcome my friend. 🙏 Rock on! 🚀
2 hour’s lecture in 12mins how about that .
Do you know how he calculated the total number of combinations in a naive brute force approach? I did permutations and combinations and the values were not equal.
Never mind I figured it out, It is the sum of all possible (N chooses k) combinations k = 0, 1,..N which simplifies to 2^N
This is why I love watching RUclips. Sure, 95% of the time is trivia and entertainment, but then you stumble upon things you either where looking for or not, and you learn them in minutes instead of the years it takes from professional lecturing.
(Granted, processing that information is a whole other ordeal, but at least you have it on hand)
this deserves a million views
Thanks Sergio 🙏
I agree
Thank you. 🙏
not joking!
@@matt-g-recovers Thanks as well! 😅
I must say - the quality of this video is top-notch. The crisp editing, sound, and illustrations do a great job of demonstrating the point.
Thank you so much! 🙏
Three 1.5-hour-long lectures in my university explained in 11 minutes. Thanks!
Im a computer science degree student and this helps me to understand better on my final year project's topic! Thank you very much sir!
You are more than welcome my friend. 🙏 Rock on! 🚀
According to me, his video is THE BEST explanation on RUclips on Genetic Algorithms. My mates and I understood Genetic Algorithms like never before, loved it, and implemented it in our University Course Project.
Thank you, Kie.
You are more than welcome! Enjoy your studies!
This video was AMAZING. I can't believe the amount of time and effort you took to explain this topic so clearly. It sucks that you stopped making videos. What can I do to motivate you to make an algorithm series?
Dude, Your videos are higher quality then Pewdiepie and Dream combined
Not exaggerated
I have literally understood a concept u have tried to learn from past 10 months
Thank you. 🙏 I am glad I could help. And thanks for your nice words. ☺️
SOOOOOOOO gooood.... Nobody could have been more concise and informative at the same time.
Thank you very much! 🙏🙏🙏
Yo dude, this is some next level way of teaching your channel should've had atleast 1 mil already
Thank you. 🙏 Maybe some day. Thanks again for the motivating words.
Every second I that goes, I realize more how complete this video is ! This vid should definitely have more than a million views .
Thank you so much!
Excellent video! One of the better selection algorithms and more typical is a tournament selection. Rather than choosing the best fitness genes for the next generation, each gene is given a probability of selection based on their fitness. Better genes have a higher probability of selection, and worse genes have a lower probability of selection, but the odds of selection are not 100% and 0% respectively. This takes a bit longer when it comes to finding a solution, but it gives a better search of the solution space.
Great video! I've been facinated by genetic algorithms after seeing people use it to beat levels in Super Mario Bros. There's just something so fascinating about watching a computer "learn" how to get better at doing something.
Thank you! I totally feel the same. It is modern magic. 🙃
Toll. Das ist das beste Video, das ich bisher zu diesem Thema gesehen habe
you're great teacher. taking time to edit engaging videos with visuals like you do is very effective to help ppl grasp concepts
Thank you. 🙏
This is the hands down the best video on genetic algorithms!
I have not yet had to use genetic algorithms, but want to try them out after watching this video! Thanks for the introduction!
Thanks Braidy! Let me know what you used them for. :)
how is it not booming yet?! thank u for the clear explanation + the awesome edits!
Man I wish everyone explained concepts this good! Awesome video!
Thank you Aliticx. This comment really means a lot to me. 🙏 Having people to really understand what I try to explain is way more worth to me than subscribers and views. Thank you.
Hi Kie, congratulations on the clarity of your explanation. It gave me some suggestions on how to improve the way I explain these algorithms.
I work in Italy as a physics researcher and in my group we routinely employ these kinds of algorithms to optimize the performance of particle accelerators redesgning them (with a similar approach to the antenna problem you mentioned). I can confirm that they work wonders at solving systems whose dynamics are extremely complex (especially when due to highly correlated variables)!
I wanted to tell you that in our code we apply elitism as the last thing (even following mutation) to be sure that the best fitness value never goes down in subsequent generations. If you apply mutation later, you risk losing the best solution from the previous cycle.
Nothing catastrophic though, the genetic information to reconstruct the best solution is mixed in the rest of the population anyway and will probably re-emerge soon anyway.
Hi thanks for sharing your insight! It is very instructive and helps me clarify the confusion about the top performers of the previous generation being mutated instead of kept intact in the video. But this video really offers a great explanation.
You are such an underrated gem. GOOD JOB!!!
Thank you. 🙏
I,ve watched many clips in this regard but your explanation was one of a kind, absoulotlly deserve thousends of million of billion views
Wow. Thank you for your kind words! 🙏
man the effort you put in this video is - "Salute"
Thank you. 🙏
After watching the video I opened the channel expecting to see millions of subscribers. You deserve much more!! What an awesome video. Simple and right to the main points! Keep up the good work!
Wow. Thanks for your kind and motivating words Mo. I will try my best. To be honest I wouldn’t be ready for millions of subs. Glad to hopefully hit a 1000 till 2021.
Have a great day! 🙏
And thanks for subscribing! One sub closer. ☺️
@@KieCodes dude your videos are extraordinary! I couldn’t resist 🤷🏻♂️
Wish you best of luck man! Can’t tell you how happy and excited I am to see what you have next!
Wow your video is awesome! You explained a pretty complex algorithm in a simple way. I've always wanted to use genetic algorithms for one of my videos, this is a fantastic intro to the field! btw I love your video quality, it looks soo good.
Thanks so much for your kind words. 🙏
My teacher used 2 hours of class to explain what this man explained in 10 minutes, thanks
Thank you 🙏! Good luck for your studies. Take care.
Fantastic example. Really helps show how the conceptual steps actually work!
Thank you. 🙏
Dude this video is amazing. Great explanation, I liked the real world example too. Your editing style is sick too! Can't wait to see more from you
Thanks George. This means a lot and is really motivating! Great to have you here. Rock on!
Great video bro, helped me understand what my teacher's mumbling couldn't for our test, keep it up!
Thanks for your kind words. 🙏
Fantastic explanation! I learned more in this video, than my professor
Great to hear! Thank you so much!
Thank you for this Kie! I'm amazed that you use Genetic Algorithm to solve the Knapsack problem :)
I've never imagined that one day Seth Rogen will be teaching me Algorithms😂 (Jokes aside this video was amazing and well-made; GOOD JOB!❤)
Please don't ever go away. This was amazing
Thank you. 🙏
This is actually one of the best videos I've ever seen on RUclips. Thank you!
Wow. Thank you. 🙏🎉
I can see english is not your first language but still your pronunciation is really clear, thumbs up
Thank you
this is awesome!!!!!!! I am a mechanical engineer with 0 knowledge in these type of algorithms but for the sake of a project on scheduling using the genetic algorithm I was surfing youtube, this is the best explanation I ever had and it is very clear if possible, please suggest algorithms similar to this which are good for job shop scheduling.
Best video regarding this topic. Very visual and easy to understand
I can't thank you enough. Tomorrow's my AI exam and your video helped me prepare for it. I wish your channel explodes with magnitudes of subs. Thank you so much!
You are more than welcome my friend. 🙏 Rock on! 🚀 Good luck with your exam!
@@KieCodes thanks!
Good overview. I would suggest a fitness function that goes negative for non-solutions, so even if you have no solution, because the problem is so hard, you still keep the genomes that are closest to a real solution. With having fitness=0 for all non-solutions, you can't distinguish how bad or close the genomes are.
Good idea! Thank you. 🙏
To be honest, this is the best video explained about this Genetic Algor concept. Quality contents. Keep going dude!
Thank you. 🙏
Video is on point, accurate and does not waste your time. Thanks so much man.
I really appreciate your kind words! 🙏
All is fine and useful from this video and I will recommend it to my students as a quick introduction, BUT this is not natural selection - it is called "directed" or "purposeful" selection. It is similar to what you have in ML for supervised learning - there is an aim (manifested by the elitist genomes)... Natural selection works aimlessly and randomly. The biggest difference between the two is the speed of convergence - as Natural selection is a notoriously slow process.
Thank you for the clarification! 🙏
I rarely leave a comment but your explanation is just amazing. Good job
Thanks Taylan! 🙏
This video is astonishing, you deserve a lot more views, keep up the good work :)
Thank you. 🙏
I was really hard to digest it and I don't mean mathematically
BTW, tomorrow I have an exam and you save my life, a blessing from an AI student
I recommend this video to those who wants to simply know what GA is in 10min!!
Thank you. 🙏
This channel should have more subscribers! Really amazing video and explanation
Thanks Diego! 💪🙏
one of the best videos on genetic algorithm
Thank you. 🙏
You showed this in a way easy to understand! Thanks!
I don't usually make comments. but that was a really well-explained and interesting video, Thanks!
What a fantastic explanation! Clearly explain GA. Can you tell me what classical problem inspired you about the "backbag problem" in 0:23?
Hey. Thank you. The knabsack problem.
Thanks a lot for your explanation, looking forward to use genetic algorithms in the future!
Thank you. Have fun, its a great tool!
Great vid done a better job at explaining than a university lecturer
Thank you very much!
Really well explained and cured, these are the kind of explanations that I prefer, there's love and dedication behind it. Thank you!
Thank you. 🙏
really good explanation , better than most of videos that i have seen and better than my teacher's lecture , keep up the good work , greetings from algeria
Thank you for your kind words! Have a great day. 🙏
Really well explained.
I will appreciate it if you can make a project to solve time table scheduling problem with genetic algorithm.
Amazingly explained!! Thank you so much. 🙌
Whoah men! You fascinated me. What a level of explanation.
Thank you. I hope it helped. 🙏🫡
Start with a Problem presentation is a great way to learn.
Thank you. 🙏
@@KieCodes welcome sir, it is a great video... Again heartiest thanks...
You are more than welcome my friend. 🙏 Rock on! 🚀
I've never learned anything in this way
I love it!
I am glad to hear that!
Thank you so much! Please do Clonal Selection Algorithm next please...!
Wish you uploaded more. This is quality content.
Where are all the 12th grade IB HL Comp Sci students studying for the paper 3 at??? Thanks Kie great video
You are welcome. I hope my videos help you with your studies. Take care 🙏
What country provides these studies in grade 12 !?
You did a great job with this, two years ago i searched heaven and earth but didnt find a thing
Thanks a lot! Glad I could help.
Mind blowing. I can't wait to implement this.
It surely is. Have fun!
best possible explanation, became ur FAN
Thank you and welcome! 🙏
Thank you so much this video is very helpful for my thesis!
Glad it was helpful! 🙏
I’m here before this channel get 1million subs. Keep up the great work man!
Thank you. 🙏
Bro...
You help me with my thesis...
Thank you very very muuuch...
You are more than welcome, Catatan! 💪
Thank you for the video, will recommand to my students
What an amazing content, explained with simple words. Thanks and keep up the hard work.
Glad you liked it! Thank you!
Very informative video; full of information yet very easy to follow. Thank you!
That booping noise had me checking my pc and phone every time lmao.
😅 sorry
This was an amazing introduction to the topic and great intuition. Thanks for the video! It was also fun to watch😄
Thank you. 🙏
That was an excellent video. Clear, engaging, inspiring and fun! I will be watching more of your videos.
Thank you!
Just Wow! Hats off to you, that's a great explanation.
Thanks a lot!
Great You helped me in my HW assignment.
You‘re welcome.
Explained brilliantly.
Thank you so much. 🙏
Thank you!!! your explanation was very clear and awesome!! Definitely checking out the implementation
Thank you Michelle!🙏
You're awesome!
I don't speak English as well, but your explanation is really good, and I understand the main idea!
Thank you. 🙏
This is so well explained
Is it possible for you to elaborate how to generate a fitness function for the problem you are trying to solve? That is where I find myself stuck
Sure. In this problem I want to have the most value in my backpack whithout over-reaching it's capacity.
So for each genome, that defines a set of items inside my backpack, I add all the weight. If the weight is already heavier than I can carry in my backpack, then the solution is not valid and its fitness is 0.
If the weight of the set of items fits inside the backpack, I add up all the values of the different items and the accumulated value of all items is the fitness. So a genome with a solutions that provides more value is fitter than a solution that provides less.
In my follow up video you will see the code explained and a link to a github repository in the description.
I hope that helps. Happy coding!
@@KieCodes so that means the mathematical function is that the sum of the weights must be equal to or less than 3 kg?
I think I am struggling more because the last time I used C++ was 10 years ago! Alright now next question is that in your video each item is assigned a binary digit either 1 or 0. How do you decide which is 1 and which is 0? Sorry if that's a stupid question.
@@KieCodes will check out your next video ! Thank you for being one of the people that help others without even knowing it.
The binary representation is to encode a solution. 0 means not inside the backpack and 1 means it is inside. These genomes are generated randomly. After that they are evaluated (fitness function) and recombined (crossover function) and slightly changed (mutation function) and thus way we get a new set of solutions/genomes.
It is an algorithm based on the idea of evolution and it surprisingly works to get better and better solutions with every step of the process.
I hope that clears it up a little but more.
@@KieCodes yesss got it!! Thanks a lot!
"At some number of items, you wont only miss your flight, but the whole solar system would be gone" 😂
*The Best Solution* [Phone, Headphones,Baseball Cap,Laptop,Coffee Mug] Weight: 2980 grams
*My Genetic Algorithm* [Phone,Headphones,Mints,Notepad,Tissues,Laptop] Weight: 2998 grams. ooop
made one before watching your other video to test myself so not sure if you found this in that video. but this video is great
Thanks for your kind words! 🙏 and great effort implementing your own GA before watching my video. Amazing 💪
Really well explained
Great video! You should explain that the number of comb is 2^n being n the set, because of each item you can or can not choose it. So, due to that possible decision over every item, you get 2^n. Instead, the all possible combination should be the factorial of 5; computer mug pencil, computer pencil mug, pencil computer mug, pencil mug computer and so on.. Amazing work!
Thanks Juan for adding this info here. I am sure it will help future viewers of this video! 🙏
I like the way you explain algorithms.
Thank you for your kind words, LonleyGuns. 🙏 I put a lot of work into it. So that means a lot. What other algorithms are you interested in?
@@KieCodes Pattern search like Hooke Jeeves would be great. Also, new programmers face problem which approach to use: objective function or array as input values into optimisation problem. Would be great to hear some advices when to use which method.
Yey! now my mom can really know what i do for a living :)
"at some number of time, you won't just miss your flight, but the whole solar system will be gone" 🤣🤣🤣
I love this video...
Glad you liked it! 🙏
Great explanation dude, thanks so much.
You are more than welcome my friend. 🙏 Rock on! 🚀
Great video Sir 💗 this help me a lot to better understand the concept of GA. We will use GA for our thesis paper
Hey Jenna, thank you. Good luck with your thesis. 💪
@@KieCodes thank you Sir have a nice day and keep safe!
Hi, great video you helped me a lot🙏
One question tho, 4:47 how do I know how many “bags”/“childs” should be in the first generation?
Hey. Thank you. This is something you need to try out. If the genes are very large you will need a larger generation size, but too large is not good as well because it slows everything down.
3:10 This version of the Knapsack problem that is the 0-1 Knapsack problem is very well solvable in O(n) time where n is the number of items using Dynamic Programming. I am not sure what you meant there. But yes there are some problems which cannot be solved in polynomial time by any algorithm termed as the NP-hard problems. Some examples include the Travelling Salesman.
Yes a very specific version of the Knappsack problem is. It was just an easy to understand example for NP-hard problems, I choose. Maybe I chose unwisely. 😅
Greeting from Polish college.
Wish you the best :)
Thank you! To you too.
Wow this is incredibly helpful for my exam. Keep up the good work!
Greetings from Germany
Thank you for your kind words, Mc Bot. 🙏
Astonishing video! Thanks for sharing the incredible research papers. Looking forward to learn and explore more. Thanks
Thanks for you kind words! :)
Excellent explanation, such an interesting topic!
It is right? Thanks again! 🙏
GREAT EFFORT BRO!
Helped a lot. Thanks so much.