9.4: Genetic Algorithm: Looking at Code - The Nature of Code

  Рет қаралды 202,876

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 191
@rajcuthrapali800
@rajcuthrapali800 7 жыл бұрын
Your the first person I found that teaches AI and shows the CODING aspect of what it is. For that, I promise you I am subscribed to you and turned on notifications. Keep up the good work!!
@RafaelBragaCarol
@RafaelBragaCarol 7 жыл бұрын
Daniel, I got to say, you're an AWESOME TEACHER! I have watched 3 lists about AI before your list, and never fully got the concept. You make it much easier to understand, plus it helps a lot with the example/exercise. Thanks for doing these videos. I saw in the videos that you wrote a book, I will make sure I will buy it to support these videos.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
thank you!
@markvador6667
@markvador6667 5 жыл бұрын
Daniel, you are merely one of the best teacher i've ever listened in my life ... and i'm 50 years old today (i've started to code at 12 on TI99/4A) ! You make arduous and tough things so easy to understand and amazing : this is pure genious, thank you very much ! Keep on !!!!
@taeshawitsuwanwigo8628
@taeshawitsuwanwigo8628 7 жыл бұрын
Man, you are the best. Really! All the afford you put in. The best tutorial on GA ever. Thank you!!
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Thank you so much!
@harshpatel309
@harshpatel309 6 жыл бұрын
After watching many videos on this topic...finally the place where I have understood is this channel. Great series. Thank you so much
@sohailape
@sohailape 6 жыл бұрын
i was taking stanford course but there was no coding and i was forgetting everything. Your tutorials are great . I am able to understand and you are even showing basic implementation.
@alexapostolo3329
@alexapostolo3329 7 жыл бұрын
Hey , I wanted to say that you have done a great job explaining the functionality of a genetic algorithm. I also tried making my own genetic algorithm, the only problem that i have encountered has been on small paragraphs that take many generations for the program to evolve the right phrases.
@heinrichkreuser2659
@heinrichkreuser2659 6 жыл бұрын
This is a really cool video series! Been watching it up until now and gonna watch until the end. You're very ecstatic and I like that. Keep up the good work🤟
@danieljerabek4333
@danieljerabek4333 7 жыл бұрын
I like the hype, also funny thing is that the ad before video was even more hyped up than the video, thumbs up and keep the hype!
@thisaintmyrealname1
@thisaintmyrealname1 7 жыл бұрын
Great series man! , I became a big fan of the way you teach stuff ever since I started reading your N.O.C. book. Keep up the good work! Greetings from Ecuador.
@Matt-gr4bu
@Matt-gr4bu 5 жыл бұрын
Bit of a slow way of doing weighted random here's what i normally use 1: Calculate the total fitness 2: Generate a random number between 0 and the total fitness 3: Loop through the population subtracting each DNA's fitness from the random number until it's less than 0, the selected DNA is the DNA that makes the fitness go below 0
@xopabyteh
@xopabyteh 2 жыл бұрын
I looked at the concepts you explained in the video and tried to code it for myself in C#. It was buckets of fun :)
@infinitif9829
@infinitif9829 7 жыл бұрын
funny that my algorithm needs 62322 generations in the same setup... But greate video, I came into genetic code just because of you :D
@BrandNewByxor
@BrandNewByxor 5 жыл бұрын
Don't you just love random numbers?
@willietheron2717
@willietheron2717 3 жыл бұрын
A small note: I think it will be better to use the fitness score as a range so you can set 0-3 as A, 4-5 as B, 6 as C and 7 - 9 as D. Then you can use Math.random to find the "key" This works particularly well if you have some irregular values like 2000 for fitness... Then your range gets bigger without you needing to build a mating array which could rip performance. (seeing that your arrays were 16000 elements large) Was just thinking what a more optimum solution would potentially look like. Considering each element can essentially just be a "case" tied to a random value. Have not written this yet, but for my scenario it should work
@Applevi
@Applevi 2 жыл бұрын
The random fitness relative selection can be done by: getting a random number from 0 to the sum of all fitness results, then go over the list of the population adding up the fitness values and selecting the one where the random number is smaller than the current sum
@Applevi
@Applevi 2 жыл бұрын
populationFitness = { 0.3, 0.6, 0.2, 0.7 } totalFitness = populationFitness[0] + pf[1] + pf[2] + pf[3] random = randomNumber(0, totalFitness) currentSum = 0 foreach populationFitness pf currentSum + pf if random < currentSum return pf
@DamianReloaded
@DamianReloaded 8 жыл бұрын
The mating pool part is kinda overkill, and you didn't distribute its elements uniformly randomly. You could just had generated a random number (rand) between 0 and 100 and do: if 0 > rand rand rand rand
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks! Yes this is a good point. I address some other solutions to this in a future video coming out soon!
@JaySiggz
@JaySiggz 7 жыл бұрын
Yes. I was just going to say this.
@dazzaondmic
@dazzaondmic 7 жыл бұрын
What happens when its not just A B C and D but 1000 possibilities?
@pdcx
@pdcx 7 жыл бұрын
^ generalizing this algorithm: accFitness(i) = the accumulated fitness from the first to the i-th DNA randAccuFit = random(0, accFitness(lastDNA)) loop from first to the last DNA, until accFitness(i) >= randAccuFit, the index i corresponds to the random DNA we want to pick from the pool instead of looping linearly, one can loop using constant leaps (i+= constant) or increase the index by a multiple (*2) until accFitness(i) > randAccuFit, then decrement i until accFitness(i)
@matthiasfuchs139
@matthiasfuchs139 6 жыл бұрын
dazzaondmic Have a second array partial with population size N. Then do partial sums of the fitness. At index 0 you have the fitness of population at 0. Then partial[n+1] = fitness(n+1) + partial[n]. Then generate a random number R in the range [0, partial[N-1]]. Do a binary search for the upper boundary (first element greater than your random number) for R. This should give you an index J in the range [1, N]. At J-1 you have the population member of interest.
@Arygua
@Arygua 5 жыл бұрын
Really good videos, just walked through the code afterwards and ported it to straight Java and have a decent grasp of method. Little more difficult without alot of the libraries and methods JS has but still works. Also the code posted on GitHub is a little different than it is shown here but still able to put those parts together with the help of the video.
@Arygua
@Arygua 5 жыл бұрын
Appreciate the heart, started watching your videos over Machine Learning to see if I want to change my Masters.
@spacemonkeydoom6116
@spacemonkeydoom6116 6 жыл бұрын
I love your incredible coding sessions with fantastic things would you ever do the same like that in other coding languages? like c++, c#, python or java or something like that? I love codes and coding
@suwedo8677
@suwedo8677 5 жыл бұрын
It's not really about the language, it's more about the logical aspect of it, you can apply that to any language in fact ^^
@puyanwei
@puyanwei 7 жыл бұрын
If you don't start from scratch I think it would be good if you could also include the code from the starting point of the video instead of the finished one in your github so we can follow along. Thanks Dan, great stuff! Keep it up! :)
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Great point, thanks for the feedback
@MrThonny15
@MrThonny15 8 жыл бұрын
Hey Daniel. Now when you are doing a segment on genetic algorithms I would really appreciate you making a video on the basics of neural networks in p5. It is just something I would love to try to implement in generativ art but it is difficult to find good material on the subject.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
I'm planning on it! github.com/CodingRainbow/Rainbow-Topics/issues/20
@damnit258
@damnit258 6 жыл бұрын
realy simplified , thank you Mr. Daniel
@thekkb007
@thekkb007 4 жыл бұрын
This Guy is so lovable. I wish i had a friend like him :)
@rajinish0
@rajinish0 4 жыл бұрын
This was really helpful, thanks. Coding this was fun
@konstantindimitrov2019
@konstantindimitrov2019 7 жыл бұрын
Is there any other way of picking a character (object) with a probability? Your approach is really interesting (really applause for that :) ) I've never thought of doing it but can we do it say like a 2D array - 1 row for objects, row 2 for P(x)-s? Or give the random() some sort of bias? I really like your mating pool thing as it's just like real world way of how probabilities work the only drawback I recognize tho is the memory 'overkill' and that if it's 15,2% of chance you can't have it unless u go up to 1000 initialized examples and so on - again the memory draining thing.
@BlueNSour
@BlueNSour 8 жыл бұрын
where you have things like "this.genes.length" as a condition in your for loop, it'll compute the length everytime. If you just chuck it in a variable beforehand and use the variable instead it doesnt have to calc everyloop. Not really that important but its a fun little thing to think about
@Fledron
@Fledron 7 жыл бұрын
It would be important, if it was for example a really big array. It's code optimization, to get the code running as fast and smooth as possible
@simontewolde3616
@simontewolde3616 7 жыл бұрын
Wow, wish I didn't skip this chapter in the book. Imagine using this to find a cure for cancer or something
@neithanm
@neithanm 7 жыл бұрын
Can I suggest a chroma key filter to get rid of the green reflections on your figure?
@DasAntiNaziBroetchen
@DasAntiNaziBroetchen 4 жыл бұрын
No
@rambodehydrated
@rambodehydrated 7 жыл бұрын
thank you! Very good examples and explanation you made it look so easy
@rolexianibuyat2818
@rolexianibuyat2818 5 жыл бұрын
hi sir, i have a question about your code in the population class... what does this line of code do??is this mapping the value of (this.population[i].fitness) from 0 -> maxFitness to 0 -> 1?? "let fitness = map(this.population[i].fitness, 0, maxFitness, 0, 1); " hoping for your reply
@thalissonalves7950
@thalissonalves7950 4 жыл бұрын
Where can I find the code ? I just don't know how to use github, if anyone could post the link for it here I would appreciate it very much!
@_r3mote
@_r3mote 6 жыл бұрын
Is there a way to download the pdf-file? Thanks for your brilliant work!
@NeverInterpreter
@NeverInterpreter 7 жыл бұрын
Yay, finally something I can code myself :D
@FredoCorleone
@FredoCorleone 6 жыл бұрын
At the beginning of this series you've showed the algorithm to make custom random distribution. Why you've not used that in this example? Something like the following would be easier on memory consumption: let r a random float between 0 and 1 if r < .4 then A if r < .3 then D if r < .2 then B if r < .1 then C Also I don't get why you calculate the probability that way... Wouldn't be better if you weight the probability against the sum of all fitnesses? myProbability = myFitness / sumOfAllFitnesses
@RedCurlyHead
@RedCurlyHead 5 жыл бұрын
ArrayList holds data in an array, which resizes each time you add an element, correct? So isn't that slow in that particular case.
@vaibhav1180
@vaibhav1180 6 жыл бұрын
Will it be a good idea to use HashMap in Java to store the "String" as value and "Fitness score" as key? But if the string is duplicate by chance then the population will be reduced to 199
@saikatchakraborty6291
@saikatchakraborty6291 4 жыл бұрын
can you please provide the code that you are showing in the video .We are facing a lot of problems . and the nature of code git link does not have this code
@kebman
@kebman 7 жыл бұрын
I'm still Norwegian since last time. No mutations. I'm trying to evove in to Swedish, though, but it's damn hard.
@samhblackmore
@samhblackmore 7 жыл бұрын
Hey Daniel, loving this series so far. Just wondering, you do a lot of looping over arrays, is there a reason you don't use the built in array functions like forEach, map, filter, every, etc. I believe these were introduced in ES5 so perhaps they weren't available at the time in vanilla javascript or perhaps you just wanted to keep your code simple? Thanks!
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
More just to keep things simple, but I think I'll consider incorporating them in the future!
@A_Lesser_Man
@A_Lesser_Man 4 жыл бұрын
loving your GA series! I'm doin AI :D albeit rudimentary (starting with your Boids, i'm gonna make'm bigger, better, bolder, badder), but alas, one step at a time. the hard part will be melding all these pieces together to make my boids do what i want. also, wouldn't "if (random(1) < mutationRate)" be more correct as "if (random(1)
@caueZero
@caueZero 7 жыл бұрын
Very nice videos. Thanks.
@irsyadkamil6631
@irsyadkamil6631 4 жыл бұрын
This is a cool video. Thank youu. But i was wondering, can we apply GA on matrix form data ?
@pankajsharma_ua
@pankajsharma_ua 4 жыл бұрын
I DNT know anything about ai but knows programming and logic. from where should I start ur lectures to start from scratch
@yard2010
@yard2010 5 жыл бұрын
you work is amazing! keep it up
@narval7495
@narval7495 2 жыл бұрын
Such a good video
@nilsherrmann2018
@nilsherrmann2018 7 жыл бұрын
Hey. I was just wondering if the mating pool generation will eventually become a problem if the fitness of your individual genes is very far apart from each other? Say for example, the fitness of A would be so much higher then the fitness of the rest of your elements that A should be picked with a probability of 90%. Then the resulting reproductions would in almost all cases lead to A crossing A, which of course would not change a thing (except in the event of a mutation). Would it be better in a general case to allow mating only once per element per generation? BTW: Very nice video series! I enjoyed it very much so far!
@nilsherrmann2018
@nilsherrmann2018 7 жыл бұрын
PS: Instead of filling the mating pool array with actual DNA objects, why don't you just use an array of unsigned integers resembling the indices of the individual objects in the population array? This would surely reduce your memory requirements by preventing unnecessary double storing of the DNA objects.
@123userthatsme
@123userthatsme 7 жыл бұрын
Could you eliminate that issue with an inbreeding selection function? Elements with the same parents or grand parents would automatically be reassigned in the mating pool.
@edoars
@edoars 7 жыл бұрын
If I put population.calcFitness() before everything else, the algorithm does not end. Am I doing something wrong?
@immanuelkant7895
@immanuelkant7895 5 жыл бұрын
16:44 Isn’t it quite common to have the same parent twice, namely the fittest individual?
@ayaayari5666
@ayaayari5666 5 жыл бұрын
You saved my semester thank you!!!!
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
glad to hear!
@MrDonald911
@MrDonald911 7 жыл бұрын
Why not doing all the process on the set of characters ( DNA ) ? I don't see the point of using 1 element of a population each time creating a set of characters ( its DNA ). I'm transforming your code in C# right now , thank you for answering me :)
@finnoulataylor3234
@finnoulataylor3234 7 жыл бұрын
Great video! what texteditor do you use?
@igz
@igz 8 жыл бұрын
This is really interesting!
@usamatahseenulhaque9125
@usamatahseenulhaque9125 4 жыл бұрын
Thank you very much
@alexanderyau6347
@alexanderyau6347 6 жыл бұрын
Do you make the evolution strategies video?
@Marc_B.4
@Marc_B.4 6 жыл бұрын
Hello everyone ! I didn’t quite understand what the map function returns at 13:51 . Can someone enlighten me with an example ? Thank you :) (Sorry if bad English, it's not my native language)
@oluwatosinohiro2220
@oluwatosinohiro2220 4 жыл бұрын
Thank you so much for this
@SaintPepsiSanCoca
@SaintPepsiSanCoca 8 жыл бұрын
I feel stupid for saying but I can't seem to find your source code on this lesson :) I've made 2 GA's as well (not very good ones) but when your video's on GA's popped up I wanted to give it another shot
@ErebuBat
@ErebuBat 8 жыл бұрын
I had the same problem, some google-foo lead me to: github.com/shiffman/The-Nature-of-Code-Examples-p5.js/tree/master/chp09_ga
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Sorry I need to do a better job of keeping my code and links organized. github.com/shiffman/The-Nature-of-Code-Examples-p5.js/ is the right repo for this video.
@othmandont9355
@othmandont9355 5 жыл бұрын
great video man thanks for your effort
@sebastiankoziel8055
@sebastiankoziel8055 5 жыл бұрын
great stuff! Thank you
@thejswaroop5230
@thejswaroop5230 4 жыл бұрын
do these genetic algorithms have a fixed order of time complexity??..... sry for late comment
@ujjayinibose9993
@ujjayinibose9993 7 жыл бұрын
Hey , can you please write a code on web service composition using genetic algorithm! It would help a lot! Thanks!
@SuperBlackBeto
@SuperBlackBeto 5 жыл бұрын
Do u guys have a code for artificial bee colony in java? Or some libraries that implement that code? :) i need it for a research
@lamo440
@lamo440 6 жыл бұрын
What are the optimizing techniques for image processing
@NakMs
@NakMs 7 жыл бұрын
This is really helpful video thank you :)
@connercampbell456
@connercampbell456 7 жыл бұрын
When i open index in chrome... It shows "Best phrase: Stats & All phrases:" Thats it.. any help??
@KAYKAYMUS
@KAYKAYMUS 4 жыл бұрын
why do we need a bigger mating pool ? cant we map the members in population to a weightage (calculated as its fitness/total fitness of the population). The weightage will always be a number from 0 to 1 and the sum of all weightages will be 1. So a rando m number generated (0..1) can be mapped to each element in population. Say weightages for 3 elements A,B, C are 0.4, 0.5, 0.1. Random number generated from 0..0.4 will select A, 0.41..0.9 will select B , else C will be selected.
@AlissonNunes
@AlissonNunes 7 жыл бұрын
How I know when stop if my problem don't have a target?
@urgisjot
@urgisjot 8 жыл бұрын
woohoo new one!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@hafeez9084
@hafeez9084 7 жыл бұрын
hey sorry if i sound like a fool, but can i get the matlab code of the sample program?
@tristankold9019
@tristankold9019 5 жыл бұрын
I though a fitness score of zero meant zero problems, but he increments it when chars match the target. Is there a best practice?
@rinkagamine9201
@rinkagamine9201 5 жыл бұрын
It's a definition thing. Typically when speaking of a fitness function, the higher the score the better it is. What you were referencing is mostly called a cost function (sometimes also calles loss function). When you think about it, it kinda makes sense, because if something costs zero its all good and if something has a very high fitness its also good, right :D? But it really doesn't matter. In this case for example you could define the function like, lets say whe have a phrase with N letters, then our cost function would be "the sum of the letters which don't match with the corresponding letter in the target sentence". This means if none of the letters match then our cost would be N. On the other hand if all the letters match then we get a cost of zero. Hope this helps :)
@84zhebiitha48
@84zhebiitha48 7 жыл бұрын
In what software do you make your presentations?
@seongmopark9164
@seongmopark9164 6 жыл бұрын
I'm not a professonor in this part though, but.. I have a question.I'm just wondoring why the parents are only two?Is there any jammed problem when I picking more than 2 parents?for example, when I will find this 'paper' word, then I try to combine 5 letter to 5 parent?
@tusuubiraedward9600
@tusuubiraedward9600 3 жыл бұрын
Hello Good work but can you give me help with GA in R?
@mibdev
@mibdev 7 жыл бұрын
*Yes!* The *this dot* song!
@ccuuttww
@ccuuttww 6 жыл бұрын
I think u should generate n(population) child first and check the kid's max score because I find sometimes the kid 's max score is smaller than the last genration if this happens u should stop the caculation it always come form larget phrase like 100 words with low population
@kcseforecast7580
@kcseforecast7580 2 жыл бұрын
do a timetable with genetic algorithm
@piotrptak5507
@piotrptak5507 6 жыл бұрын
I can't thank you enough.
@h4tt3n
@h4tt3n Жыл бұрын
Could someone please provide a direct link to the specific github repo Daniel is showing (not just the coding train main github page)? I have spent some time looking and searching, and it doesn't seem to be there.
@TheCodingTrain
@TheCodingTrain Жыл бұрын
Is this what you are looking for? editor.p5js.org/codingtrain/sketches/PqRSmKLQU more here: thecodingtrain.com/tracks/the-nature-of-code-2/noc/9-genetic-algorithms/4-looking-at-code and here: nature-of-code-2nd-edition.netlify.app/genetic-algorithms/
@h4tt3n
@h4tt3n Жыл бұрын
@@TheCodingTrain Thanks a ton!
@abhikmitra2650
@abhikmitra2650 4 жыл бұрын
Can anyone explain what the map() function is doing here?
@prikundnani2622
@prikundnani2622 7 жыл бұрын
The presentor is growing on me
@nagesh007
@nagesh007 2 жыл бұрын
Awesome
@TM-ui6wx
@TM-ui6wx 8 жыл бұрын
how is using a genetic algorithm more efficient in this case than a different type of algorithm?
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
It's not necessarily for this particular problem, but it's a good one to demonstrate the idea I think!
@ForCeGR
@ForCeGR 7 жыл бұрын
Saying "4 out of 10 times will be an A" it's not true. The probability is that in 1 pick, I have 40% chance of picking "A". Many people confuse this.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Oh, this is a very good point, thank you for the correction!
@tellvivk
@tellvivk 8 жыл бұрын
thanks a lot man, you are the best :D
@harshpatel309
@harshpatel309 6 жыл бұрын
I have 1 Question... What if crossing over of parents generates an output which has 0 fitness score
@harshpatel309
@harshpatel309 6 жыл бұрын
I actually tried to implement this algorithm in python and after a few generations the mating pool was empty: i.e after crossing over ,all parents had fitness score of 0 so all had the probability of becoming parents 0.i.e they occupied no space in the mating pool list: Please provide answer
@theSwomry
@theSwomry 4 жыл бұрын
So how would I do this in processing?
@ibrahimlaachichi7818
@ibrahimlaachichi7818 7 жыл бұрын
salut j 'ai besoin d'un qui modéliser le minimum de la fonction x*x avec les algorithme genetique merci
@stinkytoby
@stinkytoby 7 жыл бұрын
Can someone explain the processing logo to me? Is it a p3? 13? pb?
@amdreallyfast
@amdreallyfast 6 жыл бұрын
Where is the code for this? It isn't in your github repo. Your coding challenge for smart rocket is in there, but not this lesson. I followed as best I could, but my version using the same parameters (pop 200, mutation rate 1%) is running for 10,000+ iterations and coming up wrong. Having working code to compare with would be helpful.
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Try these repos: github.com/shiffman/The-Nature-of-Code-Examples/tree/master/chp09_ga github.com/shiffman/The-Nature-of-Code-Examples-p5.js/tree/master/chp09_ga I need to do a better job of organizing all this stuff.
@amdreallyfast
@amdreallyfast 6 жыл бұрын
Thanks! I managed to eventually get it working on my own, and I found in doing so that doing a crude "gene split" with the left 50% from parent A and the right 50% from parent B significantly increased the time to completion. Setting the split midpoint to a random value yielded a much faster convergence to the target phrase. I thought about it, but my only conclusion was this extra bit of randomness was somehow a more important piece of randomization than the mutation. Don't know why, but TIL.
@cashel1111
@cashel1111 6 жыл бұрын
having a fixed point to cut in two means that there is a 1/10 chance at finding the optimal slice position. there is also a 1/10 chance of finding it when you choose a random point to slice, however the 'optimal slice point' is never ever going to be in the same spot continuously (as im pretty sure its random too) the simplest way to test this i think would be to have a random number between 1 and 100. After 1000 trials, see how many times it counts an individual number, and then compare that count to the same function, but this time instead of comparing it to one number, compare it to a second random number between 1 and 100 since were on a programming channel i made a small procedural console app (im no pro :P ) in c# i see im going to have to rework the whole thing if i want an accurate answer, however the results are looking like: using a fixed number to compare the random number to yields more consistent numbers and using two random numbers is for more extreme, with the maximum numbers being way higher, and some of the lows being way lower since this algorithm (in the video) is going to preferentially select high fitness scores, this is almost guaranteed why your own version worked so much faster using the double random number thing :) i also think an even better way to split the genes is not in half at all, if you chose a random char from each parent every time i think it would introduce a whole new level of chaos into the generation and allow the ones with ridiculously high fitness score to shine, but it does cost far more processing power.
@chaimeisenbach2097
@chaimeisenbach2097 8 жыл бұрын
Why are you using ASCII?
@DarionAOD
@DarionAOD 5 жыл бұрын
Is that map function he uses part of standard javascript?
@itsmeshaner
@itsmeshaner 5 жыл бұрын
Nope, it's part of p5.js. Here's the reference: p5js.org/reference/#/p5/map
@paladin1147
@paladin1147 5 жыл бұрын
I don't understand why you named DNA[][] population, shouldn't it be like say a member. Please correct me if I am wrong. EDIT: I got it I am dumb.
@maresstefan3391
@maresstefan3391 6 жыл бұрын
How can I write the code without objects?
@ac11dc110
@ac11dc110 7 жыл бұрын
I can't find the source code
@marcielxd100
@marcielxd100 7 жыл бұрын
Hey man, I downloaded your code and tried to run it on p5, but it returns me an error 60: Uncaught ReferenceError: Population is not defined
@Stanistu
@Stanistu 7 жыл бұрын
Try to create index.html from the source as well. It schould be working!
@adelsabanovic2986
@adelsabanovic2986 3 жыл бұрын
Where can I find the Java code
@dineshbhatotia8783
@dineshbhatotia8783 7 жыл бұрын
I cant find the js code of this , can someone send a link
@shivamdubey4783
@shivamdubey4783 2 жыл бұрын
great tutorial sir it would be better if you explain and code not prewritten code it becomes difficult to understand
@akshaysunil2852
@akshaysunil2852 4 жыл бұрын
can you do the same video in python
@MaximusFalcon
@MaximusFalcon 6 жыл бұрын
When you are normalizing each elements fitness, wouldn't you want to map it between the min fitness and the max fitness instead of mapping it between 0 and maxFitness, like you did in the video? If not then why should you use 0 instead of the minFitness?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Oh this is a good point yes!
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Oh this is a good point! I suppose one reason is to not have any elements with a 0 fitness. But ultimately the normalized values should be a percentage of total fitness to map to probability.
@xxsamperrinxx3993
@xxsamperrinxx3993 6 жыл бұрын
Can someone tell me why we dont just pick the ones with the best fitness instead of use the fitness as a probability ?
@jellohunter7981
@jellohunter7981 6 жыл бұрын
I don’t know. I just do that
@saurabhahuja6707
@saurabhahuja6707 5 жыл бұрын
Because less probability does not mean that it have no probability we have to consider that gene also
9.5: Genetic Algorithm: Fitness, Genotype vs Phenotype - The Nature of Code
14:36
Coding Challenge #35.5: TSP with Genetic Algorithm and Crossover
23:09
The Coding Train
Рет қаралды 79 М.
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 44 МЛН
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 96 МЛН
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,7 МЛН
Coding Challenge 166: ASCII Text Images
22:42
The Coding Train
Рет қаралды 1,1 МЛН
The Knapsack Problem & Genetic Algorithms - Computerphile
12:13
Computerphile
Рет қаралды 231 М.
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 1,8 МЛН
Coding Challenge #35.4: Traveling Salesperson with Genetic Algorithm
30:09
Coding Adventure: Atmosphere
22:00
Sebastian Lague
Рет қаралды 1,1 МЛН
312 - What are genetic algorithms?
13:07
DigitalSreeni
Рет қаралды 6 М.
What was Coding like 40 years ago?
29:05
The Coding Train
Рет қаралды 1,7 МЛН
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 818 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 962 М.
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 44 МЛН