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."
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.
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.
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.
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.
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!!
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.
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.
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
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!
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?
@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!
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
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%.
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.
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?
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.
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.
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?
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???)????
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.
+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!
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
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%"