Can Computers Evolve on Their Own?

Can Matrix come true?


First of all, and before trying to answer this question. Let me introduce myself.

I am Bahaa Galal, an Egyptian Computer Engineer who is passionate about Artificial Intelligence and Machine Learning.

Last 9 months, I was working on a new product called Crowd Analyzer. Crowd Analyzer is a social media monitoring tool that differentiates itself from others by its ability to deeply understand the language.

In developing Crowd Analyzer the first thing they asked me to do is to develop a computer program that can detect the emotions behind what people write on social media. In other terms, this computer program that I should develop should be capable of telling whether people were happy, sad or neutral when they wrote their social media posts.

I have used many of what I learned from Machine Learning field to develop the algorithm, and it was working fine …. until.

After 4 months, I discovered that the algorithm got quite old and it can’t adapt to those new terms and expressions that people are developing every day to express their feelings especially in our Arabic language.

So I started to consider the question “Can my program evolve and adapt to those new terms and expressions on its own, or do I have to interfere and teach it from time to time?”

I started my research to find a proper answer to my question. I didn’t find anything promising until I saw this definition somewhere on the internt.

Genetic programming is a different way of solving problems. Instead of choosing an algorithm to apply to a problem, you make a program that attempts to automatically build the best program to solve a problem. You basically create an algorithm that creates algorithms.

This means that my program will create programs that will try to solve the problem on their own! That should be impossible.

I started to dig more and more until I understood how this genetic algorithm works.

It starts by you developing a program. This program creates a large set of programs in order to try to solve the probosed problem. Those programs are completely random and most of them are stupid enough.

Then Those programs compete against each other, and after the competition, a ranked list of the programs from best to worst is determined according to how close they were from solving your problem.

The best programs are replicated and modified in two different ways. Mutation, in which certain parts of the program are altered very slightly in a random manner in the hope that this will make a good solution even better. Crossover (Breeding), which involves taking a portion of one of the best programs and replacing it with a portion of one of the other best programs.

This replication and modification procedure creates many new programs that are based on, but different from, the best programs.

And then, those new better programs compete against each other and the whole procedure is then repeated.

Because the best programs are being kept and modified, it is expected that with each generation they will get better and better, until the perfect solution is found.

This was impressive as well as scary in the same time & I decided to give a try.

I had this simple problem. In the below table, What is the equation that maps x and y to the result.

I developed a simple program that should be able to create those programs on its own to find the answer.

You can find this program in my github account.

Then the magic moment came, I run the program. It created the first generation that contained some thousands of very very stupid programs that the best of them was still so far from finding the equation. Then the programs started to get better and better until in the 9000 something generation the perfect program was found. The perfect program that has mapped the x and y to the result correctly and accurately.

That was very surprisingly to me! The computer truly evolved and at the end it was possible to solve the problem!

The whole generation thing has took a couple of seconds on my Mac Book Pro.

So, Yeah. The answer is Yeah.

Computers can evolve on their own!