forked from fengdu78/Coursera-ML-AndrewNg-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8 - 7 - Multiclass Classification (4 min).srt
556 lines (445 loc) · 10.1 KB
/
8 - 7 - Multiclass Classification (4 min).srt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
1
00:00:00,320 --> 00:00:01,410
In this video, I want to
在这个视频中,我想
(字幕整理:中国海洋大学 黄海广,[email protected] )
2
00:00:01,490 --> 00:00:02,710
tell you about how to use neural
告诉你如何使用神经
3
00:00:02,900 --> 00:00:04,390
networks to do multiclass
网络做多类
4
00:00:04,830 --> 00:00:06,690
classification where we may
分类,我们可以
5
00:00:06,820 --> 00:00:07,840
have more than one category
有一个以上的类别
6
00:00:07,930 --> 00:00:09,600
that we're trying to distinguish amongst.
我们正在试图区分之间。
7
00:00:10,470 --> 00:00:12,280
In the last part of
中的最后部分
8
00:00:12,600 --> 00:00:13,920
the last video, where we
最后一个视频,在这里我们
9
00:00:14,400 --> 00:00:15,320
had the handwritten digit recognition
有手写数字识别
10
00:00:15,830 --> 00:00:17,030
problem, that was actually
的问题,这实际上是
11
00:00:17,700 --> 00:00:19,000
a multiclass classification problem because
因为多类分类问题
12
00:00:19,440 --> 00:00:20,730
there were ten possible categories
有十个可能的类别
13
00:00:21,550 --> 00:00:22,820
for recognizing the digits from
从认识数字
14
00:00:23,040 --> 00:00:23,980
0 through 9 and so, if
0至9,所以,如果
15
00:00:24,060 --> 00:00:25,430
you want us to fill you
您希望我们填补你
16
00:00:25,830 --> 00:00:27,840
in on the details of how to do that.
在关于如何做到这一点的细节。
17
00:00:30,410 --> 00:00:31,870
The way we do multiclass classification
我们做的多类分类的方法
18
00:00:32,990 --> 00:00:34,380
in a neural network is essentially
在一个神经网络本质上是
19
00:00:35,060 --> 00:00:37,600
an extension of the one versus all method.
一个与所有方法的延伸。
20
00:00:38,610 --> 00:00:39,650
So, let's say that we
所以,让我们说,我们
21
00:00:39,790 --> 00:00:41,660
have a computer vision example,
有计算机视觉的例子,
22
00:00:42,630 --> 00:00:43,810
where instead of just trying
在那里,而不是只是想
23
00:00:44,010 --> 00:00:46,170
to recognize cars as in
认识到汽车在
24
00:00:46,310 --> 00:00:47,290
the original example that I started off
那我开始了最初的例子
25
00:00:47,470 --> 00:00:48,670
with, but let's say that
用,但让我们说,
26
00:00:49,060 --> 00:00:51,380
we're trying to recognize, you know, four
我们试图认识,你知道,四
27
00:00:51,510 --> 00:00:52,820
categories of objects and given
对象的类别和特定
28
00:00:53,030 --> 00:00:53,900
an image we want to
我们想要的图像
29
00:00:54,100 --> 00:00:56,360
decide if it is a pedestrian, a car, a motorcycle or a truck.
决定是否有行人,汽车,摩托车或卡车。
30
00:00:57,200 --> 00:00:58,750
If that's the case, what
如果是这样的话,有什么
31
00:00:58,920 --> 00:01:00,480
we would do is we would
我们会做的是,我们会
32
00:01:00,970 --> 00:01:02,820
build a neural network with four
建立一个神经网络与四
33
00:01:03,160 --> 00:01:04,500
output units so that
输出单元,使得
34
00:01:04,710 --> 00:01:08,110
our neural network now outputs a vector of four numbers.
我们的神经网络现在输出四个数字的向量。
35
00:01:09,110 --> 00:01:10,450
So, the output now is actually
所以,现在输出实际上是
36
00:01:11,170 --> 00:01:11,840
needing to be a vector of four
无需是四的矢量
37
00:01:12,070 --> 00:01:13,300
numbers and what we're
数字和我们在做什么
38
00:01:13,540 --> 00:01:14,400
going to try to do is
要尝试做的是
39
00:01:14,780 --> 00:01:16,680
get the first output unit
获得第一输出单元
40
00:01:17,180 --> 00:01:18,840
to classify: is the
分类:是
41
00:01:19,160 --> 00:01:20,650
image a pedestrian, yes or no.
图像中的行人,yes或no。
42
00:01:21,200 --> 00:01:24,530
The second unit to classify: is the image a car, yes or no.
第二个单元进行分类:是图像一辆车,是或否。
43
00:01:25,110 --> 00:01:26,880
This unit to classify: is the
本单元进行分类:是
44
00:01:27,130 --> 00:01:29,150
image a motorcycle, yes or
像摩托车,或者是
45
00:01:29,230 --> 00:01:30,460
no, and this would classify:
没有,而这将分类:
46
00:01:30,930 --> 00:01:32,930
is the image a truck, yes or no.
是图像卡车,yes或no。
47
00:01:33,720 --> 00:01:35,730
And thus, when the image
因而,当图像
48
00:01:36,390 --> 00:01:37,630
is of a pedestrian, we
是一行人,我们
49
00:01:37,820 --> 00:01:38,930
would ideally want the network
在理想情况下希望网络
50
00:01:39,410 --> 00:01:40,140
to output 1, 0, 0, 0,
到输出1,0,0,0,
51
00:01:40,250 --> 00:01:41,260
when it is a
当它是一个
52
00:01:41,520 --> 00:01:42,310
car we want it to output
车上我们希望它输出
53
00:01:42,750 --> 00:01:43,530
0, 1, 0, 0, when this
0,1,0,0,当该
54
00:01:43,840 --> 00:01:45,960
is a motorcycle, we get it to or rather, we want
被一辆摩托车,我们得到它或者说,我们要
55
00:01:46,390 --> 00:01:47,460
it to output 0, 0,
它输出到0,0,
56
00:01:47,580 --> 00:01:48,970
1, 0 and so on.
1,0等。
57
00:01:50,750 --> 00:01:51,880
So this is just like
因此,这就像
58
00:01:52,270 --> 00:01:53,690
the "one versus all" method
“一对所有”的方法
59
00:01:54,190 --> 00:01:55,520
that we talked about when we
我们谈到我们时
60
00:01:55,680 --> 00:01:58,120
were describing logistic regression, and
被描述logistic回归,和
61
00:01:58,320 --> 00:02:00,480
here we have essentially four logistic
在这里,我们有四个基本的逻辑
62
00:02:01,290 --> 00:02:03,100
regression classifiers, each of
回归分类器,每个
63
00:02:03,260 --> 00:02:04,800
which is trying to recognize one
这是试图承认一个
64
00:02:05,000 --> 00:02:06,780
of the four classes that
四班的那
65
00:02:06,940 --> 00:02:08,830
we want to distinguish amongst.
我们要区分之间。
66
00:02:09,540 --> 00:02:10,780
So, rearranging the slide of
因此,重新排列幻灯片
67
00:02:10,860 --> 00:02:12,130
it, here's our neural network
它,这里是我们的神经网络
68
00:02:12,540 --> 00:02:14,070
with four output units and those
有四个输出单元和那些
69
00:02:14,330 --> 00:02:15,510
are what we want h
是我们想要的?
70
00:02:15,670 --> 00:02:16,790
of x to be when we
x的是,当我们
71
00:02:16,990 --> 00:02:18,930
have the different images, and
有不同的图像,并
72
00:02:19,580 --> 00:02:20,860
the way we're going to represent the
我们要代表的方式
73
00:02:21,110 --> 00:02:22,690
training set in these settings
培训在这些设置中设置
74
00:02:23,260 --> 00:02:24,670
is as follows. So, when we have
如下。所以,当我们有
75
00:02:24,890 --> 00:02:26,170
a training set with different images
训练集与不同的图像
76
00:02:27,350 --> 00:02:28,990
of pedestrians, cars, motorcycles and
的行人,汽车,摩托车及
77
00:02:29,260 --> 00:02:30,450
trucks, what we're going
卡车,我们要去
78
00:02:30,510 --> 00:02:31,940
to do in this example is
做在这个例子中是
79
00:02:32,190 --> 00:02:34,580
that whereas previously we had
而那之前我们有
80
00:02:34,990 --> 00:02:36,780
written out the labels as
写出来的标签作为
81
00:02:37,040 --> 00:02:38,320
y being an integer from
y是整数
82
00:02:38,710 --> 00:02:42,180
1, 2, 3 or 4. Instead of
1,2,3或4。相反的
83
00:02:42,280 --> 00:02:44,210
representing y this way,
代表?这样一来,
84
00:02:44,890 --> 00:02:46,340
we're going to instead represent y
我们要代替代表?
85
00:02:47,050 --> 00:02:49,400
as follows: namely Yi
如下:即易
86
00:02:54,850 --> 00:02:55,230
will be either 1, 0, 0, 0
将是1,0,0,0
87
00:02:55,230 --> 00:02:57,040
or 0, 1, 0, 0 or 0, 0, 1, 0 or 0, 0, 0, 1 depending on what the
或0,1,0,0或0,0,1,0或0,0,0,1,取决于什么样的
88
00:02:57,490 --> 00:02:59,100
corresponding image Xi is.
相应的图像Xi为。
89
00:02:59,410 --> 00:03:00,700
And so one training example
等一训练实例
90
00:03:01,230 --> 00:03:03,090
will be one pair Xi colon Yi
将一对结肠熙怡
91
00:03:04,530 --> 00:03:06,340
where Xi is an image with, you
其中Xi是一个形象,你
92
00:03:06,440 --> 00:03:08,000
know one of the four objects and
知道有四个对象,并
93
00:03:08,170 --> 00:03:09,640
Yi will be one of these vectors.
易将这些载体之一。
94
00:03:10,970 --> 00:03:12,020
And hopefully, we can find
并希望,我们可以找到
95
00:03:12,420 --> 00:03:13,670
a way to get our
一种方式来获得我们
96
00:03:14,020 --> 00:03:15,100
Neural Networks to output some
神经网络的输出部分
97
00:03:15,290 --> 00:03:16,480
value. So, the h of x
值。因此,x的?
98
00:03:17,310 --> 00:03:20,360
is approximately y and
大约是y和
99
00:03:20,550 --> 00:03:22,000
both h of x and Yi,
x和毅小时,
100
00:03:22,600 --> 00:03:23,770
both of these are going
这两个要
101
00:03:24,020 --> 00:03:25,170
to be in our example,
要在我们的例子中,
102
00:03:26,060 --> 00:03:28,700
four dimensional vectors when we have four classes.
当我们有四个类四维向量。
103
00:03:31,810 --> 00:03:33,020
So, that's how you
所以,这是你如何
104
00:03:33,170 --> 00:03:34,830
get neural network to do multiclass classification.
得到的神经网络做多类分类。
105
00:03:36,290 --> 00:03:37,780
This wraps up our discussion on
这个部分是我们的讨论
106
00:03:38,050 --> 00:03:39,620
how to represent Neural Networks
如何表示神经网络
107
00:03:40,120 --> 00:03:41,620
that is on our hypotheses representation.
这是对我们的假设表示。
108
00:03:42,780 --> 00:03:44,180
In the next set of videos, let's
在下一组的视频,让我们
109
00:03:44,690 --> 00:03:45,830
start to talk about how take
开始谈论如何利用
110
00:03:45,990 --> 00:03:47,360
a training set and how to
训练集,以及如何
111
00:03:47,570 --> 00:03:49,970
automatically learn the parameters of the neural network.
自动学习神经网络的参数。