2016年7月30日 星期六

Take a peep on Genetic Algorithm (a.k.a mimicking naïve evolution)

Pre

Since stuff didn't go that busy on these days, finally got a chance to take a quick look on the Genetic Algorithm (GA) and understand the basics of it. Before this, I was overwhelmed by the side projects as well as the internship. The side projects are mainly about the node app and stuff about html, javascript and css. More specifically, one is React app and another one is Angular app. Doing these two projects simultaneously seems over-killing. Anyway, this is the whole point of life, right?

Let's get right into it


You know, a peep doesn't give you the whole picture. I just watched two great videos which explain the algorithm quite well. 

  1. A open lecture from MIT: https://www.youtube.com/watch?v=kHyNqSnzP8Y
  2. A kinda book sharing of the Nature of Code (good book though): https://www.youtube.com/watch?v=6l6b78Y4V7Y
After these two videos, I got the full picture about the GA. However, it is becomes more and more complicated when the problem size and all the controls you could make to improve the accuracy as well as diversity.

There are a few terms which would be stuck in your head if you are going to look around the GA.

Fitness

A mathematical function (or map function) to evaluate how well the current population is. 

Genotype and Phenotype

Genotype is the data structure (or say the binary) of your population, just like the chromosome (or say DNA) in our body which determined the phenotype.

Phenotype is the physical representation of your genotype. You can imagine it as the iris, hair color, and height of humans.

Evolution

The whole point of GA is to mimic the evolution again in your problem space. There are some basic steps:
  1. Initialize the state or random generate some "creatures"
  2. Evaluate them by the fitness function
  3. Select some amount of population to survive according to some functions (can imagine as a simple probability that higher fitness would be more likely to be selected) [Natural Selection]
  4. Reproduce and Crossover the genotypes
  5. Mutate the genotypes according to a small probability
  6. With this new set of population, go back to step #2 and loop until the appropriate solution is found
Actually, GA is nothing like super fancy. But it sounds quite fancy and professional by itself. I will try to do a simple demo in the following weeks and try to dig more into it and see if I can find out anything special.

Post

After reading through these materials, I just felt like computer scientists are quite keen on mimicking the whole world (maybe be should say God?). Look at what we have today, the neural network, which is going to be competitive to human brains in the following years. So...should there any stance between this kind of mimicking and the nature? In the video, there is one interesting question asked if we put the same algorithm back to real life. Would that be possible? Of yes, that's why we can survive till nowadays. Stop until it grows? We may say "Stop before it starts".


沒有留言:

張貼留言