Machine Learning: A Basic Introduction

Introduction to Machine Learning

insert image description here

Hnad-crafted rules

Hand-crafted rules are called the rules set by people. So if you want to design a robot today that can help you turn on or turn off the music, the approach may be as follows:

  • To set up a rule is to write a program. If you see the word **"turn off"** in the entered sentence, what the chat-bot has to do is to turn off the music. At this time, say to the chat-bot later, Please turn off the musicor can you turn off the music, Smart? It will help you turn off the music. Looks like it's pretty smart. Others will think that this is indeed artificial intelligence. But if you want to bully the chat-bot today, you can say it please don‘t turn off the music, but you will still turn off the music. Here's a real example. The same example is also reflected in the car. Open the window, don't open the window, and eventually open the window. There are many similar chat-bots around, and if you really say such intentional bullying to it, it will actually answer wrong.

What are the disadvantages of using hand-crafted rules? Its disadvantages are: hand-crafted rules cannot take into account all possibilities, it is very rigid, and the machine created by hand-crafted rules can never be solved than its creator, man. If humans can't think of something, they can't write rules, and if they don't write rules, machines don't know what to do. So if a machine can only follow the hand-crafted rules set by humans, its entire behavior is prescribed, and there is no way to freestyle. If so, it has no way of overtaking the humans who created it.

You seem to see a lot of chat-bots that look very smart. If you have a very large enterprise, he will send thousands of engineers to build tens of thousands of rules with blood and sweat, and then make his machines look smart. But for small and medium-sized enterprises, such a way of establishing rules is disadvantageous.

What we have to do is to let the machine have the ability to learn by itself, which is the direction of machine learning. It is more anthropomorphic. The direction of the so-called machine learning is that you just write a program, and then make the robot very smart, so that it can have the ability to learn. Next, you teach him like teaching a baby or a child. You don't write a program to let him do this, you write a program to make it have the ability to learn. Then next, you can tell it the way you teach a child.
insert image description here

What machine learning does, you can think of it as looking for a function. To make the machine have an ability, this ability is to find the function you are looking for based on the information you provide it.

insert image description here

insert image description here

insert image description here

A function set (collection) must be prepared first, and there are thousands of functions in this function. For example, this function is inside, there is an f1, if you show it a cat, it will tell you to output a cat, and if you see a dog, it will output a dog. There is a function f2 which is very strange. If you show it a cat, it says it is a monkey; if you show it a dog, it says it is a snake. So prepare a function set, which contains thousands of functions. First assume that there is a function set in hand, and this function set is called a model (model).

insert image description here

With this function set, the next thing the machine has to do is: it has some training data, which tells the machine what a good function should look like, what its input and output should look like, and what kind of relationship it has. You tell the machine, now in this image recognition problem, if you see this monkey, you will also output a monkey when you see this monkey picture, you will also output a monkey cat if you see this cat picture, and you will see this dog picture. It is right to export monkeys, cats and dogs. With only these training data, if you take out a function, the machine can judge whether the function is good or not.

insert image description here

The machine can judge whether a function is good or not based on the training data. For example: in this example it is clear that f 1 f_1f1, he is more in line with the description of training data, and more in line with our knowledge. So f1 looks better. f 2 f_2f2Seems like a ridiculous feature. This task is called supervised learning
insert image description here

Now the machine has a way to decide whether a function is good or bad. But it is not enough to determine whether a function is good or bad, because there are thousands of functions in the function set, and it has endless functions, so an efficient evaluation algorithm is needed, which can be selected from the function set. Produce the best function. It takes too much time to measure the quality of functions one by one, and it is actually impossible. Therefore, a good evaluation algorithm is needed to pick out the best function from the function set, and this best function will be recorded as f ∗ f^*f

insert image description here

A very important issue in machine learning: machines have the ability to infer other cases from one instance

insert image description here

The part on the left is called training, which is the learning process; the part on the right is called testing, which can be used as an application after learning well. Therefore, the entire process of the entire machine learning framework is divided into three steps:

  • The first step is to find a function
  • The second step allows the machine to measure whether a function is good or not
  • The third step is to let the machine have an automatic method, and a good evaluation algorithm can pick out the best function.

insert image description here

Machine learning actually has only three steps, which simplifies the whole process. It can be compared to: put the elephant in the refrigerator. Stuffing an elephant into a refrigerator is actually three steps: open the door; stuff the elephant in; close the door, and it's over. Therefore, the three steps of machine learning are like saying that putting an elephant in the refrigerator only needs three steps.

insert image description here

supervised learning

insert image description here

Regression is a machine learning task. When we say: to do regression, it means that the function found by the machine, its output is a scalar, which is called regression. For example, PM2.5 will be predicted in homework 1 (such as predicting PM2.5 tomorrow morning), that is to say, a function is to be found, and the output of this function is a value of PM2.5 at a certain time in the future , this is a regression problem.

The machine needs to judge the PM2.5 output of the function tomorrow morning, and you need to provide it with some information so that it can guess the PM2.5 tomorrow morning. The data you give him may be PM2.5 today, PM2.5 yesterday morning, and so on. This is a function, it eats the past PM2.5 data we give it, and it outputs the predicted future PM2.5. insert image description here
If you want to train this kind of machine, as mentioned in the Framework, you need to prepare some training data, and tell it that it is based on the data collected from the government's open data in the past. The PM2.5 in the morning of September 1st is 63, the PM2.5 in the morning of September 2nd is 65, and the PM2.5 in the morning of September 3rd is 100. So a good function inputs the PM2.5 of September 1st and September 2nd, and it should output the PM2.5 of September 3rd; PM2.5, it should output the PM2.5 of September 14th. If you collect more data, you can make a weather forecast system

insert image description here
Classification (classification) problem. The difference between Regression and Classification is that the types of things to be output by the machine are different. In Regression, the output of the machine is a value, and in Classification, the output of the machine is a category . Assume that the classification problem is divided into two types, one is called the binary classification output is yes or no (Yes or No); the other is called multi-class (Multi-class), in Multi-class is to let the machine do a multiple-choice question, which is equal to It is to give him several options, each option is a category, and let him choose the correct category from several categories.

insert image description here

insert image description here

Training such a function is very simple, give it a lot of Data and tell it, now enter this email, it should be said to be spam, and enter this email, it should be said that it is not spam. Learn enough of this information to automatically find a function that can detect spam.

insert image description here

What I just talked about is the task for the machine to solve. The next thing I will talk about is that the first step in the process of solving the task is to choose a function set. Choosing a different function set means choosing a different model. There are many kinds of models, the simplest is the linear model, but a lot of time will be spent on the nonlinear model. The most familiar among nonlinear models is Deep learning.

insert image description here

When doing deep learning, its function is particularly complicated, so it can do particularly complicated things. For example, it can do image recognition. This complex function can describe the relationship between pixel and class.

insert image description here

Using Deep learning technology can also make the machine play Go. The task of playing Go is actually a classification problem. For classification problems, a very complex function is required. The input is a chessboard grid, and the output is the position where the next step should be placed. Knowing that there are nineteen by nineteen positions on a chessboard, you can think of it as a classification problem of nineteen by nineteen categories, or you can think of it as a Multiple choice questions with nineteen by nineteen options.
insert image description here

insert image description here

So if you have such a chess record, you can tell the machine that if someone makes a 5 of 5, the next step is to make a move on Tianyuan; . Then you give it enough chess records, and it can learn to play Go.

insert image description here

insert image description here

What I just talked about is supervised learning (supervised learning). The problem with supervised learning is that it requires a lot of training data. The training data tells the relationship between the input and output of the function you are looking for. If you are learning under supervised learning, you need to tell the machine what the input and output of the function are. This output is often not obtained in a natural way, and it needs to be marked manually. The output of these functions is called a label.

semi-supervised learning

Suppose you first want the machine to distinguish the difference between cats and dogs, and want to make a classifier to tell you whether the picture is a cat or a dog. There is a small amount of labeled data of cats and dogs, but at the same time there is a large amount of Unlabeled data, but there is no energy to tell the machine which ones are cats and which ones are dogs. In the technology of semi-supervised learning, these data without labels may also be helpful for learning. Later, I will talk about why these data without labels are helpful for learning.
insert image description here
Another direction to reduce data usage is transfer learning.

transfer learning

insert image description here
Migration learning means: Suppose you want to classify cats and dogs, there is only a small amount of data with labels. But now there is a large amount of data, which may or may not have a label. But it has nothing to do with the problem we are considering now. It is the difference between cats and dogs, but here are a lot of pictures of other animals or animated pictures.

insert image description here
More advanced is unsupervised learning, hoping that machines can learn without a teacher.

unsupervised learning

insert image description here
In reinforcement learning, the machine is not told what the correct answer is. All the machine has is a score, which is whether it is good or bad. If you want to use the reinforcement learning method to train a chat robot, the training method will be as follows: send the machine offline, let it talk to the incoming guests, and then talk for half a day, and finally the guest is furious and turns the phone hang up. Then the machine learns one thing that it did wrong just now. But it doesn't know which side is wrong, so it has to go back and figure out its own reasoning, shouldn't it say hello in the first place? Or there should be no swearing in the middle. It doesn't know, and no one told it what it did wrong, so it has to go back and reflect on which step it didn't do well. The machine should learn under reinforcement learning, the machine is very intelligent. Reinforcement learning is also more in line with the real learning situation of human beings. This is the learning teacher in school will tell you the answer, but no one will tell you the correct answer in the real society. I only know whether it is done well or not. If the machine can do reinforcement learning, it is indeed more intelligence.
insert image description here
Alpha Go actually uses supervised learning plus reinforcement learning to learn. First use chess records for supervised learning, and then do reinforcement learning, but reinforcement learning requires an opponent, and it would be time-consuming to use humans as opponents, so the opponent of the machine is another machine.

insert image description here

Guess you like

Origin blog.csdn.net/uncle_ll/article/details/132266502