Introduction - Supervised Learning

摘要: 本文是吴恩达 (Andrew Ng)老师《机器学习》课程,第一章《绪论:初识机器学习》中第3课时《监督学习》的视频原文字幕。为本人在视频学习过程中逐字逐句记录下来以便日后查阅使用。现分享给大家。如有错误,欢迎大家批评指正,在此表示诚挚地感谢!同时希望对大家的学习能有所帮助。

In this video (article) I am going to define what is probably the most common type of machine learning problem, which is supervised learning. I‘ll define supervised learning more formally later, but it‘s probably best to explain or start with an example of what it is, and we‘ll do formal definition later.

Let‘s say you want to predict housing prices. A while back, a student collected data set from the city of Portland, Oregan. And let‘s say you plot a data set and it looks like this. Here on the horizontal axis, the size of different houses in square feet, and on the vertical axis, the price of different houses in thousands of dollars. So, given this data, let‘s say you have a friend who owns a house that is, say 750 square feet, and hoping to sell the house, and they want to know how much they can get for the house. So how can the learning algorithm help you? One thing a learning algorithm might be able to do is put a straight line through the data or to fit a straight line to the data, and based on that, it looks like maybe the house can be sold for maybe about \$150,000. But maybe this isn‘t the only learning algorithm you can use. There might be a better one. For example, instead of fitting a straight line to the data, we might decide that it‘s better to fit a quadratic function or a second-order polynomial to this data (blue line). And if you do that, and make a prediction here, then it looks like, maybe they can sell the house for closer to \$200,000. Onelooks like maybe the house can be sold for maybe about \$150,000. But maybe this isn‘t the only learning algorithm you can use. There might be a better one. For example, instead of fitting a straight line to the data, we might decide that it‘s better to fit a quadratic function or a second-order polynomial to this data (blue line). And if you do that, and make a prediction here, then it looks like, maybe they can sell the house for closer to $200,000 of the things we‘ll talk about later is how to choose and how to decide do you want to fit a straight line to the data or do you want to fit a quadratic function to the data. And there‘s no fair picking whichever one gives your friend the better house to sell. But each of these would be a fine example of a learning algorithm. So, this is an example of a supervised learning algorithm. And the term supervised learning refers to the fact that we gave the algorithm a data set, in which the "right answers" were given. That is, we gave it a data set of houses in which for every example in this data set, we told it what is the right price, or what is the actual price that that house sold for, and the task of the algorithm was to just produce more of these right answers such as for this new house that your friend may be trying to sell. To define with a bit more terminology, this is also called a regression problem. And by regression problem I mean we‘re trying to predict a continuous valued output, namely the price. So technically I guess prices can be rounded off to the nearest cent. So maybe prices are actually discrete values, but usually we think of the price of a house as a real number as a scalar value, as a continuous value number. And the term regression refers to the fact that we‘re trying to predict the sort of continuous values attribute.

?

Here‘s another supervised learning example, some friends and I were actually working on this earlier. Let‘s say you want to look at medical records and try to predict of a breast cancer as malignant or benign. If someone discovers a breast tumor, a lump in their breast, a malignant tumor is a tumor that is harmful and dangerous, and a benign tumor is a tumor that is harmless. So obviously people care a lot about this. Let‘s see a collected data set. And suppose in your data set you have on your horizontal axis the size of the tumor and on the vertical axis I‘m going to plot one or zero, yes or no, whether or not these are examples of tumors we‘ve seen before are malignant which is one, or zero if not malignant or benign. So, let‘s say our data set looks like this where we saw a tumor of this size that turned out to be benign. One of this size, one of this size, and so on (all blue x). And sadly, we also saw a few malignant tumors, one of that size, one of that size and so on (all red x). So, this example, I have five examples of benign tumors shown down here, and five examples of malignant tumors shown with a vertical axis value of one. And let‘s say we have a friend who tragically has a breast tumor, and let‘s say her breast tumor size is maybe somewhere around this value. The machine learning question is, can you estimate what is the probability, what is the chance that a tumor is malignant versus benign? To introduce a bit more terminology, this is an example of a classification problem. The term classification refers to the fact that here we‘re trying to predict a discrete valued output zero or one, malignant or benign. And it turns out that in classification problem, sometimes you can have more than two possible values for the output. As a concrete example, maybe there are three types of breast cancers, and so you may try to predict the discrete values of zero, one, two or three, with zero being benign. Benign tumor, so no cancer. And one may mean, type one cancer, like, you have three types of cancer, whatever type one means. And two may mean a second type of cancer, and three may mean a third type of cancer. But this would also be a classification problem because there‘s another discrete value set of output, corresponding to, you know, no cancer, or cancer type one, or cancer type two, or cancer type three. In classification problem there is another way to plot this data. Let me show what I mean. Let me use a slightly different set of symbols to plot this data. So, if tumor size is going to be the attribute that I‘m going to use to predict malignancy or benignness, I can also draw my data like this. I‘m going to use different symbols to denote my benign and malignant, or my negative and positive examples. So instead of drawing crosses, I‘m now going to draw O‘s for the benign tumors. Like so. And I‘m going to keep using X‘s to denote my malignant tumors. Okay? I hope this figure make sense. All I did was I took my data set on top and I just mapped it down to this real line like so. And started to use different symbols, circles and crosses, to denote malignant versus benign examples. Now, in this example we use only one feature or one attribute, namely, the tumor size, in order to predict whether the tumor is malignant or benign. In other machine learning problems, we maybe have more than one feature, more than one attribute. Here‘s an example.

Let‘s say that instead of just knowing the tumor size, we know both the age of the patients and the tumor size. In that case maybe our data set will look like this, where I may have a set of patients with those ages and that tumor size and look like this. And a different set of patients, they look a little different, whose tumors turn out to be malignant, as denoted by the crosses. So, let‘s say you have a friend who tragically has a tumor. And maybe, their tumor size and age fall around there. So, given a data set like this, what the learning algorithm might do is fit a straight line through the data to try to separate out the malignant tumors from the benign ones. And so, the learning algorithm may decide to throw the straight line like that to separate out the two classes of tumors. With this, hopefully you can decide that your friend‘s tumor is more likely so if it is over there, that hopefully your learning algorithm will say that your friend‘s tumor falls on this benign side and is therefore more likely to be benign than malignant. In this example we had two features, namely, the age of the patient and the size of the tumor. In other machine learning problems, we will often have more features. And my friends that work on this problem, they use other features like these, which is the clump thickness of the breast tumor, uniformity of cell size of the tumor, uniformity of cell shape of the tumor, and so on, and other features as well. And it turns out one of the most interesting learning algorithms that we‘ll see in this class is a learning algorithm that can deal with, not just two or three or five features, but an infinite number of features. On this slide, I‘ve listed a total of five different features. Right, two on the axes and three more up here. But it turns out that for some learning problems, what you really want is not to use, like, three or five features. But instead, you want to use an infinite number of features, an infinite number of attributes, so that your learning algorithm has lots of attributes or features or cues with which to make those predictions. So how do you deal with an infinite number of features. How do you even store an infinite number of things on the computer when your computer is gonna run out of memory. It turns out that when we talk about an algorithm called the Support Vector Machine, there will be a neat mathematical trick that will allow a computer to deal with an infinite number of features. Imagine that I didn‘t just write down two features here and three features on the right. But imagine that I wrote down an infinitely long list, I just kept writing more and more features. Like an infinitely long list of features. Turns out, we‘ll be able to come up with an algorithm that can deal with that. So, just to recap. In this class we‘ll talk about supervised learning. And the idea is that, in supervised learning, in every example in our data set, we are told what is the "correct answer" that we would have quite liked the algorithms have predicted on that example. Such as the price of the house, or whether a tumor is malignant or benign. We also talked about the regression problem. And by regression, that means that our goal is to predict a continuous valued output. And we talked about the classification problem, where the goal is to predict a discrete valued output.

Just a quick wrap up question: suppose you‘re running a company, and you want to develop learning algorithms to address each of two problems. In the first problem, you have a large inventory of identical items. So, imagine that you have thousands of copies of some identical items to sell and you want to predict how many of these items you sell within the next three months. In the second problem, problem two, you have lots of users, and you want to write a software to examine each individual of your customer‘s accounts, and for each account, decide whether or not the account has been hacked or compromised. So, for each of these problems, should be they be treated as a classification problem, or as regression problem? When the video pauses, please use your mouse to select whichever of these four options on the left you think is the correct answer. So hopefully, you got that this is the answer. For problem one, I would treat this as a regression problem, because if I have, you know, thousands of items, well, I would probably just treat this as a real value, as a continuous value. And treat, therefore, the number of items I sell, as a continuous value. And for the second problem, I would treat that as a classification problem, because I might say, set the value I want to predict with zero, to denote the account has not been hacked. And set the value one to denote an account that has been hacked into. So just like, you know, breast cancer, is, zero is benign, one is malignant. So, I might set this be zero or one depending on whether it‘s been hacked, and have an algorithm try to predict each one of these two discrete values. And because there‘s a small number of discrete values, I would therefore treat it as a classification problem.

So, that‘s it for supervised learning, and in the next video (article) I‘ll talk about unsupervised learning which is the other major category of learning algorithms.

<end>

原文地址:https://www.cnblogs.com/wangcaiqi/p/11792125.html

时间: 2024-10-14 05:21:14

Introduction - Supervised Learning的相关文章

Machine Learning Algorithms Study Notes(2)--Supervised Learning

Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 2    Supervised Learning    3 2.1    Perceptron Learning Algorithm (PLA)    3 2.1.1    PLA -- "知错能改"演算法    4 2.2    Linear Regression    6 2.2.1    线性回归模型    6 2.2.2    最小二乘法( le

Introduction to Learning to Trade with Reinforcement Learning

http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/ The academic Deep Learning research community has largely stayed away from the financial markets. Maybe that's because the finance industry has a bad reputation,

1. Supervised Learning - Linear Regression

Linear Regression线性回归 Notation 给定一个样本集T 样本总数为m 每个样本记做 其中为输入变量,也称为特征变量:为我们要预测的输出变量,也称为目标变量 表示第个样本. 问题描述 给定一个样本集,学习一个函数 使得是对相应y的一个好的预测. 因为某些历史原因,h被称为假设(hypothesis). 整个过程如下图所示: 如果我们想要预测的目标变量是连续值,称为回归问题(regression): 当目标变量是少数离散值时,称为分类问题(classification). 如

(转载)[机器学习] Coursera ML笔记 - 监督学习(Supervised Learning) - Representation

[机器学习] Coursera ML笔记 - 监督学习(Supervised Learning) - Representation http://blog.csdn.net/walilk/article/details/50922854

【转载】Torch7 教程 Supervised Learning CNN

Torch7 教程 Supervised Learning CNN 分类:             机器学习              2014-08-08 15:59     1426人阅读     评论(0)     收藏     举报 cnnbpdeep learning 全部代码放在:https://github.com/guoyilin/CNN_Torch7 在搭建好Torch7之后,我们开始进行监督式Supervised Learning for CNN, Torch7提供了代码和一

2. Supervised Learning - Logistic Regression

Logistic Regression 逻辑回归解决问题类型 二分类问题(classification) Notation 给定一个样本集T 样本总数为m 每个样本记做 其中为输入变量,也称为特征变量:为我们要预测的输出变量,也称为目标变量 表示第个样本. Hypothesis的作用是,对于给定的输入变量,根据选择的参数计算输出变量=1的可能性 也就是 最终,当大于等于0.5时,预测y=1,当小于0.5时,预测y=0 假设是一下形式: 其中称为Logistic函数或者sigmoid函数,函数图象

A Brief Review of Supervised Learning

There are a number of algorithms that are typically used for system identification, adaptive control, adaptive signal processing, and machine learning. These algorithms all have particular similarities and differences. However, they all need to proce

Supervised Learning 的本质

转载自知乎:http://www.zhihu.com/question/23194489   但根据知乎惯例,答案还是要继续扩展的. 首先看什么是学习(learning)?一个成语就可概括:举一反三.此处以高考为例,高考的题目在上考场前我们未必做过,但在高中三年我们做过很多很多题目,懂解题方法,因此考场上面对陌生问题也可以算出答案.机器学习的思路也类似:我们能不能利用一些训练数据(已经做过的题),使机器能够利用它们(解题方法)分析未知数据(高考的题目)? 最简单也最普遍的一类机器学习算法就是分类

Stanford机器学习课程笔记(1) Supervised Learning and Unsupervised Learning

最近跟完了Andrew Ng的Machine Learning前三周的课,主要讲解了机器学习中的线性回归(Linear Regression)和逻辑回归(Logistic Regression)模型.在这里做一下记录. 另外推荐一本统计学习的书,<统计学习方法>李航,书短小精悍,才200多页,但是内容基本上覆盖了机器学习中的理论基础. 笔记<1> 主要了解一下监督学习和无监督学习 机器学习:是关于计算机基于数据 构建概率统计模型 并运用模型对数据进行预测与分析的一门学科. 机器学习