Тёмный

9.2: Genetic Algorithm: How it works - The Nature of Code 

The Coding Train
Подписаться 1,7 млн
Просмотров 221 тыс.
50% 1

Опубликовано:

 

9 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 216   
@TheHappieCat
@TheHappieCat 8 лет назад
I'm so excited for this to continue. It's the most clear and applicable explanation of this topic that I've seen so far!
@TheCodingTrain
@TheCodingTrain 8 лет назад
Thanks for the nice feedback! Love your channel! Maybe we can do a collaboration someday!
@TheHappieCat
@TheHappieCat 8 лет назад
So nice to hear, thank you! That'd be great!
@lucota90
@lucota90 7 лет назад
* __ *
@papinkelman7695
@papinkelman7695 7 лет назад
TheHappieCat hi HappieCat...
@hortsss
@hortsss 5 лет назад
same!
@anthonyalbertorio5180
@anthonyalbertorio5180 8 лет назад
Man, I love watching this guy teach. He makes things pretty easy to understand. Heck, even listening to this guy talk is entertaining.
@TheCodingTrain
@TheCodingTrain 8 лет назад
Thank you for the nice feedback!
@kevnar
@kevnar 7 лет назад
I once made a project with a certain population of entities in a closed space, and they all had a random value for "beauty", on a scale of one to ten. As they wandered around and bumped into each other, they would decide if they wanted to mate. But each entity only said "Yes!" if the potential partner was their own beauty level or better. The child they had was given a value for beauty based on one of the parents for heredity. Eventually, the entities grew old and died off. I also kept a running tally of the average beauty of the population over all. After running the simulation for a while, the average beauty slowly went up until everybody was absolutely gorgeous. 10 / 10. And there wasn't even a single 9 left anywhere. It made me wonder why this hasn't happened in real life human populations. And then it occurred to me, "Oh yeah. Alcohol."
@StarContract
@StarContract 6 лет назад
kevnar omg lol
@MrStaples441
@MrStaples441 6 лет назад
You never gave your algorithm a chance to move any other way but up. But LOL
@JohnJRodney
@JohnJRodney 6 лет назад
You could have put some desperation factor where the longer a individual has gone without mating the more likely it is to mate with someone of a lower beauty.
@MrCmon113
@MrCmon113 6 лет назад
The real world is completely different from that. There is no hard cap for beauty nor is it the only thing determining fitness nor do all entities agree on it precisely. Humans do get more and more beautiful, but at the same time, the standards change.
@FredoCorleone
@FredoCorleone 6 лет назад
Because there are beautiful women which like to get fucked by ugly but powerful men (financially or physically) and the other way around (even if less likely). The fittest is not necessarily the most beauty.
@YourMom-rg5jk
@YourMom-rg5jk 4 года назад
I am SO happy to find a video that isn't python. Thank you from the OOP community.
@BigStevo011
@BigStevo011 7 лет назад
Great to see someone teaching coding with such passion, love your work!
@ishaan600
@ishaan600 3 года назад
This man deserves way more subscribers or needs to be the next elon musk or something
@thibautevrard939
@thibautevrard939 7 лет назад
Amazing content, surely the clearest tutorial for genetic algorithms!
@wendersonj
@wendersonj 6 лет назад
Okay. On the first video I thought that this guy was crazy or something... But hey, if you sticked to the video, you saw that this guy has a very special way to communicate and teach. Talking about Genetic Algortihm, his way of teaching it's very easy to comprehend and it's well explained. Congrats. Don't stop making videos and teaching with that awesome energy and thanks for the lessons ! Hope to see more videos like this in youtube. Got here by Jabrils.
@TheCodingTrain
@TheCodingTrain 6 лет назад
Jabrils is the best!
@Cornellie
@Cornellie 6 лет назад
He deserves more subscribers to be honest. I learned so many things from his book and RU-vid channel.
@deeppanchal8324
@deeppanchal8324 6 лет назад
Finally, finally, finally, got the video to understand Genetic Algorithm in simple words✌️
@sergioffpc
@sergioffpc 5 лет назад
Hard problems explained in a simple way. You are a pure genius. Your energy is contagious. Keep going...
@hibak8196
@hibak8196 5 лет назад
"I love CS. This is just not a CS channel. It's something else. I don't know what it is." Lol I love him :3
@michaelyadchuk4989
@michaelyadchuk4989 7 лет назад
You are the 2nd best teacher ever. Your explanations are so clear and precise. I love learning from you, but not as much as from Hank and John Green.
@sugg5719
@sugg5719 7 лет назад
This guy is my spirit animal.
@harshith4192
@harshith4192 6 лет назад
Amazing!! I'm am a mechanical engineer looking to use GA for optimization of heat exchangers and these videos helped me understand the basics of GA. Moreover listening to your lecture is fun. His non stereotypical way of teaching is fun!!
@TheCodingTrain
@TheCodingTrain 6 лет назад
Thanks for the nice feedback!
@ShivamShukla-uz9xs
@ShivamShukla-uz9xs 4 года назад
Really this was so informative, and fluently and easily explained. The best part is getting examples and generating them on the go. This provides a really clear picture of the topic.
@ManUtdMontenegro
@ManUtdMontenegro 4 года назад
Amazing work, you made this algorithm sound so easy and understandable. Subbed. Keep up the good work! :)
@BaderAlharbi
@BaderAlharbi 7 лет назад
I'm in Bioinformatics, I just implemented an GA for metabolic data
@michealclarke22
@michealclarke22 3 года назад
i could not find a better explanation regarding this topic, THANK YOU
@CrimsonYetiCartoons
@CrimsonYetiCartoons 7 лет назад
Why can you not be my teacher for literally everything?
@kamoroso94
@kamoroso94 8 лет назад
I've never learned this topic before. It's so exciting! I wonder how machine learning relates to this if at all. They sound a little bit similar to me.
@TheCodingTrain
@TheCodingTrain 8 лет назад
It definitely relates! This is machine learning! Just an evolutionary style.
@vartikabisht9071
@vartikabisht9071 4 года назад
Such amazing content delivery makes me wanna cry. All the very best with your future endeavors sir.
@user-rr2hu7yj3g
@user-rr2hu7yj3g 3 года назад
...this was the first video I watched while taking notes.
@sheencabaneros9027
@sheencabaneros9027 7 лет назад
You're so funny and at the same time informative. Kudos!
@xrayer4412
@xrayer4412 4 года назад
these series are so entertaining to watch
@gabrielaugusto6001
@gabrielaugusto6001 7 лет назад
Damn, you're a great teacher
@franciscomendoza9766
@franciscomendoza9766 7 лет назад
maaan, thanks for making it sound as simple as possible! subscribed!
@hitlermugabetashtwin
@hitlermugabetashtwin 7 лет назад
Nice work mate. Trying to follow your approach, but implementing it in C, just to inject a bit of pain into my life.
@ackdood
@ackdood 8 лет назад
I just watched this show on HBO called West World. The guy introduces small mistakes into the code. First thing I thought of was the guy was using this genetic algorithm to help his robots learn. They didn't say for sure but it's gotta be this. I just thought it was neat to see Mr Shiffman is ahead of HBO! :P
@chumaxonics
@chumaxonics 4 года назад
Please do more of the theory part before coding, no hesitations. I play your theory videos and loop them, sleep. I always wake up as a genius.
@doubleV4
@doubleV4 7 лет назад
My complaint to you is that I haven't found you earlier! Purple rain was the first one for me, No I've been watching your playlist in sucking in information, actually so much that I had nightmares one night about you define ellipse!! I love that you are really impulsive and bubbly in your videos! great entertainment!
@TheCodingTrain
@TheCodingTrain 7 лет назад
Thanks so much for watching!
@emojimovie2788
@emojimovie2788 6 лет назад
Wonderful presentation, finally I can understand something about this.
@Anonimousxz
@Anonimousxz 5 лет назад
Hello, very cool video congratulations !!! One question I have is: If I do not know the result that my generations should have, will this algorithm not work? For example, am I required to tell what result the algorithm should arrive with the generations created? As in the example quoted the phrase "to be or not to be", I am specifying that the result I want is this, but what if I don't know that this is the result the algorithm should get?
@YoeyYutch
@YoeyYutch 6 лет назад
4:51 "Stuffed animals. Weird. Yeah. Ok. But anyways." LOL. Man you crack me up sometimes.
@hoanglinhle4468
@hoanglinhle4468 6 лет назад
Why you only have 963 Like. You explained much easier than my teacher .....
@boredstudent2492
@boredstudent2492 6 лет назад
Thank you very much for the knowledge (from Philippines)
@FredoCorleone
@FredoCorleone 6 лет назад
The first time you've runt the car example the algorithm has found a good 2D car with three wheels which was going on forever. Perfect!
@drezcovers1113
@drezcovers1113 8 лет назад
This looks pretty cool, I will definitely try to create my own natural selection functions, thanks for sharing daniel
@chetanapatil8808
@chetanapatil8808 4 года назад
Great Explanation!!!
@TheAcidPrank
@TheAcidPrank 7 лет назад
Thanks you, but only creationnists algorithm should be teach at schools, praise the lord, amen
@AnirudhGiri
@AnirudhGiri 7 лет назад
Computers are obviously flat. Wake up, sheeple!
@AnirudhGiri
@AnirudhGiri 7 лет назад
Thanks Captain Obvoius. I'dve never known that
@olfmombach260
@olfmombach260 7 лет назад
Yeah! Did you ever! hear of other types! of punctuation beside exclamation marks!
@mickelodiansurname9578
@mickelodiansurname9578 7 лет назад
@Andrew S he's full of crap and pushing the bible... and running about over all the GA videos posting the same rubbish. You didn't know what he said precisely becasue its utter rubbish!
@vitalnutrients744
@vitalnutrients744 6 лет назад
This genetic algorithm actually coincides with theism. You see, there are mutations, which could be good for your survival or bad. So it plays along with the idea that evil and good exist
@olfmombach260
@olfmombach260 7 лет назад
After watching this I decided to try to code the algorithm without "spoilers" from Dan's actual code video. I made it in Python using pygame for the interface and surprisingly the program ran succuessfully (!) with no single error at the first try. I decided to implement various crossover methods and what I observed is that using the following "half-half" crossover: def crossover_half(parentA, parentB): res = parentA[:math.ceil(len(parentA)/2)] + parentB[math.ceil(len(parentA)/2):] return res I got the result for "to be or not to be" in about 7 to 12 seconds. However, using the following "random" crossover: def crossover_random(parentA, parentB): res = "" for i in range(len(parentA)): res += (parentA[i], parentB[i])[random.randrange(0, 2)] return res I achieved results always in less than 2 seconds. Also a very unexpected result was that using a "checker" kind of crossover: def crossover_checker(parentA, parentB): res = "" for i in range(len(parentA)): if not i%2: res += parentA[i] else: res += parentB[i] return res I *never achieved a result*. The population was almost uniform with bad solutions. The mutations had no major effect. All measures were made using a population size of 400 and a mutation rate of 1%.
@kevinjameskramer404
@kevinjameskramer404 6 лет назад
You are the mensch, my Friend. Thank you!
@cap-advaith
@cap-advaith 2 года назад
thalaiva ...u r great......
@bencesarosi7718
@bencesarosi7718 7 лет назад
Not as if it made any difference, but at around 12:04 the fitness for "pancake" is actually either 0 or 2 depending on whether you take character position into account or not. If you do, then "n" is in the wrong position, if you don't, then "c" is a match too. Great material, though.
@alexsere3061
@alexsere3061 7 лет назад
Bence Sárosi you do take position into account
@stormilha
@stormilha 6 лет назад
A complain in a comment.... nah! Your videos are awesome!
@nosuchthing8
@nosuchthing8 24 дня назад
What about entropy? Should the entropy change as the generations fly by?
@nirajgaonkar7669
@nirajgaonkar7669 7 лет назад
great work daniel a big thumbs up!!!!!!!
@AashishKumar1
@AashishKumar1 7 лет назад
good series you have explained it well. Keep up the good work
@tellvivk
@tellvivk 7 лет назад
thanks a lot for making this video and series
@LOLMAN22
@LOLMAN22 7 лет назад
i love this channel
@smritisharma6410
@smritisharma6410 7 лет назад
This person is amazing! Thanks for the video :)
@littlempath
@littlempath 4 года назад
You are really good at explaining it :D
@avijitnandy6662
@avijitnandy6662 5 лет назад
Thank you for keeping it add free
@joeyshias
@joeyshias 7 лет назад
Thank you so much, so elaborate!
@psinha6502
@psinha6502 5 лет назад
I am confused!! Is fitness value just the number common characters present in both string....or the numbers of characters present on same corresponding locations in both strings? Which one is it?
@Favoritsvid
@Favoritsvid 5 лет назад
Thank you for your effort.
@1morelight
@1morelight 6 лет назад
Thinking in terms of the analogy with Biology, is it correct to think that the phrase "to be or not to be that is the question" is the fittest "specimen" for this imaginary "environment" of phrases?. Besides, i see that in this example correlation is the nature of fitness in this imaginary world, meaning that the more similar any phrase is with "to be or not to be that..." the better it adapts to this environment and therefore the likely is for it to survive and pass its genes. This is very interesting because correlation is very present in our current technology, specially telecommunications, which make evolutionary algorithms a interesting tool to apply to this fields.
@b4pnu709
@b4pnu709 4 года назад
Can i get tips on how to apply genetic algorithm for a class scheduling system?
@thomasdelapena9490
@thomasdelapena9490 7 лет назад
For the breeding process, could you just make the incorrect letters be the one that mutate instead of the correct letters mutate?
@Invisiblemonk
@Invisiblemonk 5 лет назад
Love the energy thanks for the explanation:)
@mehreganzare7658
@mehreganzare7658 7 лет назад
this is awsoooooooome ... please make more ...
@arturoordonez-hernandez1534
@arturoordonez-hernandez1534 6 лет назад
I'm trying to implement this in Unity with C# but it scrolls on the whole time I run it.
@arturoordonez-hernandez1534
@arturoordonez-hernandez1534 6 лет назад
Ok. I think I fixed it. The bug came from how I was using Unity's Random.Range function in DNA.Mutate. I had to use the float argument overload (I was passing in ints). I also had to tweak the if-statement a bit since Random.Range(float min, float max) can generate max: float mutate = Random.Range(0.0f, 1.0f); if (mutate != 1.0f) { if (mutate < i_mutationrate) { _genes[i] = Utility.RandomChar(); } } I think it's working pretty well. Thanks for your entertaining presentations. I think the fact that you make viewers laugh throughout your videos makes them a lot more valuable.
@michaelkihl6585
@michaelkihl6585 6 лет назад
Is it possible to get this code for matlab
@krishnachaitanyacheerladin564
@krishnachaitanyacheerladin564 5 лет назад
this is something else... this is epic
@indivarmishra6119
@indivarmishra6119 5 лет назад
Thanks man🙏
@anuragghosh1139
@anuragghosh1139 6 лет назад
Awesome! Awesome! Been trying to apply neural evolution to brick breaker after watching your flappy bird series :-P
@gbcr09
@gbcr09 7 лет назад
On boxcar2d, does the population consist of all of the created cars? And the DNA would be each car?
@hortsss
@hortsss 5 лет назад
Loving it!
@franciscohanna2956
@franciscohanna2956 7 лет назад
Hi Daniel! Great series of videos. They are helping me a lot. However, I think there's kind of a mistake at the crossover explanation. In the 'single-point' crossover that you explain, I thought that it produced two childs as a result, in order to have, in the next generation, N individuals again. Am I correct?
@kunalkotiyal9566
@kunalkotiyal9566 7 лет назад
Video software?
@thegrumpysock6391
@thegrumpysock6391 7 лет назад
Hey dan, I was wondering, what is the use of this kind of neural network? We already know the sentence..
@bobbobobjoejoe9685
@bobbobobjoejoe9685 7 лет назад
"Less Faster" -Daniel Shiffman 2016
@Nabuuug
@Nabuuug 4 года назад
gays all around the world need to know the existence of this man because he will properly introduce them to code
@mario1ua
@mario1ua 4 года назад
How cool is that!!
@azizsaouli93
@azizsaouli93 7 лет назад
good job bro, but we could only choose 2 parent every time? and how we can crossover our element whene we have 5 element(we croosover element one with element 2 and element 3 with 4 and element 5 with who???)????
@Preotasherpa
@Preotasherpa Год назад
How to define fitness function or fitness score if the ultimate goal 'unicorn' is not known to us?
@Max-bh8tg
@Max-bh8tg 7 лет назад
19:24 isn't it better to store where the characters match and choose two phrases that have a high fitness score but at the same time does not have matching characters in the same position? I'm a beginner so i really don't know but that seems more logical.
@TheCodingTrain
@TheCodingTrain 7 лет назад
+Maximilian Lloyd this is correct but I'm not necessarily trying to solve this problem in the most efficient way. Rather just demonstrating a GA that would work for various problems. But for this particular search there are many ways to improve it!
@Max-bh8tg
@Max-bh8tg 7 лет назад
Daniel Shiffman Ah ok, thanks!
@BaderAlharbi
@BaderAlharbi 7 лет назад
wow, great man! thanks a million
@nulliusinverba7732
@nulliusinverba7732 5 лет назад
Does checking of how many characters match the target really work? In that case niurnco can also match unicorn, yeah?
@tentoptucker8724
@tentoptucker8724 3 года назад
can genetic algorithm good for encryption
@hafeez9084
@hafeez9084 7 лет назад
can we get this done in matlab? if anyone knows kindly help me
@theom3050
@theom3050 8 лет назад
Really nice and interesting video! Keep it up :)
@TheCodingTrain
@TheCodingTrain 8 лет назад
Thanks for watching!
@Blooper1980
@Blooper1980 8 лет назад
Love your energy! :)
@SnakeKnightomg
@SnakeKnightomg 5 лет назад
Could someone explain to me how do we get N children? Do we pick only 2 parents and generate N children with crossovers, in which case how do we generate random crossovers. Or do we redo parent picking and apply the same crossover + mutation to get a new child with the risk of always picking the same parents. I feel I miss something here
@piczel9631
@piczel9631 7 лет назад
Great. Now where do we add the Perlin noise?
@hefazlala
@hefazlala 5 лет назад
pancake has a fitness of 2 BTW!
@EhsanulHaque069
@EhsanulHaque069 7 лет назад
Can I make a timetable generator with genetic algorithm?
@kholoudahmed7890
@kholoudahmed7890 7 лет назад
Can I download ppt
@chadpace36912
@chadpace36912 7 лет назад
I can see how some elements of human cognition would use a kind of genetic algorithm.
@venkateshs6862
@venkateshs6862 7 лет назад
Can we apply this on image
@guptaravi4324
@guptaravi4324 6 лет назад
dont u have notes?
@kennyPAGC
@kennyPAGC 6 лет назад
Could a genetic algorithm be a good solution to sports scheduling problem?
@TheCodingTrain
@TheCodingTrain 6 лет назад
Worth trying I think, yes!
@RedCurlyHead
@RedCurlyHead 5 лет назад
Can I buy the Nature of Code book on paper ?
@TheCodingTrain
@TheCodingTrain 5 лет назад
Indeed! amzn.to/2VPAA9q
@amanawdhani7808
@amanawdhani7808 4 года назад
You are so awesome 😎
@tarat.techhh
@tarat.techhh 4 года назад
U DA BEST
@molesox
@molesox 6 лет назад
these algorithm can be used to solve a sudoku?
@tocalucky7380
@tocalucky7380 7 лет назад
Nice video. Keep it up
@ziedbenmohamed1105
@ziedbenmohamed1105 6 лет назад
MEGA! thanks man
@Fledron
@Fledron 7 лет назад
Could you just let the algorithm change its mutation rate itself depending on how fast the fitness raises? Like "Fitness is raising slower and slower, let's just set my mutation rate to 5% instead of 1%"
Далее
Coding Challenge 180: Falling Sand
23:00
Просмотров 904 тыс.
The Most Elite Chefs Ever!
00:35
Просмотров 6 млн
гендер пати🩷🩵
00:21
Просмотров 100 тыс.
Coding Challenge #35.1: Traveling Salesperson
22:55
Просмотров 288 тыс.
13. Learning: Genetic Algorithms
47:16
Просмотров 521 тыс.
NEAT Algorithm Visually Explained
18:07
Просмотров 4,4 тыс.
Coding Challenge #29: Smart Rockets in p5.js
48:17
Просмотров 404 тыс.
Monte Carlo Simulation
10:06
Просмотров 1,4 млн
Machine Learning Control: Genetic Algorithms
13:59
Просмотров 49 тыс.
What are Genetic Algorithms?
12:13
Просмотров 43 тыс.