One of my biggest pleasures in life is to watch my children learn things that we take for granted. Some months ago my daughter learned the skill of jumping. Recently, she started a new game to improve this skill. She climbs on the couch, throws one pillow on the ground and then tries to jump on it. This game of trying to land properly on that pillow seems to be an interesting and most challenging task that she engages with a devotion of a professional athlete.
I asked myself how to teach a machine to do this. I do not want to give the computer the first principles from physics as a formula to solve. He should learn it from empirical data. In the following animation, you see a very easy approach to do this.
I have implemented the mechanics of jumping, better say falling, and let the computer try to land on the pillow until he succeeds. Once he succeeded in landing, he is done. He found a solution to the problem that I have posted. My daughter would now vary the distance between couch and pillow and continue to see how the required speed changes (and how far she can push it). Doing that with a computer would however needs some math, which my daughter and I want to avoid (We would need to suggest a functional form between distance and required speed.).
Instead, let us discuss a game that she will most likely pick up in about 4 months. In this game we can see a central aspect of this machine learning. We try to throw some toy on the table with the goal that it lands and stays on it. With my limited parental power I will not be able to stop this from happening, but I should at least be able to convince her of using something soft. For the throw she will have to decide on the distance from the table, as well as the speed and angle of the throw. Let the computer try this game.
Here the computer just takes random values for the three unknowns and repeats until he succeeds in landing. Just observe and see how long it will take him to find a solution. For a computer this endless trial-and-error is fine. We humans understand that this is not the best approach. What would we do differently?
The algorithm above simply checks whether it was a failure or a success. After a failure he simply starts from stretch. We intelligent beings would try to learn from past experience to get better over time. Let us use experience: we take the best of the earlier attempts and take it as starting point for the next attempts. This creates the huge problem: how to decide which failure is better than others. This is one of the biggest problem for AI and machine learning: what is a good failure? For our game we simply take the one that came closest to the table top and perturb its parameters for the next try slightly.
After some time the solution will be found. Without computations on our side! The power of this approach is that we can use this idea for all kinds of problems. Further, we can easily modify and implement a new problem and find a solution to this new setting. One of the major problems is that we need to recognize a good failure to be able to improve this solution. Playing with the animation above we find two problems that take incredibly long to overcome. Firstly, when we bounced from the underside of the table top, we have found a solution that was very close to the goal on top of the table top and will use as best failure. As we then start from this failure we will spend a long time seeing only bounces. Secondly, if our best failure was a very flat throw that passed just over the table top, it will also require a long time to find a solution. This is part of the central problem of finding a good failure, that can be used to find a solution quickly.
Once we have found a solution, we can continue to use our problem solving machine to find more different solutions and compare them and look for an optimal solution. As a very last example let us try to find the solution that requires the solution with smallest possible energy, so speed of the throw.
What we just saw was a basic example of weak artificial intelligence (AI) used in machine learning. This AI is designed to solve one specific kind of problem and is good as a first example. More complex problems require more complex AI/programs and additional ideas, but the basic idea is the same. Trial and error with a combination of learning from experience and data.
All animations are under creative commons license and we invite everyone to use them in any education/academic and non-commercial contexts. All animations are written in JavaScript and the source can be easily downloaded to be reviewed and modified under the restrictions just stated.
Featured Image by Farzad FARID, found on flickr under CC BY-SA 2.0 licence.