Learn Neural Network and Evolution Theory Fast

[carykh] has a really interesting video series which can give a beginner or a pro a great insight into how neural networks operate and at the same time how evolution works. You may remember his work creating a Bach audio producing neural network, and this series again shows his talent at explaining the complex topic so anyone may understand.

He starts with 1000 “creatures”. Each has an internal clock which acts a bit like a heart beat however does not change speed throughout the creature’s life. Creatures also have nodes which cause friction with the ground but don’t collide with each other. Connecting the nodes are muscles which can stretch or contract and have different strengths.

At the beginning of the simulation the creatures are randomly generated along with their random traits. Some have longer/shorter muscles, while node and muscle positions are also randomly selected. Once this is set up they have one job: move from left to right as far as possible in 15 seconds.

Each creature has a chance to perform and 500 are then selected to evolve based on how far they managed to travel to the right of the starting position. The better the creature performs the higher the probability it will survive, although some of the high performing creatures randomly die and some lower performers randomly survive. The 500 surviving creatures reproduce asexually creating another 500 to replace the population that were killed off.

The simulation is run again and again until one or two types of species start to dominate. When this happens evolution slows down as the gene pool begins to get very similar. Occasionally a breakthrough will occur either creating a new species or improving the current best species leading to a bit of a competition for the top spot.

We think the series of four short YouTube videos (all around 5 mins each) that kick off the series demonstrate neural networks in a very visual way and make it really easy to understand. Whether you don’t know much about neural networks or you do and want to see something really cool, these are worthy of your time.

32 thoughts on “Learn Neural Network and Evolution Theory Fast

  1. Given “surviving creatures reproduce asexually”, I wonder what would be the mechanism through which “evolution slows down as the gene pool begins to get very similar”? Isn’t gene mixing required for a homogenising slowdown?

    1. They can still hit a local maximum. The mutation rate is then too low to jump the walls of the bowl they’re in, and eventually all the sub-optimal variations are culled out. Sexual reproduction is actually one strategy to *escape* local maxima, as you can have a couple of distinct species each stuck in their own bowl interbreed and produce offspring quite different to either parent, and therefore potentially outside the bowls.

          1. There’s apparently only 0.2% genetic difference between the average domestic dog and a grey wolf, whereas humans are said to vary by 0.5% yet all be the same species.

        1. In nature, the species is more a political than scientific concept.

          While it’s pretty well agreed that two animals that can’t have offspring, or which can’t have fertile offspring, are of different species, there is a whole gray area of hybrids and close relatives which nobody can agree on, especially among birds which have more and smaller chromosomes than mammals and therefore hybridize easily.

          Also, it’s widely suspected that future biological science techniques will make hybrids possible between individuals which can’t breed naturally. (This is already the case where artificial insemination bridges the gap between individuals which can’t mechanically copulate, such as very small and very large breeds of canis familiaris.)

  2. My fellow Muricans, let me be perfectly clear:
    Evolution is just a theory.
    Global warming is fake news. Coal is clean and safe for our children, and our children’s children. Coal will create jobs.
    I’m being bugged and spied on.
    I am vilified by the fake mainstream media.
    The earth is flat.


  3. Indeed was just about to say the same! Title is wrong!!! This is an example of Genetic Algorithms not an example of Neural networks. The creatures kind of look like the graphic of a neural network with nodes but this (cool demo) has not much to do with neural networking and a lot more with genetic algorithms…

      1. Maybe in others videos he uses neural network but in this one no.
        The description of the algorithm is a sort of genetic algorithm and inside the code that you can download there is not any neural network nor any learnig. Instead you can find functions like setFitness comments like //Reproduce and mutate.
        It seems that title is completely wrong.

      2. Nope, it’s genetic algorithm I’ve programmed both NN’s and GA’s and this example is definitely a classic example of GA. The only thing Neural network has in common is that you randomly evolve the weights but you don’t use offspring and mutations, once you talk mutations etc its a GA so yes title is wrong…

  4. Could they have taken the extreme ‘bad’ cases and reversed them horizontally to get extreme ‘good’ ones? The ones in the middle seem like the ones that you want to discard (with some gradient).

    1. I was thinking the same thing, seems like a waste of creatures while a simple flip would suffice. I suppose it’s mostly wasteful in the first few generations. You do lose some diversification which does decrease your chance of finding a good solution (fast). Nonetheless these GA videos are amusing and seeing order arise from chaos is always mesmerizing to look at :)

  5. Change the title to Genetic Algorithms already. Indeed here is another similar demo http://rednuht.org/genetic_cars_2/
    Also when looking into the sources of above videos https://www.openprocessing.org/sketch/377698:
    Line 25: float bigMutationChance = 0.06;
    Line 278 and further you clearly see it’s not a Neural Network but indeed a GA variation at work….
    There is no summation of weights and inputs to compute the output of the neurons nor is there hidden layers like you have in a Neural Network. This is a GA not a NN period!

  6. Now it would be fun to see the environment change. By adding obstacles and slopes. Then we could see how environmental changes impacts currently dominant species and give rise to other new species that would have been weaker because of a mutation but are now stronger.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s