Wednesday, October 23, 2019

Machine Language


Welcome - Machine learning is one of the most active areas in artificial intelligence. That's partly due to the explosion of big data, but it's also because of huge advances in machine learning algorithms. We now have machines that can learn to drive cars, search for new pharmaceuticals, and even be expert players in games that require complex strategy and creativity. These abilities are just the beginning. Machines are getting better at tasks that, in the past, could only be accomplished by humans. Machines are learning how to make better judgments through pattern matching and strategic decision-making. This course will give you a high-level overview of machine learning concepts and technology. You'll see how machines learn, then you'll see some of the most widely used machine learning algorithms. Finally, you'll get some ideas on how to select the best algorithm. Many organizations are taking advantage of this technology and say that one of the biggest obstacles is finding employees that are knowledgeable about machine learning. This isn't just for data scientists, but also for managers, and even executives who could benefit from knowing more about this technology. That's why this course is designed for mangers, entrepreneurs, students, or professionals who want to better understand machine learning. You'll see how machine learning fits into the overall world of artificial intelligence, then you'll see how to harness this new technology to make better decisions and find patterns in your data. So let's see what those machines have been up to in the world of machine learning. • 1. What Is Machine Learning? What it means to learn - Machine learning has been around for a long time. You can probably tell because the term itself is a little old fashioned. You don't often hear computers referred to as machines. The term machine learning got its start in 1959, when computer pioneer Arthur Samuel wondered if computers could learn their behavior instead of being programmed to do specific tasks. This type of thinking was drastically different from how most computer scientists viewed computers. A computer needed to be told exactly what to do. Think about how you interact with computers. Most programs are a series of explicit instructions. That's why when you're creating software for something like a banking application, you need to be very precise. You might create an instruction that says something like, "If a customer tries to withdraw money "and that exceeds their balance, "then cancel the transaction." That's an explicit instruction. If you see X, then do Y. Machine learning is different. Here you're not creating detailed instructions. Instead, you're giving the computer the data and tools it needs to study the problem and solve it without being told what to do. Then you're giving the computer the ability to remember what it did so it can adapt, evolve, and learn. That's not that much different from how humans learn. Several years ago I decided to purchase a new bookshelf with my wife, and we picked out a fairly large one from IKEA. Soon after I opened the box, I realized that putting it together would be incredibly difficult. I knew I'd have to learn by doing and I'd make a lot of mistakes. The instructions said that each one of the shelves had to have something called a dowel on each side, so I put dowels into each of the holes. Then I shoved the shelf into the sides and waited for feedback. My wife pushed down on the shelf and we were both surprised to see that it worked. Once I figured out the first shelf, I had enough experience to install the other shelves. That way I didn't have to look at the instructions each time I installed a new shelf. This human learning was about starting small and then going big. I had a problem so I formed a rule based on my own experience. I then used the rule to try some larger action. Then I waited for feedback to see if I needed to adjust the rule or leave it as it is. Each time I learned a new rule that worked, I added it to my memory. Once I finished, I probably could have put together many different types of IKEA furniture. In machine learning, computers go about this in much the same way. The machine starts by testing something smaller like some smaller part of the data. Then it uses a statistical algorithm to see how the data fits together. As a human, I had a rule that my shelf needed a dowel. A machine might have an algorithm that says two types of data should be treated the same way. The machine will then use the algorithm to look for patterns. The machine will then get some feedback. Remember that we tested the shelf by pushing down to see if it would support the book. Here the machine might test their outcome against their training data to see if it was correct. Anytime the machine learns something new, it adds it to the database. In a sense, it's storing it in its long-term memory so it can improve and adapt. Keep in mind that the machine and the human both came away with added expertise. I learned how to put together a needlessly complex bookshelf, so now I'd know much more about furniture assembly and our machine would know much more about the data. Work with data Much of computer science is still about working with explicit instructions. In traditional programming, you configure the machine to accept your input and produce an output based on the algorithm. The input is the command and the output is a predetermined response. That will work well when you have a program with straightforward calculations. But it gets a little trickier when humans can't explicitly instruct the computer on what to do. In these cases you need a programming model that allows the machine to learn. You also have to give the machine some ability to respond to feedback. This is a perfect scenario for machine learning. Imagine you're creating a program that needs to detect spam messages. These messages are usually filled with unwanted advertisements or even viruses. You can easily create a word filter program that deletes messages with common spam words so you can filter words like gold, lottery, or winner. This would certainly delete a lot of spam messages, but it would be pretty easy to spoof. You can change the word lottery to contain zeros or just use images. It also might lead to a lot of false positives. Maybe your friend sent you a joke about winning the lottery. This email would accidentally get deleted. These types of challenges don't work well when you're limited to carefully defined instructions. You can't simply create an input command with a predetermined response. That's why machine learning switches things around. Instead of inputting instructions, you'll input data. Instead of a predefined response, you'll be working with machine learning algorithms to help the machine learn how to respond. To start, you'd want to split your data into test data and training data. The training data is a smaller chunk that you'll use to find patterns. Sometimes a model will help your machine make sense of the data with statistical algorithms. These algorithms help the machine make accurate predictions or see patterns between different parts of your data. Let's think about how machine learning might work with our spam program. Let's take 10,000 email messages as our training dataset. We'll use it to build and refine our model before we try it on our test data of over a million messages. You can use your test data to show the machine different examples of spam. Then you could use a classifier machine learning algorithm to help split the email in the two groups. You could have your spam, then a regular message. This is often called binary classification. The machine does this by finding groups of words that are more likely to be found in spam messages. Then it comes up with a score to show the likelihood that it's spam. As a machine learning expert, you'll need to decide the best classifier algorithm to use. Then you'll tweak the hyper-parameters of the algorithm until the machine does a pretty good job predicting whether or not an email message is spam. Once you're satisfied, then that'll be your initial data model. You'll use a machine learning algorithm and tune the necessary hyper-parameters to make an accurate prediction. The key thing to remember is that even though the programmer inputs the data, selects the algorithms, and makes corrections, it's ultimately the machine that makes the decision about whether a message is spam. In some cases the programmer might not even know how the machine learned it was spam. Apply machine learning - Machine learning is already used in many different industries. When you check the weather, or if you're typing something into a search engine, you're already benefiting from machine learning. Any organization that has a lot of data and is looking for better ways to understand it can benefit from this technology. But there are some areas that are a much simpler fit. Think about this web application. Right now, you're either watching this video on a mobile device or on your computer. Machine learning can help us learn how to improve your experience. This application can collect a huge amount of data. So when you click on different videos, it can record what you're watching, where you are, and the time of day. It's pretty easy to collect massive amounts of data. What's difficult is gaining insights from that data. Machine learning can help take all that data and learn more about you. You could see videos that are much more relevant to what you'd like to learn. Maybe when you search for something new, you could have a customized search based on your interests. This application can study your behavior and see how it can better meet your needs. It might seem strange, but computers getting to know you better has actually turned into some of the most lucrative businesses. Companies like Google, Facebook, Apple, and LinkedIn are all using machine learning to better understand you. Some companies are even pushing the envelope of privacy by looking through your previous searches or trying to better understand your friends. That way, every time you use their service, they can give you a customized experience. That's why your Facebook newsfeed is unique to you. It's also why two people putting in the exact same search term into Google might get completely different results. Any time you're on a website and you see something that says Recommended For You, then you're probably benefiting from machine learning. Amazon looks through all of your previous purchases and then uses machine learning algorithms to recommend items. Netflix uses machine learning to find complex patterns so it can recommend different shows based on what you've already watched. YouTube lines up the next video based on those that you've watched in the past. They do this as a way to better make recommendations for you. Many organizations are using machine learning for automatic translation. YouTube might use natural language processing to transcribe your video and make subtitles. They're translating your speech into text. Some sites will use machine learning to translate one set of subtitles into several different languages. In machine learning, you're using artificial intelligence to help your program find patterns in massive data sets. Often, they find patterns in data that humans could never see. That's one of the most interesting things about machine learning, it's not just an enhanced form of human learning. Instead, it's a completely different way to find patterns, make decisions, and gain greater insights. So if you want to use machine learning in your organization, you have to think about the way the machine learns. That way, you can start to collect the data that will allow your program to better understand your customer. Before you start your machine learning project, you have to think about your data. Is it of high quality? Do you have enough data to learn something new? Remember that this is the way your machine learning program will view the world. The broader the view, the more likely it is you'll find something interesting. You don't want your program looking through a keyhole. When planning to use machine learning, start thinking about the best strategies to get high quality and diverse data sets. Different types of machine learning You may think of machine learning as a different name for something that's already around. Maybe it's just an updated way to describe statistics, or a new way to talk about data science. But the key when you think about machine learning is the focus on the term learning. Machine learning certainly has statistics. It might also be a key part of your data science efforts. But these are just the tools your machine needs to learn, they're not a substitute for learning. Think about what it means to learn. What are the different strategies that you use to learn something new? How can you take these strategies and then apply them to machines? Imagine you wanted to learn how to play chess. You could do this a couple of different ways. You could hire a chess tutor. They would introduce you to some of the different chess pieces and how they move across the board. You could practice by playing against your tutor and they would supervise your moves, and help you when you've made a mistake. Then, after a while, your tutor would finish all your lessons and you'd start to play competitively with others. Let's say you couldn't find a tutor. Then you could go to public parks and watch several hundred experts play the game. You couldn't ask them questions, you'd just quietly watch and learn. If you do this long enough, you'd probably understand the game. You might not know the names of the chess pieces, but you could understand the moves and strategies from your hours of observations. You might even try a combination of these two approaches. A chess tutor would show you the basic rules, then you'd go back to watch other people playing. You'd have a high-level overview and the names of the chess pieces, but you'd rely on observations as the way to see the new strategies and improve. These three strategies are very similar to how a machine might learn. You could do something called supervised learning. Here, a data scientist acts like a tutor for the machine. They train the machine by showing it basic rules and giving it an overall strategy. You could also try unsupervised learning. Here, you just have the machine make all the observations on its own. The machine might not know all the different names and labels, but they'll find patterns on their own. Finally, you could mix the two and try semi-supervised learning. Here, you would train the machine just a little bit so they get a high-level overview. Then most of the learning about the rules and strategies is through observing different patterns. As you can imagine, all three approaches have their own strengths and weaknesses. For supervised learning, you'll need a knowledgeable tutor. There needs to be someone out there that knows a lot about chess and could show you how to play the game. With unsupervised learning, you need to have access to a lot of data. You might not be able to go to a public park and watch hundreds of different experts play the game. It also depends a little bit on who you watch. You need to watch people who are playing well. With semi-supervised learning, you can run into trouble on both sides. If you have a bad tutor, it will be much more difficult to learn through observations. On the other hand, if you have a great tutor, but the people you observe are poor players, then you might understand the game, but not really become a master player. You might be in a position where you can decide which approach works best. But, often, you just have to do the best with what's available. If you can't find a tutor, then you have to do your best by observing people in public parks. If you don't have a public park, then you have to do your best to find a good tutor. You can only do semi-supervised learning if you have access to both. • 2. Different Ways a Machine Learns Supervised = Classify data Unsupervised = Cluster data Semi-supervised Reinforcement - One type of machine learning has gotten a lot of attention over the last few years. It's called reinforcement learning. Reinforcement learning is different from supervised, unsupervised, and semi-supervised learning. With each of these techniques, you're trying to invent the best model. You want to find a model that can most accurately classify different data sets or find meaningful clusters. Once you have the model, you can then let the machine work with the rest of the data. Reinforcement learning has the machine iterate to continuously improve the outcome. Over time, the machine should zero in like a heat-seeking missile and get closer and closer to high quality output. Reinforcement learning is very open ended. You're reinforcing certain ways that you want the machine to behave. Instead of leaving everything open to study and observation, you're giving the machine a very clear goal. Think of it this way. Back when I was younger, there was a simple video game called Pong. The game had two separate bars on the opposite sides of the screen. They would slide up and down as you tried to hit the ball to each side. In 2013, Google's Deep Mind project experimented with Pong to see if they could teach a computer how to play. They set up a series of rewards for the computer. Every time the computer hit the ball against the paddle, it got a reward. Then every time that the opponent missed the ball, it got another reward. Then it played against itself and tried to gather as many rewards as possible. It only took a short while for the computer to start to master the game and consistently beat human players. The Deep Mind team used something called Q-learning. This Q-learning helped with some of the more complicated games that needed more sophisticated rewards. In Q-learning, there are set environments or states. There are also possible actions that can respond to these states. In Q-learning, you want the machine to improve the quality of the outcome. This is represented with the letter Q. You might have a game like Space Invaders that requires you to shoot through aliens to eventually win the game. This has a more complex reward system. It's not just as simple as having your opponent miss the ball. In this case, you would start out with a quality of zero. Then you would have the machine learn which actions improve the conditions. Each time an action improved the state, the Q would go up from zero. The Q would go up based on the states and actions. This type of reinforcement learning is one of the most promising areas in machine learning. It allows the machine to go through endless simulations of actions and states until it finds the best strategy. In 2015, Google's Deep Mind project made the news when their AlphaGo program first beat an expert player in the game called Go. AlphaGo used a form of unsupervised learning. It learned primarily by observing professionals playing the game. Their newer program AlphaGo Zero relies primarily on Q-learning. It didn't have to watch the experts play the game. AlphaGo Zero simply went through the game and tried different actions as a way to change the state and win. Within hours, this Q-learning machine played Go at a level that humans can't understand. In fact, after just 70 hours of training, AlphaGo Zero beat the earlier version of AlphaGo in the first 100 tries. Reinforcement learning and specifically Q-learning allows machines to quickly grow beyond our understanding. It can help you skip the steps required in unsupervised learning. You don't need hours of observing and studying massive amounts of data. • 3. Popular Machine Learning Algorithms Problems that use machine learning Decision trees k-nearest neighbor K-mean clustering Regression Say you're looking to see how one thing impacts the probability of another thing happening. The most popular algorithm for this type of analysis is called the Bayesian algorithm based on the Bayes' theory of statistics. Naive Bayes is one of the most popular Bayesian machine learning algorithms. It's called naive because it assumes that all of the predictors are independent from one another. Naive Bayes is mostly used for binary or multiclass classification. Fit the data • 4. Applying Algorithms Follow the data Remember that bias and variance are ways of measuring the difference between your prediction and the outcome. They're not right and wrong answers but different dials that you need to improve your predictions. The key thing to keep in mind is that you'll use different techniques based on whether you have too much bias or too much variance. Select the best algorithm • 5. Common Challenges Machine learning challenges Machine learning challenges - As you can imagine, machine learning is filled with many technical challenges. You can watch for these three common challenges when you're working on your machine learning team. The first challenge is making sure that people in your organization can ask interesting questions. Next is to keep training data separate from testing data. The final challenge is to not spend too much time choosing the right algorithm. Many machine learning specialists work in larger organizations. These organizations will have groups of people with many different skills. It might be difficult to make a connection between the needs of the business and machine learning. Many departments might not have the skills in place to ask interesting questions. So one of your first challenges will be helping the rest of the organization embrace a more exploratory mindset. You might need to push the organization into asking interesting questions. I once worked for an organization that wanted to invest heavily in machine learning. They interviewed at local universities and hired a half a dozen machine learning experts. This team immediately got to work setting up the technology they needed to work with large datasets. Once that was all set up they started to ask people what were the different questions that they wanted to answer. They were just fresh out of graduate school so they were used to running small data experiments and learning from the results. The business people and managers didn't have any experience asking good questions. When they did, it was something like: What type of promotions will our customers like? Which is something that could be solved with traditional database tools. The team felt like they built a Formula One race car and they were showing everyone how to parallel park. That's why you should spend a good deal of time at the beginning working with the business to ask the small, interesting questions. Then once you can ask dozens of good questions, you can work with the business to add greater value. Another challenge you might run into is when teams don't clearly separate training data from the testing data. Remember that training data is the small amount of data that you set aside to build your model in supervised learning. That's where you'll tweak the settings with your machine learning algorithms. Some machine learning teams work to create an extremely accurate model for their training data. Then they show the result to their managers and the rest of the organization. Then they sometimes make the mistake of mixing this training data back into the testing data. When this happens, you'll probably have much less accurate results. The first thing you want to keep in mind is that you should never remix your training and testing data. This makes the data predispose the settings of your algorithm. In a sense, you're already giving your machine the correct answers. Remember that you want your model to be generalizable. That means that it should work well with unfamiliar data. If you're mixing in some of your new data with your old data, you're not really giving your model the fresh perspective it needs to correctly test its accuracy. You also want to watch to make sure you're not overstating the effectiveness of your model. When you present great results with your training data, then it might be confusing to your managers when they same model does poorly later on. The best way to avoid this is to not make presentations with training data. When you make a presentation, make sure that you do it with unfamiliar data. That way your managers have a realistic view of its accuracy. The final thing to keep in mind is that you shouldn't be too concerned if you have a strong bias toward any one machine learning algorithm. Some machine learning experts really like some algorithms better than others. It might just intuitively make sense to them. Some algorithms are just like old songs that bring back pleasant memories. Either way, don't be too concerned about making sure you're selecting the best algorithm. Sometimes you'll work better with your favorite tool than with the newest tool.

Labels:

0 Comments:

Post a Comment

<< Home