Introduction to Machine Learning

Artificial Intelligence (AI) is something that has always fascinated me. I remember even as a kid thinking about how amazing it was that the enemies in my video games could react to where I was and what I was doing. As I got older and began to program, the idea that I could make an AI to play a game against me or to help me solve problems was something that I wanted to learn how to do but that seemed out of reach for whatever level of programming I was at. I just found out that Google is starting an online class on Machine Learning and I’ve decided now is the time. The class will be taught by “Googler” Joshua Gordon and the lessons will all be on Youtube (free!). An introduction to the class and the first video were posted last week and it looks like it is going to be a really great class. I don’t know how long the class will be but I plan on writing posts along the way which will serve as my own notes for what I’m learning and taking away from the class. The only prerequisite for the class is that you have a very minimal understanding of Python and/or Java. I’m totally excited about this class!

What is Machine Learning?

Machine Learning is writing an algorithm (or using an already written one) which can learn rules by looking at examples. With normal programming, we have to think of nearly every possible solution to our problem and write rules for each of those cases. With machine learning, we give the algorithm examples of inputs and outputs and it learns the rules on its own. The algorithms are looking for patterns – these patterns can be visual (images) or data driven. The huge benefit here is the flexibility that machine learning gives us. Mr. Gordon gives a really great example of this: if we write a Python program that can recognize digits, that program is hard coded to do that one job (recognize digits). If we try to get that same script to recognize differences in speech, it simply couldn’t do it. However, if we write an algorithm that recognizes patterns, that same algorithm can be used not just to recognize digits but for far more complicated things like speech recognition, image recognition, medicine issues, or anything else that you can give it examples for (such as tell apart A and B).

A Brief History of Machine Learning

AI isn’t the only application of machine learning but it might be the most trendy example, so that is what we will discuss. Early AI programs typically excelled at only one thing. For instance, Deep Blue played chess at a championship level – but that is all it could do! Deep Blue was developed by IBM and was the first AI to win both a chess game and a chess match, which happened back in 1996. Developing a championship level chess AI wasn’t a simple task. However, in the game of chess there are a finite number of possible moves to make. An efficient computer program can analyze all of these moves (since there are relatively few of them) and determine which is the best move. This is a brute force method and when we think about it, it is kind of “cheating”. A human can’t possibly do that – we look patterns and try to determine the best move that way. Deep Blue was ground breaking at the time, but now we have the ability to write a program that can play chess at a championship level as well as solve many different problems without needing to be rewritten, which is something that Deep Blue could never do. You may have heard of AlphaGo in the news lately. AlphaGo is an AI that was developed by Google to play the ancient game Go. It has been in the headlines recently because in March of this year it beat Lee Sedol in a five game match (it won 4-1). Sedol is a 9-dan rank Go player, which means he is one of the very best in the entire world. Until AlphaGo, no computer had ever beaten a professional Go player on a 16x16 board without handicaps. It is hard to believe but absolutely true. In fact, many people thought this level of AI was still decades away. Lee Sedol himself said he didn’t expect AlphaGo to play so perfectly and that he didn’t expect to lose! Why is a computer just now able to beat a human at an ancient game like Go and why is it such a big deal? First, let’s look at the history of Go. Go is a Chinese game that is approximately 3,000 years old. The play area consists of a grid, typically 19x19 but it could be any size. Players take turns placing their stones (one player is black and other is white) with the goal of capturing their opponents stones and preventing their own stones from being captured. Stones are captured if they are surrounded on all sides by an opponents stone. We can see that it takes an entirely different level of comprehension to be able to play Go than it does to play Chess. With chess, each player only has 16 components that they can possibly move and each can only move in a certain way. However, with Go, there are many, many times more possible moves! In fact, it takes humans years of practice to get to the level that Lee Sedol plays Go. He has spent a lot of time working on his intuition of the game and pattern recognition. In fact, in Seoul, South Korea there are schools dedicated to teaching kids how to master Go. How could a computer possibly keep up? AlphaGo uses machine learning to essentially teach itself how to play Go. The team at Google that wrote the AlphaGo algorithm gave it millions of examples of Go moves and positions made by professional (human!) Go players in games. The team didn’t stop there, though. AlphaGo plays itself millions of times, tweaking itself as it goes along. This gives it the ability to start predicting future moves and determining what the best move right now would be. This method of AI is much more human like than where we were with DeepBlue back in the mid 90’s. However, I still feel a bit like we are cheating here – even though many professional Go players have been playing and training since they were in elementary school, they haven’t played a fraction of the number of times that AlphaGo got to play. We are living in a really great time for machine learning and artificial intelligence. The industry is rapidly growing, as we can tell just from the stories of Deep Blue and AlphaGo. However, we are also living in a time where you and I learn how to develop and use these tools for free. I’m excited to begin this journey! Next time, we’ll go over Mr. Gordon’s first video, Hello World - Machine Learning Recipes #1. Have questions or suggestions? Please feel free to comment below or contact me.