No video

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

  Рет қаралды 220,642

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 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!
@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 KZfaq 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...
@ishaan600
@ishaan600 3 жыл бұрын
This man deserves way more subscribers or needs to be the next elon musk or something
@sugg5719
@sugg5719 7 жыл бұрын
This guy is my spirit animal.
@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.
@ManUtdMontenegro
@ManUtdMontenegro 4 жыл бұрын
Amazing work, you made this algorithm sound so easy and understandable. Subbed. Keep up the good work! :)
@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.
@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?
@sheencabaneros9027
@sheencabaneros9027 7 жыл бұрын
You're so funny and at the same time informative. Kudos!
@gabrielaugusto6001
@gabrielaugusto6001 7 жыл бұрын
Damn, you're a great teacher
@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.
@user-rr2hu7yj3g
@user-rr2hu7yj3g 3 жыл бұрын
...this was the first video I watched while taking notes.
@xrayer4412
@xrayer4412 4 жыл бұрын
these series are so entertaining to watch
@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.
@vartikabisht9071
@vartikabisht9071 4 жыл бұрын
Such amazing content delivery makes me wanna cry. All the very best with your future endeavors sir.
@franciscomendoza9766
@franciscomendoza9766 7 жыл бұрын
maaan, thanks for making it sound as simple as possible! subscribed!
@ackdood
@ackdood 7 жыл бұрын
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
@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!
@YoeyYutch
@YoeyYutch 6 жыл бұрын
4:51 "Stuffed animals. Weird. Yeah. Ok. But anyways." LOL. Man you crack me up sometimes.
@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.
@kevinjameskramer404
@kevinjameskramer404 6 жыл бұрын
You are the mensch, my Friend. Thank you!
@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?
@drezcovers1113
@drezcovers1113 8 жыл бұрын
This looks pretty cool, I will definitely try to create my own natural selection functions, thanks for sharing daniel
@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
@nirajgaonkar7669
@nirajgaonkar7669 7 жыл бұрын
great work daniel a big thumbs up!!!!!!!
@hoanglinhle4468
@hoanglinhle4468 6 жыл бұрын
Why you only have 963 Like. You explained much easier than my teacher .....
@LOLMAN22
@LOLMAN22 7 жыл бұрын
i love this channel
@chetanapatil8808
@chetanapatil8808 4 жыл бұрын
Great Explanation!!!
@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%.
@AashishKumar1
@AashishKumar1 7 жыл бұрын
good series you have explained it well. Keep up the good work
@stormilha
@stormilha 5 жыл бұрын
A complain in a comment.... nah! Your videos are awesome!
@boredstudent2492
@boredstudent2492 6 жыл бұрын
Thank you very much for the knowledge (from Philippines)
@cap-advaith
@cap-advaith 2 жыл бұрын
thalaiva ...u r great......
@bobbobobjoejoe9685
@bobbobobjoejoe9685 6 жыл бұрын
"Less Faster" -Daniel Shiffman 2016
@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!
@littlempath
@littlempath 4 жыл бұрын
You are really good at explaining it :D
@smritisharma6410
@smritisharma6410 7 жыл бұрын
This person is amazing! Thanks for the video :)
@tellvivk
@tellvivk 7 жыл бұрын
thanks a lot for making this video and series
@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.
@joeyshias
@joeyshias 7 жыл бұрын
Thank you so much, so elaborate!
@Invisiblemonk
@Invisiblemonk 5 жыл бұрын
Love the energy thanks for the explanation:)
@anuragghosh1139
@anuragghosh1139 6 жыл бұрын
Awesome! Awesome! Been trying to apply neural evolution to brick breaker after watching your flappy bird series :-P
@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?
@hortsss
@hortsss 5 жыл бұрын
Loving it!
@mehreganzare7658
@mehreganzare7658 7 жыл бұрын
this is awsoooooooome ... please make more ...
@Favoritsvid
@Favoritsvid 5 жыл бұрын
Thank you for your effort.
@theom3050
@theom3050 8 жыл бұрын
Really nice and interesting video! Keep it up :)
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@krishnachaitanyacheerladin564
@krishnachaitanyacheerladin564 5 жыл бұрын
this is something else... this is epic
@avijitnandy6662
@avijitnandy6662 5 жыл бұрын
Thank you for keeping it add free
@Nabuuug
@Nabuuug 4 жыл бұрын
gays all around the world need to know the existence of this man because he will properly introduce them to code
@Blooper1980
@Blooper1980 8 жыл бұрын
Love your energy! :)
@nosuchthing8
@nosuchthing8 5 күн бұрын
What about entropy? Should the entropy change as the generations fly by?
@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 6 жыл бұрын
@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
@BaderAlharbi
@BaderAlharbi 7 жыл бұрын
wow, great man! thanks a million
@tocalucky7380
@tocalucky7380 7 жыл бұрын
Nice video. Keep it up
@mario1ua
@mario1ua 4 жыл бұрын
How cool is that!!
@indivarmishra6119
@indivarmishra6119 5 жыл бұрын
Thanks man🙏
@hefazlala
@hefazlala 5 жыл бұрын
pancake has a fitness of 2 BTW!
@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?
@Stinow
@Stinow 4 жыл бұрын
This video made my mind happy as a Rainbow Unicorn.
@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?
@nulliusinverba7732
@nulliusinverba7732 5 жыл бұрын
Does checking of how many characters match the target really work? In that case niurnco can also match unicorn, yeah?
@chadpace36912
@chadpace36912 7 жыл бұрын
I can see how some elements of human cognition would use a kind of genetic algorithm.
@trudyandgeorge
@trudyandgeorge 7 жыл бұрын
1.5x is watching ADHD at its best :P (You rock dude. Thanks for making this)
@piczel9631
@piczel9631 7 жыл бұрын
Great. Now where do we add the Perlin noise?
@Preotasherpa
@Preotasherpa 11 ай бұрын
How to define fitness function or fitness score if the ultimate goal 'unicorn' is not known to us?
@ziedbenmohamed1105
@ziedbenmohamed1105 6 жыл бұрын
MEGA! thanks man
@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???)????
@iiaamm
@iiaamm 3 жыл бұрын
"People do strange things with softwares"
@tarat.techhh
@tarat.techhh 4 жыл бұрын
U DA BEST
@gbcr09
@gbcr09 7 жыл бұрын
On boxcar2d, does the population consist of all of the created cars? And the DNA would be each car?
@thegrumpysock6391
@thegrumpysock6391 7 жыл бұрын
Hey dan, I was wondering, what is the use of this kind of neural network? We already know the sentence..
@hanspeter4807
@hanspeter4807 7 жыл бұрын
I don't have a clue at all of coding, algorithms and stuff like that, but I thought that maybe a sentence or a word isn't the best example, because to define the fitness in that example you have to know the solution, which makes the whole thing obsolete...
@mickelodiansurname9578
@mickelodiansurname9578 6 жыл бұрын
Well if it works on something you know the answer for all the time... it'll work on something you don't know the answer for all the time... yes?
@b4pnu709
@b4pnu709 4 жыл бұрын
Can i get tips on how to apply genetic algorithm for a class scheduling system?
@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!
@amanawdhani7808
@amanawdhani7808 4 жыл бұрын
You are so awesome 😎
@songhitamisra4167
@songhitamisra4167 6 жыл бұрын
The real sheldon cooper :)
@matto483
@matto483 7 жыл бұрын
This is fantastic stuff! As a biology student considering studying evolution who got into computer programming, I couldn't imagine something im more into. Thanks! Maybe pop a xanax before next recording? ;)
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Haha, I wish it were that easy.
@matto483
@matto483 7 жыл бұрын
maybe a trip to colorado? :)
@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
@Ruhgtfo
@Ruhgtfo 4 жыл бұрын
How much weed Shiffman has to take before recording? Shiffman: yes
@aminsoltani692
@aminsoltani692 5 жыл бұрын
4:24 its the second time you mentioned rainbow during these tutorial series. Not sure where this is going..
@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%"
@juanhernandez-up4pg
@juanhernandez-up4pg 3 жыл бұрын
Side tangent, Anyone noticed the hereditary sound effect at 3:35
@josephgaribaldi4340
@josephgaribaldi4340 5 жыл бұрын
This algorithm suggests that "evolution" has a telelogical process with some logos to an "end result" or purpose ... ;)
@michaelcanseco1528
@michaelcanseco1528 7 жыл бұрын
And what happens if you only have one object, i mean in the boxcar2D how do you crossover? by the way love your videos, big fan from Mexico!
@semiotik2
@semiotik2 7 жыл бұрын
Well you can simulate a bacteria-like reproduction (asexual) where only one individual duplicates itself in order to generate descendents, but there will be less genetic variety.
@poojahegde9854
@poojahegde9854 5 жыл бұрын
'p a n c a k e' has a fitness of 2 . 'n' and 'c' !!!! I did the same mistake too initially xD
9.3: Genetic Algorithm: Shakespeare Monkey Example - The Nature of Code
7:47
The Knapsack Problem & Genetic Algorithms - Computerphile
12:13
Computerphile
Рет қаралды 227 М.
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 39 МЛН
Pool Bed Prank By My Grandpa 😂 #funny
00:47
SKITS
Рет қаралды 19 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 14 МЛН
Алексей Щербаков разнес ВДВшников
00:47
Why white things are white
11:53
Steve Mould
Рет қаралды 972 М.
AI Learns Insane Monopoly Strategies
11:30
b2studios
Рет қаралды 10 МЛН
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 874 М.
NEAT Algorithm Visually Explained
18:07
David Schäfer
Рет қаралды 3,6 М.
Superpermutations: the maths problem solved by 4chan
20:31
Stand-up Maths
Рет қаралды 1,1 МЛН
Snake learns with NEUROEVOLUTION (implementing NEAT from scratch in C++)
28:08
Why this puzzle is impossible
19:37
3Blue1Brown
Рет қаралды 3,1 МЛН
Monte Carlo Simulation
10:06
MarbleScience
Рет қаралды 1,4 МЛН
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 39 МЛН