Softmax回归
From Ufldl
(→6) |
|||
Line 741: | Line 741: | ||
于是,将<math>\theta_2-\theta_1</math>用<math>\theta'</math>来表示,我们发现softmax回归预测其中一个类别的概率为 <math>\frac{1}{ 1 + e^{ (\theta')^T x^{(i)} } }</math>,另一个类别的概率为<math>1 - \frac{1}{ 1 + e^{ (\theta')^T x^{(i)} } }</math>,这与 logistic回归是一致的。 | 于是,将<math>\theta_2-\theta_1</math>用<math>\theta'</math>来表示,我们发现softmax回归预测其中一个类别的概率为 <math>\frac{1}{ 1 + e^{ (\theta')^T x^{(i)} } }</math>,另一个类别的概率为<math>1 - \frac{1}{ 1 + e^{ (\theta')^T x^{(i)} } }</math>,这与 logistic回归是一致的。 | ||
- | == | + | ==Softmax 回归 vs. k 个二元分类器 Softmax Regression vs. k Binary Classifiers == |
+ | |||
+ | '''原文''': | ||
+ | |||
+ | Suppose you are working on a music classification application, and there are | ||
+ | <math>k</math> types of music that you are trying to recognize. Should you use a | ||
+ | softmax classifier, or should you build <math>k</math> separate binary classifiers using | ||
+ | logistic regression? | ||
+ | |||
+ | '''译文''': | ||
+ | |||
+ | |||
+ | 如果你在开发一个音乐分类的应用,需要对<math>k</math>种类型的音乐进行分类,那么是选择softmax回归直接进行多分类,还是使用 logistic回归进行二分类再进行组合呢? | ||
+ | |||
+ | |||
+ | '''一审''': | ||
+ | |||
+ | 如果你在开发一个音乐分类的应用,需要对<math>k</math>种类型的音乐进行识别,那么是选择使用softmax分类器呢,还是使用 logistic回归算法去建立 <math>k</math>个分离的二元分类器呢? | ||
+ | |||
+ | '''原文''': | ||
+ | |||
+ | |||
+ | This will depend on whether the four classes are ''mutually exclusive.'' For example, | ||
+ | if your four classes are classical, country, rock, and jazz, then assuming each | ||
+ | of your training examples is labeled with exactly one of these four class labels, | ||
+ | you should build a softmax classifier with <math>k=4</math>. | ||
+ | (If there're also some examples that are none of the above four classes, | ||
+ | then you can set <math>k=5</math> in softmax regression, and also have a fifth, "none of the above," class.) | ||
+ | |||
+ | |||
+ | '''译文''': | ||
+ | |||
+ | 这一选择取决于你的类别之间是否互斥,例如,如果你有四个类别的音乐,分别为:古典音乐、乡村音乐、摇滚乐和爵士乐,那么你可以假设每个训练样本只会被打上一个标签(即:一首歌只能属于这四种音乐类型的其中一种),此时你应该使用类别数 <math>k=4</math>的softmax回归。(如果在你的数据集中,有的歌曲不属于以上四类的其中任何一类,那么你可以设置一个类别叫做“其他”,并将类别数 <math>k</math>设为5。) | ||
+ | |||
+ | '''一审''': | ||
+ | |||
+ | 这一选择取决于你的类别之间是否互斥,例如,如果你有四个音乐类别,分别为:古典音乐、乡村音乐、摇滚乐和爵士乐,那么你可以假设每个训练样本只会被打上一个标签,此时你应该使用类别数<math>k=4</math>的softmax分类器。(如果在你的数据集中,有的歌曲不属于以上四类的其中任何一类,那么你可以将类别数<math>k</math>设为5,并且设置第五个类别叫做“以上皆否”,) | ||
+ | |||
+ | '''原文''': | ||
+ | |||
+ | |||
+ | If however your categories are has_vocals, dance, soundtrack, pop, then the | ||
+ | classes are not mutually exclusive; for example, there can be a piece of pop | ||
+ | music that comes from a soundtrack and in addition has vocals. In this case, it | ||
+ | would be more appropriate to build 4 binary logistic regression classifiers. | ||
+ | This way, for each new musical piece, your algorithm can separately decide whether | ||
+ | it falls into each of the four categories. | ||
+ | |||
+ | '''译文''': | ||
+ | 如果你的四个类别如下:声乐作品、舞曲、影视原声带、流行歌曲。我们可以看出这些类别之间并不是互斥的:一首歌曲可以是影视原声带,同时也是声乐作品。这种情况下,使用4个二分类的logistic 回归更为合适。这样,对于每一首歌,我们的算法可以分别判断它是否属于各个类别。 | ||
+ | |||
+ | '''一审''': | ||
+ | 如果你的四个类别如下:人声音乐、舞曲、影视原声、流行歌曲,那么这些类别之间并不是互斥的。例如:一首歌曲可以来源于影视原声,同时也包含人声 。这种情况下,使用4个二分类的logistic回归分类器更为合适。这样,对于每个新的音乐作品 ,我们的算法可以分别判断它是否属于各个类别。 | ||
+ | |||
+ | |||
+ | '''原文''': | ||
+ | |||
+ | |||
+ | Now, consider a computer vision example, where you're trying to classify images into | ||
+ | three different classes. (i) Suppose that your classes are indoor_scene, | ||
+ | outdoor_urban_scene, and outdoor_wilderness_scene. Would you use softmax regression | ||
+ | or three logistic regression classifiers? (ii) Now suppose your classes are | ||
+ | indoor_scene, black_and_white_image, and image_has_people. Would you use softmax | ||
+ | regression or multiple logistic regression classifiers? | ||
+ | |||
+ | '''译文''': | ||
+ | |||
+ | 现在我们来看一个计算视觉领域的例子,你的任务是将图像分到三个类别中。 (i) 假设这三个类别分别是:室内场景、城区场景、野外场景。你会使用 softmax回归还是3 个logistic回归呢? (ii) 假设这三个类别分别是室内场景、黑白图片、包含人物的图片,你又会如何选择分类模型? | ||
+ | |||
+ | '''一审''': | ||
+ | |||
+ | 现在我们来看一个计算视觉领域的例子,你的任务是将图像分到三个不同类别中。(i)假设这三个类别分别是:室内场景、户外城区场景、户外荒野场景。你会使用sofmax回归还是 3个logistic 回归分类器呢? (ii) 现在假设这三个类别分别是室内场景、黑白图片、包含人物的图片,你又会选择softmax回归还是多个logistic回归分类器呢? | ||
+ | |||
+ | '''原文''': | ||
+ | |||
+ | In the first case, the classes are mutually exclusive, so a softmax regression | ||
+ | classifier would be appropriate. In the second case, it would be more appropriate to build | ||
+ | three separate logistic regression classifiers. | ||
+ | |||
+ | '''译文''': | ||
+ | |||
+ | 在第一个例子中,三个类别是互斥的,因此选择softmax回归更合适。而在第二个例子则应该选择 logistic回归。 | ||
+ | |||
+ | '''一审''': | ||
+ | |||
+ | 在第一个例子中,三个类别是互斥的,因此更适于选择softmax回归分类 。而在第二个例子中,建立三个独立的 logistic回归分类器更加合适。 |