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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
WEBVTT Kind: captions; Language: en-US

NOTE
Created on 2024-02-07T20:56:18.4162344Z by ClassTranscribe

00:01:04.700 --> 00:01:05.450
All right.

00:01:05.450 --> 00:01:06.810
Good morning, everybody.

00:01:07.920 --> 00:01:08.950
Hope you're doing well.

00:01:10.010 --> 00:01:10.940
So.

00:01:11.010 --> 00:01:14.260
And so I'll jump into it.

00:01:15.610 --> 00:01:16.000
All right.

00:01:16.000 --> 00:01:18.966
So previously we learned about a lot of

00:01:18.966 --> 00:01:21.260
different individual models, logistic

00:01:21.260 --> 00:01:23.000
regression, Keenan and so on.

00:01:23.000 --> 00:01:25.140
We also learned about trees that are

00:01:25.140 --> 00:01:27.683
able to learn features and split the

00:01:27.683 --> 00:01:29.410
feature space into different chunks and

00:01:29.410 --> 00:01:31.170
then make decisions and those different

00:01:31.170 --> 00:01:32.500
parts of the feature space.

00:01:33.300 --> 00:01:34.980
And then in the last class we learned

00:01:34.980 --> 00:01:37.884
about the bias variance tradeoff, that

00:01:37.884 --> 00:01:41.310
you can have a very complex classifier

00:01:41.310 --> 00:01:42.856
that requires a lot of data to learn

00:01:42.856 --> 00:01:44.919
and that might have low bias that can

00:01:44.920 --> 00:01:47.190
fit the training data really well, but

00:01:47.190 --> 00:01:48.720
high variance that you might get

00:01:48.720 --> 00:01:50.240
different classifiers with different

00:01:50.240 --> 00:01:50.980
samples of data.

00:01:51.730 --> 00:01:53.865
Or you can have a low bias.

00:01:53.865 --> 00:01:56.170
Or you can have a high bias, low

00:01:56.170 --> 00:01:59.429
variance classifier, a short tree, or a

00:01:59.430 --> 00:02:01.390
linear model that might not be able to

00:02:01.390 --> 00:02:03.430
fit the training data perfectly, but

00:02:03.430 --> 00:02:05.648
we'll do similarly on the test data to

00:02:05.648 --> 00:02:06.380
the training data.

00:02:07.250 --> 00:02:10.670
And then the escape of that is using.

00:02:10.670 --> 00:02:12.440
So usually you have this tradeoff where

00:02:12.440 --> 00:02:14.020
you have to choose one or the other,

00:02:14.020 --> 00:02:16.880
but ensembles are able to escape that

00:02:16.880 --> 00:02:19.360
tradeoff by combining multiple

00:02:19.360 --> 00:02:21.390
classifiers to either reduce the

00:02:21.390 --> 00:02:24.070
variance of each or reduce the bias of

00:02:24.070 --> 00:02:24.540
them.

00:02:26.500 --> 00:02:30.250
So this is so we also we talked

00:02:30.250 --> 00:02:32.400
particularly about boosted, boosted

00:02:32.400 --> 00:02:34.390
trees and random forests, which are two

00:02:34.390 --> 00:02:37.180
of the most powerful and widely useful

00:02:37.180 --> 00:02:40.130
classifiers and regressors and machine

00:02:40.130 --> 00:02:40.870
learning.

00:02:40.990 --> 00:02:43.740
The other is what we're starting to get

00:02:43.740 --> 00:02:44.197
into.

00:02:44.197 --> 00:02:46.800
We're starting to work our way towards

00:02:46.800 --> 00:02:50.030
neural networks, which as you know is

00:02:50.030 --> 00:02:52.300
like the is the dominant approach right

00:02:52.300 --> 00:02:53.270
now in machine learning.

00:02:54.260 --> 00:02:56.530
But before we get there, I want to

00:02:56.530 --> 00:03:00.630
introduce one more individual model

00:03:00.630 --> 00:03:02.630
which is the support vector machine.

00:03:03.410 --> 00:03:05.255
Support vector machines or SVM.

00:03:05.255 --> 00:03:06.790
So usually you'll just see people call

00:03:06.790 --> 00:03:08.660
it SVM without writing out the full

00:03:08.660 --> 00:03:08.940
name.

00:03:09.580 --> 00:03:11.652
They are developed in 1990s by Vapnik

00:03:11.652 --> 00:03:15.170
and his colleagues AT&T Bell Labs and

00:03:15.170 --> 00:03:16.870
it was based on statistical learning

00:03:16.870 --> 00:03:18.573
theory, so that their learning theory

00:03:18.573 --> 00:03:21.050
was actually developed by Vapnik and

00:03:21.050 --> 00:03:23.820
independently by others as early as the

00:03:23.820 --> 00:03:25.000
40s or 50s.

00:03:25.860 --> 00:03:28.020
But that led to the SVM algorithm in

00:03:28.020 --> 00:03:28.730
the 90s.

00:03:29.840 --> 00:03:32.780
And SVMS for a while were the most

00:03:32.780 --> 00:03:35.320
popular machine learning algorithm,

00:03:35.320 --> 00:03:37.740
mainly because they have a really good

00:03:37.740 --> 00:03:39.420
justification in terms of

00:03:39.420 --> 00:03:42.500
generalization, theory, theory and they

00:03:42.500 --> 00:03:44.820
can be optimized.

00:03:45.420 --> 00:03:49.000
And so for a while, people felt like

00:03:49.000 --> 00:03:51.100
Anna's were kind of a dead end.

00:03:51.900 --> 00:03:54.400
That's artificial neural networks are a

00:03:54.400 --> 00:03:56.117
dead end because they're a black box.

00:03:56.117 --> 00:03:57.216
They're hard to understand, they're

00:03:57.216 --> 00:03:59.980
hard to optimize, and VMS were able to

00:03:59.980 --> 00:04:02.780
get like similar performance, but are

00:04:02.780 --> 00:04:03.780
much better understood.

00:04:06.080 --> 00:04:08.110
So SVMS are kind of worth knowing and

00:04:08.110 --> 00:04:09.170
their own right?

00:04:09.170 --> 00:04:12.390
But actually the main reason that I'm

00:04:12.390 --> 00:04:15.440
decided to teach about SVMS is because

00:04:15.440 --> 00:04:17.320
there's a lot of other concepts

00:04:17.320 --> 00:04:19.710
associated with SVMS that are widely

00:04:19.710 --> 00:04:21.718
applicable that are worth knowing.

00:04:21.718 --> 00:04:24.245
So one is the generalization properties

00:04:24.245 --> 00:04:26.370
that they try to, for example, achieve

00:04:26.370 --> 00:04:27.240
a big margin.

00:04:27.240 --> 00:04:28.670
I'll explain what that means and.

00:04:29.460 --> 00:04:31.400
And have a decision that relies on

00:04:31.400 --> 00:04:33.700
limited training data, which is called

00:04:33.700 --> 00:04:35.250
structural risk minimization.

00:04:36.110 --> 00:04:38.560
Another is you can incorporate the idea

00:04:38.560 --> 00:04:40.800
of kernels, which is that you can

00:04:40.800 --> 00:04:44.670
define how 2 examples are similar and

00:04:44.670 --> 00:04:48.470
then use that as a basis of training a

00:04:48.470 --> 00:04:48.930
model.

00:04:49.660 --> 00:04:51.370
And related to that.

00:04:52.120 --> 00:04:54.940
We can see how you can formulate the

00:04:54.940 --> 00:04:56.600
same problem in different ways.

00:04:56.600 --> 00:04:59.560
So for SVMS, you can formulate it in

00:04:59.560 --> 00:05:01.550
what's called the primal, which just

00:05:01.550 --> 00:05:04.050
means that for a linear model you're

00:05:04.050 --> 00:05:06.259
saying that the model is a of all the

00:05:06.260 --> 00:05:07.030
features.

00:05:07.030 --> 00:05:09.670
Or you can formulate it in the dual,

00:05:09.670 --> 00:05:12.180
which is that you say that the weights

00:05:12.180 --> 00:05:14.485
are actually a sum of all the training

00:05:14.485 --> 00:05:16.220
examples, a of all the training

00:05:16.220 --> 00:05:16.509
examples.

00:05:17.300 --> 00:05:18.340
And I think it's just kind of

00:05:18.340 --> 00:05:19.230
interesting that.

00:05:20.170 --> 00:05:21.910
You can show that for many linear

00:05:21.910 --> 00:05:24.010
models, we tend to think of them as

00:05:24.010 --> 00:05:26.150
like it's that the linear model

00:05:26.150 --> 00:05:27.780
corresponds to feature importance, and

00:05:27.780 --> 00:05:28.940
you're learning a value for each

00:05:28.940 --> 00:05:33.680
feature, which is true, but the optimal

00:05:33.680 --> 00:05:36.570
linear model can often be expressed as

00:05:36.570 --> 00:05:38.575
just a combination of the training

00:05:38.575 --> 00:05:39.740
examples directly a weighted

00:05:39.740 --> 00:05:41.250
combination of the training examples.

00:05:41.870 --> 00:05:43.770
So it gives an interesting perspective

00:05:43.770 --> 00:05:44.660
I think.

00:05:44.660 --> 00:05:46.630
And then finally there's an

00:05:46.630 --> 00:05:49.240
optimization method for SVMS that was

00:05:49.240 --> 00:05:52.430
proposed that is called sub gradient,

00:05:52.430 --> 00:05:54.520
subgradient method and.

00:05:55.260 --> 00:05:57.150
Particularly it's called the general

00:05:57.150 --> 00:05:58.680
method is called sarcastic gradient

00:05:58.680 --> 00:06:01.780
descent and this is how optimization is

00:06:01.780 --> 00:06:03.380
done for neural networks.

00:06:03.380 --> 00:06:05.450
So I wanted to introduce it in the case

00:06:05.450 --> 00:06:08.310
of the SVMS where it's a little bit

00:06:08.310 --> 00:06:10.530
simpler before I get into.

00:06:11.480 --> 00:06:15.050
Perceptrons and MLPS multilayer

00:06:15.050 --> 00:06:15.780
perceptrons.

00:06:18.250 --> 00:06:21.980
So there's so there's three parts of

00:06:21.980 --> 00:06:22.620
this lecture.

00:06:22.620 --> 00:06:24.290
First, I'm going to talk about linear

00:06:24.290 --> 00:06:24.850
SVMS.

00:06:25.560 --> 00:06:27.660
And then I'm going to talk about

00:06:27.660 --> 00:06:29.900
kernels and nonlinear SVMS.

00:06:30.550 --> 00:06:33.000
And then finally the SVM optimization

00:06:33.000 --> 00:06:34.010
and.

00:06:34.700 --> 00:06:36.560
I might not get to the third part

00:06:36.560 --> 00:06:39.160
today, we'll see, but I don't want to

00:06:39.160 --> 00:06:40.395
rush it too much.

00:06:40.395 --> 00:06:43.090
But even if not, this leads naturally

00:06:43.090 --> 00:06:45.040
into the next lecture, which would

00:06:45.040 --> 00:06:47.220
basically be SGD on perceptrons, so.

00:06:51.360 --> 00:06:55.065
Alright, so SVMS are kind of pose a

00:06:55.065 --> 00:06:56.390
different answer to what's the best

00:06:56.390 --> 00:06:57.710
linear classifier.

00:06:57.710 --> 00:07:00.625
As we discussed previously, if you have

00:07:00.625 --> 00:07:03.260
a set of linearly separated data, these

00:07:03.260 --> 00:07:05.540
Red X's and Green OS, then there's

00:07:05.540 --> 00:07:06.939
actually a bunch of different linear

00:07:06.940 --> 00:07:09.610
models that could separate the X's from

00:07:09.610 --> 00:07:10.170
the O's.

00:07:11.540 --> 00:07:13.860
So logistic regression has one way of

00:07:13.860 --> 00:07:16.240
choosing the best model, which is

00:07:16.240 --> 00:07:18.020
you're maximizing the expected log

00:07:18.020 --> 00:07:20.564
likelihood of the labels given the

00:07:20.564 --> 00:07:20.934
data.

00:07:20.934 --> 00:07:23.620
So for given some boundary, it implies

00:07:23.620 --> 00:07:25.414
some probability for each of the data

00:07:25.414 --> 00:07:25.612
points.

00:07:25.612 --> 00:07:26.990
The data points that are really far

00:07:26.990 --> 00:07:29.260
from the boundary have like a really

00:07:29.260 --> 00:07:30.970
high confidence, and if that's correct,

00:07:30.970 --> 00:07:32.962
it means they have a low loss, and

00:07:32.962 --> 00:07:36.025
labels that are on the wrong side of

00:07:36.025 --> 00:07:37.475
the boundary or close to the boundary

00:07:37.475 --> 00:07:38.650
have a higher loss.

00:07:39.880 --> 00:07:42.870
And so as a result of that objective,

00:07:42.870 --> 00:07:45.580
the logistic regression depends on all

00:07:45.580 --> 00:07:46.760
the training examples.

00:07:46.760 --> 00:07:48.550
Even examples that are very confidently

00:07:48.550 --> 00:07:51.270
correct will contribute a little bit to

00:07:51.270 --> 00:07:53.470
the loss of the optimization.

00:07:54.980 --> 00:07:57.210
On the other hand, SVM makes a very

00:07:57.210 --> 00:07:59.010
different kind of decision.

00:07:59.010 --> 00:08:02.455
So SVM the goal is to make all of the

00:08:02.455 --> 00:08:04.545
examples at least minimally confident.

00:08:04.545 --> 00:08:06.800
So you want all the examples to be at

00:08:06.800 --> 00:08:08.560
least some distance from the boundary.

00:08:09.770 --> 00:08:11.430
And then the decision is based on a

00:08:11.430 --> 00:08:14.040
minimum set of examples, so that even

00:08:14.040 --> 00:08:15.875
if you were to remove a lot of the

00:08:15.875 --> 00:08:17.243
examples that want to actually change

00:08:17.243 --> 00:08:17.929
the decision.

00:08:22.350 --> 00:08:24.840
So this is so there's a little bit of

00:08:24.840 --> 00:08:26.980
terminology that comes with SVMS that's

00:08:26.980 --> 00:08:29.860
worth being careful about.

00:08:30.600 --> 00:08:31.960
One is the margin.

00:08:31.960 --> 00:08:34.680
So the margin is just the distance from

00:08:34.680 --> 00:08:36.950
the boundary of an example.

00:08:36.950 --> 00:08:39.530
So in this case this is an SVM fit to

00:08:39.530 --> 00:08:43.030
these examples and this is like the

00:08:43.030 --> 00:08:45.479
minimum margin of any of the examples.

00:08:45.480 --> 00:08:47.488
But the margin is just the distance

00:08:47.488 --> 00:08:49.330
from this boundary in the correct

00:08:49.330 --> 00:08:49.732
direction.

00:08:49.732 --> 00:08:53.180
So if an ex were over here, it would

00:08:53.180 --> 00:08:55.985
have like a negative margin because it

00:08:55.985 --> 00:08:57.629
would be on the wrong side of the

00:08:57.629 --> 00:09:00.130
boundary and if X is really far in this

00:09:00.130 --> 00:09:00.450
direction.

00:09:00.510 --> 00:09:04.050
Then it has a high positive margin.

00:09:04.900 --> 00:09:07.935
And the margin is normalized by the

00:09:07.935 --> 00:09:09.380
weight length.

00:09:09.380 --> 00:09:11.490
This is the L2 length of the weight.

00:09:13.340 --> 00:09:17.530
Because if you were if the data is

00:09:17.530 --> 00:09:20.140
linearly separable and you arbitrarily

00:09:20.140 --> 00:09:21.940
if you just like increase W if you

00:09:21.940 --> 00:09:26.440
multiply it by 1000 then this then the

00:09:26.440 --> 00:09:29.155
score of each data point will just

00:09:29.155 --> 00:09:31.640
linearly increase with the length of W

00:09:31.640 --> 00:09:33.329
so you need to normalize it by W.

00:09:34.280 --> 00:09:36.960
So mathematically the margin is just.

00:09:36.960 --> 00:09:40.170
This is the linear model W transpose X

00:09:40.170 --> 00:09:42.920
of weights times X plus some bias term

00:09:42.920 --> 00:09:43.150
B.

00:09:44.460 --> 00:09:47.820
I just want to note that bias term like

00:09:47.820 --> 00:09:50.131
in this context is not the same as

00:09:50.131 --> 00:09:51.756
classifier bias like.

00:09:51.756 --> 00:09:54.440
Classifier bias means that you can't

00:09:54.440 --> 00:09:57.110
fit like some kinds of decision

00:09:57.110 --> 00:10:00.000
boundaries, but the bias term is just

00:10:00.000 --> 00:10:02.260
adding a constant to your prediction.

00:10:04.440 --> 00:10:06.470
So we have a linear model here.

00:10:06.470 --> 00:10:07.605
It gets multiplied by Y.

00:10:07.605 --> 00:10:09.420
So in other words, if this is positive

00:10:09.420 --> 00:10:10.930
then I made a correct decision.

00:10:11.510 --> 00:10:13.660
And if this is negative, then I made an

00:10:13.660 --> 00:10:14.660
incorrect decision.

00:10:14.660 --> 00:10:17.280
If Y is -, 1 for example, but the model

00:10:17.280 --> 00:10:20.840
predicts A2, then this will be -, 2 and

00:10:20.840 --> 00:10:22.710
that's that means that I'm like kind of

00:10:22.710 --> 00:10:24.010
confidently incorrect.

00:10:26.690 --> 00:10:27.530
OK.

00:10:27.530 --> 00:10:30.575
And then the second term is a support

00:10:30.575 --> 00:10:32.490
vector, so support vector machines that

00:10:32.490 --> 00:10:33.740
has it in the title.

00:10:33.740 --> 00:10:36.370
A support vector is an example that

00:10:36.370 --> 00:10:41.290
lies on the margin of 1, so on that

00:10:41.290 --> 00:10:42.250
minimum margin.

00:10:43.100 --> 00:10:45.480
So the points that lie within a margin

00:10:45.480 --> 00:10:47.200
of one are the support vectors, and

00:10:47.200 --> 00:10:48.800
actually the decision only depends on

00:10:48.800 --> 00:10:50.310
those support vectors at the end.

00:10:53.170 --> 00:10:56.140
So the objective of the SVM is to try

00:10:56.140 --> 00:10:59.080
to minimize the sum of squared weights

00:10:59.080 --> 00:11:01.970
while preserving a margin of 1 S you

00:11:01.970 --> 00:11:05.340
could also cast it as that your weight

00:11:05.340 --> 00:11:06.930
vector is constrained to be unit

00:11:06.930 --> 00:11:08.515
length, but you want to maximize the

00:11:08.515 --> 00:11:08.770
margin.

00:11:08.770 --> 00:11:11.590
Those are just equivalent formulations.

00:11:13.240 --> 00:11:15.740
So here's so here's an example of an

00:11:15.740 --> 00:11:16.640
optimized model.

00:11:16.640 --> 00:11:18.560
Now here I added like a big probability

00:11:18.560 --> 00:11:21.470
mass of X's over here, and note that

00:11:21.470 --> 00:11:23.450
the SVM doesn't care about them at all.

00:11:23.450 --> 00:11:25.680
It only cares about these examples that

00:11:25.680 --> 00:11:27.720
are really close to this decision

00:11:27.720 --> 00:11:29.769
boundary between the O's and the ex's.

00:11:30.420 --> 00:11:35.060
So these three examples that are an

00:11:35.060 --> 00:11:37.760
equidistant from the decision boundary

00:11:37.760 --> 00:11:39.717
have they have like determined the

00:11:39.717 --> 00:11:40.193
decision boundary.

00:11:40.193 --> 00:11:42.094
These are the X's that are closest to

00:11:42.094 --> 00:11:44.320
the O's and the O that's closest to the

00:11:44.320 --> 00:11:46.260
X's, while these ones that are have a

00:11:46.260 --> 00:11:48.280
higher margin have not influenced the

00:11:48.280 --> 00:11:48.960
decision boundary.

00:11:51.590 --> 00:11:55.200
In fact, if you have a two, if the data

00:11:55.200 --> 00:11:58.532
is linearly separable and you have two

00:11:58.532 --> 00:12:00.140
two-dimensional features like I have

00:12:00.140 --> 00:12:02.690
here, these are the features X1 and X2,

00:12:02.690 --> 00:12:04.580
then there will always be 3 support

00:12:04.580 --> 00:12:05.890
vectors.

00:12:05.890 --> 00:12:06.340
Question.

00:12:08.680 --> 00:12:10.170
So yeah, good question.

00:12:10.170 --> 00:12:12.900
So the decision boundary is if the

00:12:12.900 --> 00:12:15.207
features are on one side of the

00:12:15.207 --> 00:12:16.656
boundary, then it's going to be one

00:12:16.656 --> 00:12:18.155
class, and if they're on the other side

00:12:18.155 --> 00:12:19.718
of the boundary then it will be the

00:12:19.718 --> 00:12:20.210
other class.

00:12:21.130 --> 00:12:23.380
And in terms of the linear model, if

00:12:23.380 --> 00:12:26.850
you have your model is W transpose X +

00:12:26.850 --> 00:12:29.435
B, so it's like a of the features plus

00:12:29.435 --> 00:12:30.260
the bias term.

00:12:31.120 --> 00:12:33.030
The decision boundary is where that

00:12:33.030 --> 00:12:34.440
value is 0.

00:12:34.440 --> 00:12:37.610
So if this value W transpose X + B.

00:12:38.300 --> 00:12:40.460
Is greater than zero, then you're

00:12:40.460 --> 00:12:43.060
predicting that the label is 1, and if

00:12:43.060 --> 00:12:45.225
this is less than zero, then you're

00:12:45.225 --> 00:12:48.136
predicting that the label is -, 1, and

00:12:48.136 --> 00:12:49.990
if it's equal to 0, then you're right

00:12:49.990 --> 00:12:51.750
on the boundary of that decision.

00:12:52.590 --> 00:12:53.940
There's a help.

00:12:55.640 --> 00:12:56.310
Yeah.

00:13:03.470 --> 00:13:04.010
If.

00:13:04.090 --> 00:13:04.740
And.

00:13:05.910 --> 00:13:08.550
So if the so the decision boundary

00:13:08.550 --> 00:13:10.320
actually it kind of it's not shown

00:13:10.320 --> 00:13:11.390
here, but it also kind of as a

00:13:11.390 --> 00:13:11.910
direction.

00:13:12.590 --> 00:13:14.958
So if things are on one side of the

00:13:14.958 --> 00:13:16.490
boundary then they would be X's, and if

00:13:16.490 --> 00:13:17.600
they're on the other side of the

00:13:17.600 --> 00:13:18.740
boundary then they'd be OS.

00:13:20.890 --> 00:13:22.920
And the boundary is fit to this data,

00:13:22.920 --> 00:13:25.775
so it's solved for in a way that this

00:13:25.775 --> 00:13:26.620
is true.

00:13:29.100 --> 00:13:30.080
Question.

00:13:30.080 --> 00:13:30.830
So how?

00:13:31.830 --> 00:13:35.420
Will perform when two data set are

00:13:35.420 --> 00:13:37.020
merged with each other, like when

00:13:37.020 --> 00:13:40.300
they're not separated, separable,

00:13:40.300 --> 00:13:41.310
mostly separable.

00:13:41.560 --> 00:13:43.020
They have a lot of emerging.

00:13:43.020 --> 00:13:44.902
Yeah, I'll get to that.

00:13:44.902 --> 00:13:45.220
Yeah.

00:13:45.220 --> 00:13:46.500
For now, I'm just dealing with this

00:13:46.500 --> 00:13:48.410
separable case where they can be

00:13:48.410 --> 00:13:49.906
perfectly classified.

00:13:49.906 --> 00:13:53.510
So the linear logistic regression

00:13:53.510 --> 00:13:55.379
behaves differently because it wants,

00:13:55.380 --> 00:13:57.240
these are a lot of data points and they

00:13:57.240 --> 00:14:00.760
will all have some loss even if they're

00:14:00.760 --> 00:14:02.314
like further away than other data

00:14:02.314 --> 00:14:03.372
points from the boundary.

00:14:03.372 --> 00:14:05.230
And so it wants them all to be really

00:14:05.230 --> 00:14:06.770
far from the boundary so that they're

00:14:06.770 --> 00:14:08.390
not incurring a lot of loss in total.

00:14:09.260 --> 00:14:11.633
So the linear logistic regression will

00:14:11.633 --> 00:14:13.880
push the line push the decision

00:14:13.880 --> 00:14:16.139
boundary away from this cluster of X's,

00:14:16.140 --> 00:14:17.970
even if it means that it has to be

00:14:17.970 --> 00:14:19.810
closer to one of the other ex's.

00:14:20.810 --> 00:14:22.650
And in some sense, this is a reasonable

00:14:22.650 --> 00:14:25.260
thing to do, because it makes your

00:14:25.260 --> 00:14:27.210
improves your overall average

00:14:27.210 --> 00:14:29.010
confidence in the correct label.

00:14:29.740 --> 00:14:32.143
Your average correct log confidence to

00:14:32.143 --> 00:14:33.310
be precise.

00:14:33.310 --> 00:14:37.100
But in another sense it's not so good

00:14:37.100 --> 00:14:38.640
because if you're if at the end of the

00:14:38.640 --> 00:14:39.930
day you're trying to minimize your

00:14:39.930 --> 00:14:42.230
classification error, they're very well

00:14:42.230 --> 00:14:44.380
could be other ex's that are in the

00:14:44.380 --> 00:14:46.570
test data that are around this point,

00:14:46.570 --> 00:14:47.940
and some of them might end up on the

00:14:47.940 --> 00:14:49.040
wrong side of the boundary.

00:14:56.200 --> 00:14:59.150
So this is the basic idea of the SVM,

00:14:59.150 --> 00:15:01.870
and the reason that SVMS are so popular

00:15:01.870 --> 00:15:04.380
is because they have really good

00:15:04.380 --> 00:15:05.590
marginalization.

00:15:05.590 --> 00:15:07.550
I mean really good generalization

00:15:07.550 --> 00:15:09.130
guarantees.

00:15:10.130 --> 00:15:14.360
So there's like 2 main Principles, 2

00:15:14.360 --> 00:15:16.720
main reasons that they generalize, and

00:15:16.720 --> 00:15:18.380
again generalize means that they will

00:15:18.380 --> 00:15:20.470
perform similarly to the test data

00:15:20.470 --> 00:15:21.700
compared to the training data.

00:15:24.090 --> 00:15:26.030
One is that maximizing the margin.

00:15:26.030 --> 00:15:28.320
So if all the examples are far from the

00:15:28.320 --> 00:15:30.570
margin, then you can be confident that

00:15:30.570 --> 00:15:31.770
other samples from the same

00:15:31.770 --> 00:15:33.896
distribution are probably also going to

00:15:33.896 --> 00:15:35.600
be correct on the correct side of the

00:15:35.600 --> 00:15:36.010
boundary.

00:15:38.430 --> 00:15:41.410
The second thing is that it doesn't

00:15:41.410 --> 00:15:43.380
depend on a lot of training samples.

00:15:44.630 --> 00:15:48.810
So even if most of these X's and O's

00:15:48.810 --> 00:15:50.640
disappeared, as long as these three

00:15:50.640 --> 00:15:52.150
examples were here, you would end up

00:15:52.150 --> 00:15:53.270
fitting the same boundary.

00:15:54.170 --> 00:15:56.630
And so for example one way that you can

00:15:56.630 --> 00:16:00.110
measure the that you can get an

00:16:00.110 --> 00:16:02.830
estimate of your test error is to do

00:16:02.830 --> 00:16:04.120
leave one out cross validation.

00:16:04.120 --> 00:16:06.310
Which is when you remove one data point

00:16:06.310 --> 00:16:08.570
from the training set and then train a

00:16:08.570 --> 00:16:10.715
model and then test it on that left out

00:16:10.715 --> 00:16:12.370
point and then you keep on changing

00:16:12.370 --> 00:16:13.350
which point is left out.

00:16:13.960 --> 00:16:15.290
If you do leave one out cross

00:16:15.290 --> 00:16:17.370
validation on this, then if you leave

00:16:17.370 --> 00:16:19.286
out any of these points that are not on

00:16:19.286 --> 00:16:20.690
the margin, that you're going to get

00:16:20.690 --> 00:16:23.710
them correct, because the boundary will

00:16:23.710 --> 00:16:25.440
be defined by only these three points

00:16:25.440 --> 00:16:26.050
anyway.

00:16:26.050 --> 00:16:27.779
In other words, leaving out any of

00:16:27.779 --> 00:16:29.130
these points not on the margin won't

00:16:29.130 --> 00:16:31.840
change the boundary, and so if they're

00:16:31.840 --> 00:16:33.140
correct in training, they'll also be

00:16:33.140 --> 00:16:34.040
corrected in testing.

00:16:35.290 --> 00:16:36.780
So that leads to this.

00:16:36.850 --> 00:16:38.905
On this there's a.

00:16:38.905 --> 00:16:42.170
There's a proof here of the expected

00:16:42.170 --> 00:16:43.000
test error.

00:16:43.690 --> 00:16:45.425
A bound on the expected test error.

00:16:45.425 --> 00:16:47.120
So the expected test error will be no

00:16:47.120 --> 00:16:49.430
more than the percent of training

00:16:49.430 --> 00:16:51.360
samples that are support vectors.

00:16:51.360 --> 00:16:53.440
So in this case it would be 3 divided

00:16:53.440 --> 00:16:55.110
by the total number of training points.

00:16:56.250 --> 00:17:00.253
Or if it's or, it could be also smaller

00:17:00.253 --> 00:17:00.486
than.

00:17:00.486 --> 00:17:02.140
It will be smaller than the smallest of

00:17:02.140 --> 00:17:02.760
these.

00:17:03.910 --> 00:17:08.460
The D squared is like the smallest, the

00:17:08.460 --> 00:17:11.040
diameter of the smallest ball that

00:17:11.040 --> 00:17:11.470
contains.

00:17:11.470 --> 00:17:13.161
It's a square of the diameter of the

00:17:13.161 --> 00:17:14.370
smallest ball that contains all these

00:17:14.370 --> 00:17:14.730
points.

00:17:15.420 --> 00:17:16.620
Compared to the margin.

00:17:16.620 --> 00:17:18.853
So in other words, if the data, if the

00:17:18.853 --> 00:17:20.695
margin is like pretty big compared to

00:17:20.695 --> 00:17:22.340
the general variance of the data

00:17:22.340 --> 00:17:24.580
points, then you're going to have a

00:17:24.580 --> 00:17:27.950
small test error and that proves a lot

00:17:27.950 --> 00:17:28.950
more complicated.

00:17:28.950 --> 00:17:30.930
So it's at the link though, yeah?

00:17:33.500 --> 00:17:36.120
We find that the support vector through

00:17:36.120 --> 00:17:38.430
operation, so I will get to the

00:17:38.430 --> 00:17:40.280
optimization too, yeah.

00:17:41.500 --> 00:17:42.160
Some.

00:17:42.160 --> 00:17:44.290
There's actually many ways to solve it,

00:17:44.290 --> 00:17:46.960
and in the third part I'll talk about.

00:17:47.960 --> 00:17:51.920
What is a stochastic gradient descent?

00:17:51.920 --> 00:17:56.200
Which is the most the fastest way and

00:17:56.200 --> 00:17:58.080
probably the preferred way right now,

00:17:58.080 --> 00:17:58.380
yeah?

00:18:14.040 --> 00:18:17.385
So you could say, I think that you

00:18:17.385 --> 00:18:18.880
could pose, I think you could

00:18:18.880 --> 00:18:19.810
equivalently.

00:18:20.470 --> 00:18:23.580
Pose the problem as you want to.

00:18:23.790 --> 00:18:24.410


00:18:25.410 --> 00:18:26.182
Maximum.

00:18:26.182 --> 00:18:31.216
So this distance here is like the is

00:18:31.216 --> 00:18:35.140
the West transpose X + b * Y.

00:18:35.140 --> 00:18:38.950
So in other words, if WTX is very far

00:18:38.950 --> 00:18:40.550
from the boundary then you have a high

00:18:40.550 --> 00:18:43.414
margin that's like the distance in this

00:18:43.414 --> 00:18:44.560
like plotted space.

00:18:45.920 --> 00:18:48.440
And if you just like arbitrarily

00:18:48.440 --> 00:18:50.380
increase W, then that distance is going

00:18:50.380 --> 00:18:52.030
to increase because you're multiplying

00:18:52.030 --> 00:18:54.050
X by a larger number for each of your

00:18:54.050 --> 00:18:54.460
weights.

00:18:55.160 --> 00:18:57.523
And so you need to kind of normal, you

00:18:57.523 --> 00:19:00.000
need to in some way normalize for the

00:19:00.000 --> 00:19:00.705
weight length.

00:19:00.705 --> 00:19:03.159
And one way to do that is to say you

00:19:03.160 --> 00:19:05.293
could say that I'm going to fix my

00:19:05.293 --> 00:19:07.740
weights to be unit length that they

00:19:07.740 --> 00:19:09.730
have to their weights can't just get

00:19:09.730 --> 00:19:10.824
like arbitrarily bigger.

00:19:10.824 --> 00:19:13.390
And I'm going to try to make the margin

00:19:13.390 --> 00:19:14.820
as big as possible given that.

00:19:15.790 --> 00:19:18.812
But I probably just first for.

00:19:18.812 --> 00:19:20.250
It's probably just an easier

00:19:20.250 --> 00:19:21.250
optimization problem.

00:19:21.250 --> 00:19:23.100
I'm not sure exactly why, but it's

00:19:23.100 --> 00:19:25.380
usually posed as you want to minimize

00:19:25.380 --> 00:19:26.550
the length of the weights.

00:19:27.250 --> 00:19:29.180
While maintaining that the margin is 1.

00:19:29.910 --> 00:19:32.079
And I think that it may be that this

00:19:32.080 --> 00:19:34.690
lends itself better to so.

00:19:34.690 --> 00:19:36.260
I haven't talked about it yet, but to

00:19:36.260 --> 00:19:38.120
when you have when the data is not

00:19:38.120 --> 00:19:40.295
linearly separable, then it's very easy

00:19:40.295 --> 00:19:42.677
to modify this objective to account for

00:19:42.677 --> 00:19:44.410
the data that can't be correctly

00:19:44.410 --> 00:19:44.980
classified.

00:19:47.520 --> 00:19:50.140
Did that follow that at all?

00:19:52.740 --> 00:19:53.160
OK.

00:19:56.510 --> 00:19:58.540
So.

00:20:00.950 --> 00:20:02.700
Alright, so in the separable case,

00:20:02.700 --> 00:20:04.360
meaning that you can perfectly classify

00:20:04.360 --> 00:20:05.700
your data with a linear model.

00:20:06.580 --> 00:20:08.630
The prediction is simply the sign of

00:20:08.630 --> 00:20:12.077
your linear model W transpose X + B so

00:20:12.077 --> 00:20:15.780
and the labels here are one and -, 1.

00:20:15.780 --> 00:20:17.295
You can see in like different cases,

00:20:17.295 --> 00:20:19.054
sometimes people say binary problem,

00:20:19.054 --> 00:20:21.045
the labels are zero or one and

00:20:21.045 --> 00:20:23.022
sometimes they'll say it's -, 1 or one.

00:20:23.022 --> 00:20:25.460
And it's mainly just chosen for the

00:20:25.460 --> 00:20:26.712
simplicity of the math.

00:20:26.712 --> 00:20:29.040
In this case it kind of makes it the

00:20:29.040 --> 00:20:29.350
make.

00:20:29.350 --> 00:20:31.080
It makes the math a lot simpler so I

00:20:31.080 --> 00:20:33.794
don't have to say like F y = 0 then

00:20:33.794 --> 00:20:36.030
this, if y = 1 then this other thing I

00:20:36.030 --> 00:20:36.410
can just.

00:20:36.490 --> 00:20:37.630
Y into the equation.

00:20:39.400 --> 00:20:42.540
The optimization is I'm going to solve

00:20:42.540 --> 00:20:45.960
for the West the weights that minimize

00:20:45.960 --> 00:20:48.930
that the smallest weights that satisfy

00:20:48.930 --> 00:20:49.850
this constraint.

00:20:50.680 --> 00:20:53.650
That the margin is one for all

00:20:53.650 --> 00:20:56.840
examples, so the model times the model

00:20:56.840 --> 00:20:59.826
prediction times the label is at least

00:20:59.826 --> 00:21:01.600
one for every training sample.

00:21:06.580 --> 00:21:09.440
If the data is not linearly separable,

00:21:09.440 --> 00:21:12.490
then I can just extend a little bit.

00:21:13.190 --> 00:21:14.520
And I can say.

00:21:15.780 --> 00:21:17.000
I don't know what that sound is.

00:21:17.000 --> 00:21:19.350
It's really weird, OK?

00:21:20.690 --> 00:21:23.210
And if the data is not linearly

00:21:23.210 --> 00:21:24.230
separable.

00:21:25.130 --> 00:21:26.900
Then I can say that I'm going to just

00:21:26.900 --> 00:21:30.240
pay a penalty of C times, like how much

00:21:30.240 --> 00:21:32.467
that data violates my margin.

00:21:32.467 --> 00:21:35.405
So the if it has a margin of less than

00:21:35.405 --> 00:21:39.533
one, then I pay C * 1 minus its margin.

00:21:39.533 --> 00:21:42.222
So for example if it's right on the

00:21:42.222 --> 00:21:44.280
boundary, then W transpose X + b is

00:21:44.280 --> 00:21:47.665
equal to 0 and so I pay a penalty of C

00:21:47.665 --> 00:21:49.380
* 1 if it's negative.

00:21:49.380 --> 00:21:50.638
If it's on the wrong side of the

00:21:50.638 --> 00:21:51.820
boundary, then I'd pay an even higher

00:21:51.820 --> 00:21:53.456
penalty, and if it's on the right side

00:21:53.456 --> 00:21:54.500
of the boundary, but.

00:21:54.560 --> 00:21:56.800
But the margin is less than one, then I

00:21:56.800 --> 00:21:57.810
pay a smaller penalty.

00:22:00.520 --> 00:22:03.040
This is called the hinge loss, and I'll

00:22:03.040 --> 00:22:04.050
show it here.

00:22:04.050 --> 00:22:06.210
So in the hinge loss, if you're

00:22:06.210 --> 00:22:08.130
confidently correct, there's zero

00:22:08.130 --> 00:22:10.110
penalty if you have a margin of greater

00:22:10.110 --> 00:22:12.080
than one in the case of an SVM.

00:22:12.750 --> 00:22:14.820
But if you're not confidently correct

00:22:14.820 --> 00:22:17.085
if they're unconfident or incorrect,

00:22:17.085 --> 00:22:18.980
which means which is when you're on

00:22:18.980 --> 00:22:20.640
this side of the decision boundary.

00:22:21.300 --> 00:22:24.460
Then you pay a penalty and the penalty

00:22:24.460 --> 00:22:26.070
just increases.

00:22:27.410 --> 00:22:30.220
Proportionally to how far you are from

00:22:30.220 --> 00:22:31.600
the margin of 1.

00:22:33.010 --> 00:22:35.640
And say if you have, if you're just

00:22:35.640 --> 00:22:37.350
unconfident way correct, you pay a

00:22:37.350 --> 00:22:38.803
little penalty, if you're incorrect,

00:22:38.803 --> 00:22:41.209
you pay a bigger penalty, and if you're

00:22:41.210 --> 00:22:42.760
confidently incorrect, then you pay an

00:22:42.760 --> 00:22:43.720
even bigger penalty.

00:22:45.420 --> 00:22:48.050
And this is important because.

00:22:48.780 --> 00:22:51.170
With this kind of loss, the confidently

00:22:51.170 --> 00:22:54.450
correct examples don't make any they

00:22:54.450 --> 00:22:56.090
don't change the decision.

00:22:56.090 --> 00:22:58.350
So anything that incurs a loss means

00:22:58.350 --> 00:23:00.000
that it's part of your thing that

00:23:00.000 --> 00:23:01.420
you're minimizing and your objective

00:23:01.420 --> 00:23:02.190
function.

00:23:02.190 --> 00:23:04.070
But if it doesn't incur a loss, then

00:23:04.070 --> 00:23:07.180
it's not changing your objective

00:23:07.180 --> 00:23:09.710
evaluation, so it's not causing any

00:23:09.710 --> 00:23:10.760
change to your decision.

00:23:15.700 --> 00:23:18.486
So I also need to note that there's

00:23:18.486 --> 00:23:20.373
like different ways of expressing the

00:23:20.373 --> 00:23:20.839
same thing.

00:23:20.839 --> 00:23:22.939
So here I express it in terms of this

00:23:22.940 --> 00:23:23.840
hinge loss.

00:23:23.840 --> 00:23:26.399
But you can also express it in terms of

00:23:26.400 --> 00:23:28.490
what people call slack variables.

00:23:28.490 --> 00:23:30.443
It's the exact same thing.

00:23:30.443 --> 00:23:32.850
It's just that here this slack variable

00:23:32.850 --> 00:23:35.220
is equal to 1 minus the margin.

00:23:35.220 --> 00:23:37.270
This is like if I bring.

00:23:39.220 --> 00:23:39.796
A.

00:23:39.796 --> 00:23:42.610
Bring this over here and then bring

00:23:42.610 --> 00:23:43.335
that over here.

00:23:43.335 --> 00:23:45.030
Then this slack variable when you

00:23:45.030 --> 00:23:47.030
minimize it will be equal to 1 minus

00:23:47.030 --> 00:23:47.730
this margin.

00:23:49.480 --> 00:23:51.330
So Slack variable is 1 minus the margin

00:23:51.330 --> 00:23:52.740
and you pay the same penalty.

00:23:52.740 --> 00:23:55.020
But if you're ever like reading about

00:23:55.020 --> 00:23:57.230
SVMS and somebody says like slack

00:23:57.230 --> 00:23:58.820
variable, then I just want you to know

00:23:58.820 --> 00:23:59.350
what that means.

00:24:00.260 --> 00:24:01.620
This means.

00:24:01.620 --> 00:24:03.760
So for this example here, we would be

00:24:03.760 --> 00:24:05.740
paying some penalty, some slack

00:24:05.740 --> 00:24:08.010
penalty, or some hinge loss penalty

00:24:08.010 --> 00:24:08.780
equivalently.

00:24:10.520 --> 00:24:12.840
Here's an example of an SVM decision

00:24:12.840 --> 00:24:15.510
boundary classifying between these red

00:24:15.510 --> 00:24:17.390
Oreos and Blue X's.

00:24:17.390 --> 00:24:19.270
This is from Andrews Esterman slides

00:24:19.270 --> 00:24:20.530
from Oxford.

00:24:22.710 --> 00:24:25.266
And here there's a soft margin, so

00:24:25.266 --> 00:24:27.210
there's some penalty.

00:24:27.210 --> 00:24:29.740
If you were to set this PC to Infinity,

00:24:29.740 --> 00:24:32.280
it means that you are still requiring

00:24:32.280 --> 00:24:34.820
that every example has a.

00:24:35.960 --> 00:24:37.930
Is has a margin of 1.

00:24:38.610 --> 00:24:40.310
Which that can be a problem if you have

00:24:40.310 --> 00:24:41.930
this case, because then you won't be

00:24:41.930 --> 00:24:43.360
able to optimize it because it's

00:24:43.360 --> 00:24:44.000
impossible.

00:24:45.030 --> 00:24:48.150
So if you set a small CC is 10, then

00:24:48.150 --> 00:24:49.790
you pay a small penalty when things

00:24:49.790 --> 00:24:50.495
violate the margin.

00:24:50.495 --> 00:24:52.360
And in this case it finds the decision

00:24:52.360 --> 00:24:54.180
boundary where it incorrectly

00:24:54.180 --> 00:24:57.270
classifies this one example and you

00:24:57.270 --> 00:25:00.473
have these four examples are within the

00:25:00.473 --> 00:25:00.829
margin.

00:25:00.830 --> 00:25:01.310
We're on it.

00:25:05.750 --> 00:25:06.300
OK.

00:25:06.300 --> 00:25:08.500
Any questions about that so far?

00:25:09.590 --> 00:25:09.980
OK.

00:25:11.890 --> 00:25:16.150
So I'm going to talk about the

00:25:16.150 --> 00:25:18.270
objective functions a little bit more,

00:25:18.270 --> 00:25:20.730
and to do that I'll introduce this

00:25:20.730 --> 00:25:22.180
thing called the Representer theorem.

00:25:22.940 --> 00:25:25.500
So the Representer theorem basically

00:25:25.500 --> 00:25:29.100
says that if you have some model, some

00:25:29.100 --> 00:25:31.240
linear model, that's W transpose X.

00:25:32.240 --> 00:25:37.240
Then the optimal West in many cases can

00:25:37.240 --> 00:25:43.100
be expressed as a of some weight for

00:25:43.100 --> 00:25:46.210
each example and the example features.

00:25:46.970 --> 00:25:49.240
And the label of the features or the

00:25:49.240 --> 00:25:50.450
label of the data point?

00:25:52.080 --> 00:25:55.300
So the optimal weight vector is just a

00:25:55.300 --> 00:25:58.160
weighted average of the input training

00:25:58.160 --> 00:25:59.270
example features.

00:26:02.260 --> 00:26:03.940
And there's certain like caveats and

00:26:03.940 --> 00:26:06.760
conditions, but this is true for L2

00:26:06.760 --> 00:26:10.550
logistic regression or SVM for example.

00:26:13.120 --> 00:26:17.500
And for SVMS these alphas are zeros for

00:26:17.500 --> 00:26:20.066
all the non support vectors because the

00:26:20.066 --> 00:26:22.080
support vectors influence the decision.

00:26:23.420 --> 00:26:24.800
So it's actually depends on a very

00:26:24.800 --> 00:26:26.390
small number of training examples.

00:26:28.710 --> 00:26:30.690
So I'm not going to go deep into the

00:26:30.690 --> 00:26:33.000
math and I don't expect anybody to be

00:26:33.000 --> 00:26:34.880
able to derive the dual or anything

00:26:34.880 --> 00:26:38.127
like that, but I just want to express

00:26:38.127 --> 00:26:39.940
express these objectives and different

00:26:39.940 --> 00:26:41.240
ways of looking at the problem.

00:26:42.100 --> 00:26:44.433
So in terms of prediction already I

00:26:44.433 --> 00:26:46.030
already gave you this formulation

00:26:46.030 --> 00:26:47.833
that's called the primal where the

00:26:47.833 --> 00:26:49.550
where you're optimizing in terms of the

00:26:49.550 --> 00:26:50.310
feature weights.

00:26:51.570 --> 00:26:53.550
And then you can also represent it in

00:26:53.550 --> 00:26:56.020
terms of you can represent, whoops, the

00:26:56.020 --> 00:26:56.700
dual.

00:26:57.700 --> 00:26:58.280
Where to go?

00:26:59.380 --> 00:27:01.400
Alright, you can also represent it in

00:27:01.400 --> 00:27:03.595
what's called a dual, where instead of

00:27:03.595 --> 00:27:05.330
optimizing over feature weights, you're

00:27:05.330 --> 00:27:06.920
optimizing over the weights of each

00:27:06.920 --> 00:27:07.520
example.

00:27:08.160 --> 00:27:10.470
Where again sum of those weights of the

00:27:10.470 --> 00:27:12.720
examples gives you your weight vector.

00:27:13.560 --> 00:27:16.256
And remember that this weights are the

00:27:16.256 --> 00:27:19.560
sum of alpha YX and when I plug that in

00:27:19.560 --> 00:27:22.410
here then I see in the dual that my

00:27:22.410 --> 00:27:25.914
prediction is the sum of alpha Y and

00:27:25.914 --> 00:27:28.395
the dot product of each training

00:27:28.395 --> 00:27:30.910
example with the example that I'm

00:27:30.910 --> 00:27:31.680
predicting for.

00:27:33.230 --> 00:27:33.980
So this.

00:27:33.980 --> 00:27:36.540
So here there's like a, it's a.

00:27:36.540 --> 00:27:39.255
It's an average of the similarities of

00:27:39.255 --> 00:27:43.550
the training examples with the features

00:27:43.550 --> 00:27:45.330
that I'm making a prediction for.

00:27:46.110 --> 00:27:47.730
Where the similarity is defined by A

00:27:47.730 --> 00:27:49.020
dot product in this case.

00:27:50.820 --> 00:27:53.831
Dot product is the sum of the elements

00:27:53.831 --> 00:27:56.571
squared or the I mean squared but the

00:27:56.571 --> 00:27:58.820
sum of the product of the elements.

00:28:01.790 --> 00:28:05.558
And this is just plugging it into the

00:28:05.558 --> 00:28:06.950
into the.

00:28:06.950 --> 00:28:08.750
If I plug everything in and then write

00:28:08.750 --> 00:28:10.350
the objective of the dual it comes out

00:28:10.350 --> 00:28:11.030
to this.

00:28:13.950 --> 00:28:17.410
For an SVM, alpha sparse, which means

00:28:17.410 --> 00:28:19.080
most of the values are zero.

00:28:19.080 --> 00:28:22.115
So the SVM only depends on these few

00:28:22.115 --> 00:28:25.920
examples, and so it's only nonzero for

00:28:25.920 --> 00:28:27.640
the support vectors, the examples that

00:28:27.640 --> 00:28:28.560
are within the margin.

00:28:35.550 --> 00:28:37.460
So the reason that the dual will be

00:28:37.460 --> 00:28:40.280
helpful is that it.

00:28:41.900 --> 00:28:45.020
Is that it allows us to deal with a

00:28:45.020 --> 00:28:45.930
nonlinear case.

00:28:45.930 --> 00:28:48.422
So in the top example, we might say a

00:28:48.422 --> 00:28:50.180
linear classifier is OK, it only gets

00:28:50.180 --> 00:28:51.550
one example wrong.

00:28:51.550 --> 00:28:53.179
I can live with that.

00:28:53.180 --> 00:28:55.437
But in the bottom case, a linear

00:28:55.437 --> 00:28:57.860
example seems like a really bad choice,

00:28:57.860 --> 00:28:58.210
right?

00:28:58.210 --> 00:29:00.995
Like it's obviously nonlinear and a

00:29:00.995 --> 00:29:02.010
linear classifier is going to get

00:29:02.010 --> 00:29:02.780
really high error.

00:29:03.530 --> 00:29:06.790
So what is some way that I could try

00:29:06.790 --> 00:29:08.630
to, let's say I still want to stick

00:29:08.630 --> 00:29:10.220
with a linear classifier, what's

00:29:10.220 --> 00:29:12.750
something that I can do to this do in

00:29:12.750 --> 00:29:16.375
this case to improve the ability of the

00:29:16.375 --> 00:29:16.950
linear classifier?

00:29:19.410 --> 00:29:19.860
Yeah.

00:29:22.680 --> 00:29:24.680
So I can like I can change the

00:29:24.680 --> 00:29:26.880
coordinate system or change the

00:29:26.880 --> 00:29:28.740
features in some way so that they

00:29:28.740 --> 00:29:30.140
become linearly separable.

00:29:30.930 --> 00:29:32.160
And the new feature space.

00:29:32.230 --> 00:29:34.440
Can we reject it in different

00:29:34.440 --> 00:29:34.890
dimensions?

00:29:37.530 --> 00:29:38.160
Right, yeah.

00:29:38.160 --> 00:29:40.230
And we can also project it into a

00:29:40.230 --> 00:29:41.810
higher dimensional space, for example,

00:29:41.810 --> 00:29:43.300
where it is linearly separable.

00:29:44.200 --> 00:29:45.666
Exactly those are the two.

00:29:45.666 --> 00:29:47.950
I think there's either 2 valid answers

00:29:47.950 --> 00:29:48.750
that I can think of.

00:29:49.900 --> 00:29:52.720
So for example, if we were to use polar

00:29:52.720 --> 00:29:56.040
coordinates, then we could represent

00:29:56.040 --> 00:29:59.273
instead of the like position on the X&Y

00:29:59.273 --> 00:30:01.190
axis or X1 and X2 axis.

00:30:01.910 --> 00:30:03.770
We could represent the distance and

00:30:03.770 --> 00:30:05.550
angle of each point from the center.

00:30:06.220 --> 00:30:08.980
And then here's that new coordinate

00:30:08.980 --> 00:30:09.350
space.

00:30:09.350 --> 00:30:11.300
And then this is a really easy like

00:30:11.300 --> 00:30:12.120
linear decision.

00:30:12.860 --> 00:30:14.440
So that's one way to solve it.

00:30:16.250 --> 00:30:18.520
Another way is that we can map the data

00:30:18.520 --> 00:30:21.520
into another higher dimensional space S

00:30:21.520 --> 00:30:23.550
if I instead represent instead of

00:30:23.550 --> 00:30:25.920
representing X1 and X2 directly.

00:30:25.920 --> 00:30:30.209
If I represent X1 squared and X2

00:30:30.209 --> 00:30:33.620
squared and the X1 times X2.

00:30:34.450 --> 00:30:35.960
Sqrt 2.

00:30:36.180 --> 00:30:38.580
Come it's helpful in the in some math

00:30:38.580 --> 00:30:39.240
later.

00:30:39.240 --> 00:30:41.830
If I represent these three coordinates

00:30:41.830 --> 00:30:44.680
instead, then it gets mapped as is

00:30:44.680 --> 00:30:47.545
shown in this 3D plot, and now there's

00:30:47.545 --> 00:30:51.020
a linear like a plane boundary that can

00:30:51.020 --> 00:30:54.040
separate the circles from the

00:30:54.040 --> 00:30:54.630
triangles.

00:30:55.490 --> 00:30:57.110
So this also works right?

00:30:57.110 --> 00:30:57.920
Two ways to do it.

00:30:57.920 --> 00:31:00.270
I can change the features or map into a

00:31:00.270 --> 00:31:01.380
higher dimensional space.

00:31:04.820 --> 00:31:07.180
So if I wanted to so I can write this

00:31:07.180 --> 00:31:09.740
as I have some kind of transformation

00:31:09.740 --> 00:31:12.190
on my input features and then given

00:31:12.190 --> 00:31:13.730
that transformation I then have a

00:31:13.730 --> 00:31:16.510
linear model and I can solve that using

00:31:16.510 --> 00:31:17.860
an SVM if I want.

00:31:24.020 --> 00:31:27.569
So if I'm representing this in the

00:31:27.570 --> 00:31:30.130
directly in the primal, then I can say

00:31:30.130 --> 00:31:33.090
that I just map my original features to

00:31:33.090 --> 00:31:34.970
my new features through this fee.

00:31:34.970 --> 00:31:37.120
Just some feature function.

00:31:37.980 --> 00:31:40.220
And then I solve for my weights in the

00:31:40.220 --> 00:31:41.030
new space.

00:31:42.030 --> 00:31:43.540
Sometimes though, in order to make the

00:31:43.540 --> 00:31:45.225
data linearly separable you might have

00:31:45.225 --> 00:31:47.050
to map into a very high dimensional

00:31:47.050 --> 00:31:47.480
space.

00:31:47.480 --> 00:31:50.390
So here like doing this trick where I

00:31:50.390 --> 00:31:53.370
look at the squares and then the

00:31:53.370 --> 00:31:55.390
product of the individual variables

00:31:55.390 --> 00:31:57.510
only went from 2 to 3 dimensions.

00:31:57.510 --> 00:31:59.162
But if I had started with 1000

00:31:59.162 --> 00:32:01.510
dimensions and I was like looking at

00:32:01.510 --> 00:32:03.666
all products of pairs of variables,

00:32:03.666 --> 00:32:05.292
this would become very high

00:32:05.292 --> 00:32:05.680
dimensional.

00:32:07.400 --> 00:32:08.880
So I might want to avoid that.

00:32:10.320 --> 00:32:12.050
So we can use the dual and I'm not

00:32:12.050 --> 00:32:13.690
going to step through the equations,

00:32:13.690 --> 00:32:16.199
but it's just showing that in the dual,

00:32:16.200 --> 00:32:18.750
since we're before you had a decision

00:32:18.750 --> 00:32:20.850
in terms of a dot product of original

00:32:20.850 --> 00:32:22.960
features, now it's a dot product of the

00:32:22.960 --> 00:32:24.060
transform features.

00:32:24.680 --> 00:32:26.280
So it's just the transformed features

00:32:26.280 --> 00:32:28.180
transpose times the other transform

00:32:28.180 --> 00:32:28.650
features.

00:32:32.240 --> 00:32:35.300
And sometimes we don't even need to

00:32:35.300 --> 00:32:37.300
compute the transformed features.

00:32:37.300 --> 00:32:38.970
All we really need at the end of the

00:32:38.970 --> 00:32:41.022
day is this kernel function.

00:32:41.022 --> 00:32:43.410
The kernel is a similarity function.

00:32:43.410 --> 00:32:45.192
It's a certain kind of similarity

00:32:45.192 --> 00:32:48.860
function that defines how similar to

00:32:48.860 --> 00:32:49.790
feature vectors are.

00:32:50.510 --> 00:32:52.710
So I could compute it explicitly.

00:32:53.920 --> 00:32:56.120
By transforming the features and taking

00:32:56.120 --> 00:32:57.740
their dot product and then I could

00:32:57.740 --> 00:32:59.560
store this kernel value for all my

00:32:59.560 --> 00:33:01.655
pairs of features in the training set,

00:33:01.655 --> 00:33:02.900
for example, and then do my

00:33:02.900 --> 00:33:03.680
optimization.

00:33:04.330 --> 00:33:05.980
I don't necessarily need to compute it

00:33:05.980 --> 00:33:08.142
every time, and sometimes I don't need

00:33:08.142 --> 00:33:09.740
to compute it as at all.

00:33:11.500 --> 00:33:12.930
An example where I don't need to

00:33:12.930 --> 00:33:15.150
compute it is in this case where I was

00:33:15.150 --> 00:33:17.230
looking at the square of the individual

00:33:17.230 --> 00:33:17.970
variables.

00:33:18.610 --> 00:33:20.750
And the product of pairs of variables.

00:33:22.140 --> 00:33:25.190
You can show that if you like, do this

00:33:25.190 --> 00:33:27.920
multiplication of these two different

00:33:27.920 --> 00:33:29.830
feature vectors X&Z.

00:33:31.090 --> 00:33:32.823
Then and you expand it.

00:33:32.823 --> 00:33:34.970
Then you can see that it actually ends

00:33:34.970 --> 00:33:39.575
up being that the product of this Phi

00:33:39.575 --> 00:33:42.410
of X times Phi of Z.

00:33:43.260 --> 00:33:46.422
Is equal to the square of the dot

00:33:46.422 --> 00:33:46.780
product.

00:33:46.780 --> 00:33:49.473
So you can get the same benefit just by

00:33:49.473 --> 00:33:50.837
squaring the dot product.

00:33:50.837 --> 00:33:53.150
And you can compute the similarity just

00:33:53.150 --> 00:33:55.440
by squaring the dot product instead of

00:33:55.440 --> 00:33:56.650
needing the map into the higher

00:33:56.650 --> 00:33:58.660
dimensional space and then taking the

00:33:58.660 --> 00:33:59.230
dot product.

00:34:00.400 --> 00:34:02.120
So if you had like a very high

00:34:02.120 --> 00:34:03.540
dimensional feature, this would save a

00:34:03.540 --> 00:34:04.230
lot of time.

00:34:04.230 --> 00:34:07.340
You wouldn't need to compute a million

00:34:07.340 --> 00:34:10.910
dimensional upper upper D feature.

00:34:13.930 --> 00:34:15.680
And yeah.

00:34:16.550 --> 00:34:18.310
So one thing to note though, is that

00:34:18.310 --> 00:34:19.840
because you're learning in terms of the

00:34:19.840 --> 00:34:22.950
distance of pairs of examples, the

00:34:22.950 --> 00:34:24.760
optimization tends to be pretty slow

00:34:24.760 --> 00:34:26.389
for kernel methods, at least in the

00:34:26.390 --> 00:34:27.730
traditional kernel methods.

00:34:28.440 --> 00:34:30.520
There's the algorithm that Austria is a

00:34:30.520 --> 00:34:32.710
lot faster for kernels, although I'm

00:34:32.710 --> 00:34:35.050
not going to go into depth for its

00:34:35.050 --> 00:34:35.900
kernelized version.

00:34:35.900 --> 00:34:36.140
Yep.

00:34:39.220 --> 00:34:40.700
Gives us a vector.

00:34:42.920 --> 00:34:45.130
X transpose times Z.

00:34:46.120 --> 00:34:49.250
Z This one that gives us a scalar

00:34:49.250 --> 00:34:51.760
because and Z are the same length,

00:34:51.760 --> 00:34:53.000
they're just two different feature

00:34:53.000 --> 00:34:53.570
vectors.

00:34:54.580 --> 00:34:57.028
And so they're both like say north by

00:34:57.028 --> 00:34:57.314
one.

00:34:57.314 --> 00:34:59.430
So then I have a one by North Times

00:34:59.430 --> 00:35:02.490
north by one gives me a 1 by 1.

00:35:04.390 --> 00:35:05.942
Yeah, so it's a dot product.

00:35:05.942 --> 00:35:08.740
So that dot product of two vectors

00:35:08.740 --> 00:35:10.490
gives you just a single value.

00:35:14.290 --> 00:35:16.340
So there's various kinds of kernels

00:35:16.340 --> 00:35:17.260
that people use.

00:35:17.260 --> 00:35:18.400
Polynomial.

00:35:19.430 --> 00:35:23.005
The one we talked about Gaussian, which

00:35:23.005 --> 00:35:25.610
is where you say that the similarity is

00:35:25.610 --> 00:35:28.630
based on how the squared distance

00:35:28.630 --> 00:35:30.060
between two feature vectors.

00:35:31.670 --> 00:35:32.360
And.

00:35:33.050 --> 00:35:34.730
And they can all just be used in the

00:35:34.730 --> 00:35:37.440
same way by computing the kernel value.

00:35:37.440 --> 00:35:39.100
In some cases you might compute

00:35:39.100 --> 00:35:40.700
explicitly, like for the Gaussian

00:35:40.700 --> 00:35:42.726
kernel and other places, and other

00:35:42.726 --> 00:35:44.550
cases there's a shortcut for the

00:35:44.550 --> 00:35:45.170
polynomial.

00:35:46.800 --> 00:35:49.010
But you just plug in your kernel

00:35:49.010 --> 00:35:50.190
function and then you can do this

00:35:50.190 --> 00:35:51.040
optimization.

00:35:52.850 --> 00:35:54.760
So I'm going to talk about optimization

00:35:54.760 --> 00:35:56.800
a little bit later, so I just want to

00:35:56.800 --> 00:35:58.430
show a couple of examples of how the

00:35:58.430 --> 00:36:00.410
decision boundary can be affected by

00:36:00.410 --> 00:36:02.090
some of the SVM parameters.

00:36:02.790 --> 00:36:05.910
So one of the parameters is CC is like.

00:36:05.910 --> 00:36:07.660
How important is it to make sure that

00:36:07.660 --> 00:36:10.625
every example is like outside the

00:36:10.625 --> 00:36:11.779
margin or on the margin?

00:36:12.530 --> 00:36:14.950
If it's Infinity, then you're forcing

00:36:14.950 --> 00:36:16.020
a, correct?

00:36:16.020 --> 00:36:18.630
You're forcing that everything has a

00:36:18.630 --> 00:36:20.030
margin of at least one.

00:36:20.810 --> 00:36:22.750
And so I wouldn't even be able to solve

00:36:22.750 --> 00:36:24.610
it if I were doing a linear classifier.

00:36:24.610 --> 00:36:27.556
But in this case it's a RBF classifier

00:36:27.556 --> 00:36:30.060
RBF kernel, which means that the

00:36:30.060 --> 00:36:31.110
distance is defined.

00:36:31.110 --> 00:36:32.920
The distance between examples is

00:36:32.920 --> 00:36:35.510
defined as like this squared distance

00:36:35.510 --> 00:36:37.160
divided by some Sigma.

00:36:38.040 --> 00:36:40.390
Sigma squared, so in this case I can

00:36:40.390 --> 00:36:41.990
linearly separate it with the RBF

00:36:41.990 --> 00:36:43.490
kernel and I get this function.

00:36:44.140 --> 00:36:48.490
If I reduce C then I start to get I get

00:36:48.490 --> 00:36:51.300
some an additional sample that is

00:36:51.300 --> 00:36:53.880
within the margin over here, but on

00:36:53.880 --> 00:36:55.885
average examples are further from the

00:36:55.885 --> 00:36:57.260
margin because I've relaxed my

00:36:57.260 --> 00:36:57.970
constraints.

00:36:57.970 --> 00:36:59.840
So sometimes you can get a better

00:36:59.840 --> 00:37:02.820
classifier by you don't always want to

00:37:02.820 --> 00:37:05.140
have C equal to Infinity or force that

00:37:05.140 --> 00:37:06.970
everything is outside the margin, even

00:37:06.970 --> 00:37:07.860
if it's possible.

00:37:09.610 --> 00:37:10.715
Often you have to optimize.

00:37:10.715 --> 00:37:12.700
You have to do like some kind of cross

00:37:12.700 --> 00:37:14.710
validation to choose C and that's one

00:37:14.710 --> 00:37:16.330
of the things that I always hated about

00:37:16.330 --> 00:37:18.571
SVMS because they can take a while to

00:37:18.571 --> 00:37:19.770
optimize and you have to do that

00:37:19.770 --> 00:37:20.130
search.

00:37:22.990 --> 00:37:27.090
So the if you relax, even more so now

00:37:27.090 --> 00:37:28.215
there's like a very weak penalty.

00:37:28.215 --> 00:37:29.860
So now you have lots of things within

00:37:29.860 --> 00:37:30.390
the margin.

00:37:32.280 --> 00:37:34.499
Then the other parameter, your kernel

00:37:34.500 --> 00:37:37.570
sometimes has parameters, so the RBF

00:37:37.570 --> 00:37:40.630
kernel is how sharp your distance

00:37:40.630 --> 00:37:41.690
function is.

00:37:41.690 --> 00:37:43.190
So if Sigma is.

00:37:43.470 --> 00:37:47.625
A Sigma is 1 then whatever, it's one.

00:37:47.625 --> 00:37:50.240
If Sigma Sigma goes closer to zero

00:37:50.240 --> 00:37:53.440
though, your RBF kernel becomes more a

00:37:53.440 --> 00:37:55.165
nearest neighbor classifier, because if

00:37:55.165 --> 00:37:56.739
Sigma is really close to 0.

00:37:57.700 --> 00:37:59.730
Then it means that an example that

00:37:59.730 --> 00:38:01.760
you're really close to.

00:38:01.760 --> 00:38:03.857
Only if you're super close to an

00:38:03.857 --> 00:38:06.459
example will it have a will it have a

00:38:06.460 --> 00:38:08.970
high similarity, and examples that are

00:38:08.970 --> 00:38:11.035
further away will have much lower

00:38:11.035 --> 00:38:11.540
similarity.

00:38:12.360 --> 00:38:14.080
So you can see that with Sigma equals

00:38:14.080 --> 00:38:16.010
one you just fit like these circular

00:38:16.010 --> 00:38:17.090
decision functions.

00:38:17.820 --> 00:38:19.770
As Sigma gets smaller, it starts to

00:38:19.770 --> 00:38:21.680
become like a little bit more wobbly.

00:38:22.440 --> 00:38:24.050
This is the this is the decision

00:38:24.050 --> 00:38:25.960
boundary, this solid line, in case

00:38:25.960 --> 00:38:27.630
that's not clear, with the green on one

00:38:27.630 --> 00:38:29.310
side and the yellow on the other side.

00:38:30.140 --> 00:38:32.459
And then as it gets smaller, then it

00:38:32.460 --> 00:38:33.800
starts to become like a nearest

00:38:33.800 --> 00:38:34.670
neighbor classifier.

00:38:34.670 --> 00:38:36.370
So almost everything is a support

00:38:36.370 --> 00:38:38.140
vector except for the very easiest

00:38:38.140 --> 00:38:40.429
points on the interior here and the

00:38:40.430 --> 00:38:41.110
decision boundary.

00:38:41.110 --> 00:38:43.050
You can start to become really

00:38:43.050 --> 00:38:45.935
arbitrarily complicated, just like just

00:38:45.935 --> 00:38:47.329
like a nearest neighbor.

00:38:48.570 --> 00:38:49.150
Question.

00:38:50.520 --> 00:38:51.895
What?

00:38:51.895 --> 00:38:54.120
So yeah, good question.

00:38:54.120 --> 00:38:55.320
So Sigma is in.

00:38:55.320 --> 00:38:57.750
It's from this equation here where I

00:38:57.750 --> 00:39:00.720
say that the similarity of two examples

00:39:00.720 --> 00:39:04.350
is their distance, their L2 distance

00:39:04.350 --> 00:39:06.140
squared divided by two Sigma.

00:39:06.980 --> 00:39:07.473
Squared.

00:39:07.473 --> 00:39:09.930
So if Sigma is really high, then it

00:39:09.930 --> 00:39:11.500
means that my similarity falls off

00:39:11.500 --> 00:39:14.490
slowly as two examples get further away

00:39:14.490 --> 00:39:15.620
in feature space.

00:39:15.620 --> 00:39:18.050
And if it's really small then the

00:39:18.050 --> 00:39:20.210
similarity drops off really quickly.

00:39:20.210 --> 00:39:22.120
So if it's like close to 0.

00:39:22.970 --> 00:39:25.380
Then the closest example will just be

00:39:25.380 --> 00:39:27.390
way, way way closer than any of the

00:39:27.390 --> 00:39:28.190
other examples.

00:39:29.690 --> 00:39:31.070
According to the similarity measure.

00:39:32.440 --> 00:39:32.980
Yeah.

00:39:33.240 --> 00:39:35.970
The previous example we are discussing

00:39:35.970 --> 00:39:37.700
projecting features to higher

00:39:37.700 --> 00:39:38.580
dimensions, right?

00:39:38.580 --> 00:39:41.730
Yeah, so how can we be sure this is the

00:39:41.730 --> 00:39:43.650
minimum dimension we required to

00:39:43.650 --> 00:39:44.380
classify that?

00:39:45.130 --> 00:39:46.810
Particular features are example space

00:39:46.810 --> 00:39:47.240
we have.

00:39:49.810 --> 00:39:50.980
Sorry, can you ask it again?

00:39:50.980 --> 00:39:52.100
I'm not sure if I got it.

00:39:52.590 --> 00:39:55.120
Understand something so we know that we

00:39:55.120 --> 00:39:56.250
need to project it in different

00:39:56.250 --> 00:39:58.610
dimensions to classify that properly.

00:39:58.610 --> 00:40:01.210
In the previous example like so we said

00:40:01.210 --> 00:40:02.100
we discussed right?

00:40:02.100 --> 00:40:04.486
So how can we very sure what is the

00:40:04.486 --> 00:40:05.850
minimum our minimum dimension?

00:40:05.850 --> 00:40:08.659
So the question is how do you know what

00:40:08.660 --> 00:40:10.700
kernel you should use or how high you

00:40:10.700 --> 00:40:12.400
should project the data right?

00:40:12.980 --> 00:40:15.750
Yeah, that that's a problem that you

00:40:15.750 --> 00:40:17.523
don't really know, so you have to try.

00:40:17.523 --> 00:40:19.350
You can try different things and then

00:40:19.350 --> 00:40:21.200
you use your validation set to choose

00:40:21.200 --> 00:40:21.950
the best model.

00:40:22.930 --> 00:40:26.350
But that's a downside of SVMS that

00:40:26.350 --> 00:40:29.960
since the optimization for big data set

00:40:29.960 --> 00:40:32.700
can be pretty slow if you're using a

00:40:32.700 --> 00:40:33.120
kernel.

00:40:33.790 --> 00:40:36.000
And so it can be very time consuming to

00:40:36.000 --> 00:40:37.410
try to search through all the different

00:40:37.410 --> 00:40:38.620
parameters and different types of

00:40:38.620 --> 00:40:39.700
kernels that you could use.

00:40:41.420 --> 00:40:44.310
There's another trick which you could

00:40:44.310 --> 00:40:46.230
do, which is like you take a random

00:40:46.230 --> 00:40:47.150
forest.

00:40:48.650 --> 00:40:51.300
And you take the leaf node that each

00:40:51.300 --> 00:40:53.632
data point falls into as a binary

00:40:53.632 --> 00:40:55.690
variable, so it'll be a sparse binary

00:40:55.690 --> 00:40:56.140
variable.

00:40:56.920 --> 00:40:58.230
And then you can apply your linear

00:40:58.230 --> 00:40:59.690
classifier to it.

00:40:59.690 --> 00:41:01.480
So then you're like mapping it into

00:41:01.480 --> 00:41:03.650
this high dimensional space that kind

00:41:03.650 --> 00:41:05.540
of takes into account the feature

00:41:05.540 --> 00:41:08.800
structure and where the data should be

00:41:08.800 --> 00:41:10.190
like pretty linearly separable.

00:41:16.350 --> 00:41:19.396
So in summary of the kernels for

00:41:19.396 --> 00:41:21.560
kernels you can learn the classifiers

00:41:21.560 --> 00:41:23.120
in high dimensional feature spaces

00:41:23.120 --> 00:41:24.705
without actually having to map them

00:41:24.705 --> 00:41:25.090
there.

00:41:25.090 --> 00:41:26.380
We did for the polynomial.

00:41:26.380 --> 00:41:28.898
The data can be linearly separable in

00:41:28.898 --> 00:41:30.229
the high dimensional space.

00:41:30.230 --> 00:41:31.796
Even if it weren't highly separable,

00:41:31.796 --> 00:41:34.029
wasn't wasn't there weren't actually

00:41:34.029 --> 00:41:36.150
separable in the original feature

00:41:36.150 --> 00:41:36.520
space.

00:41:37.530 --> 00:41:40.830
And you can use the kernel for an SVM,

00:41:40.830 --> 00:41:42.760
but the concept of kernels it's also

00:41:42.760 --> 00:41:44.620
used in other learning algorithms, so

00:41:44.620 --> 00:41:46.200
it's just like a general concept worth

00:41:46.200 --> 00:41:46.710
knowing.

00:41:48.530 --> 00:41:51.890
All right, so it's time for a stretch

00:41:51.890 --> 00:41:52.750
break.

00:41:53.910 --> 00:41:56.160
And you can think about this question

00:41:56.160 --> 00:41:58.130
if you were to remove a support vector

00:41:58.130 --> 00:41:59.600
from the training set with the decision

00:41:59.600 --> 00:42:00.560
boundary change.

00:42:01.200 --> 00:42:03.799
And then after 2 minutes I'll give the

00:42:03.800 --> 00:42:06.150
answer to that and then I'll give an

00:42:06.150 --> 00:42:08.360
application example and talk about the

00:42:08.360 --> 00:42:09.380
Pegasus algorithm.

00:44:27.710 --> 00:44:30.520
So what's the answer to this?

00:44:30.520 --> 00:44:32.510
If I were to remove one of these

00:44:32.510 --> 00:44:35.240
examples, here is my decision boundary.

00:44:35.240 --> 00:44:36.540
You're going to change or not?

00:44:38.300 --> 00:44:40.580
Yeah, it will change right?

00:44:40.580 --> 00:44:42.120
If I moved any of the other ones, it

00:44:42.120 --> 00:44:42.760
wouldn't change.

00:44:42.760 --> 00:44:43.979
But if I remove one of the support

00:44:43.980 --> 00:44:45.655
vectors it's going to change because my

00:44:45.655 --> 00:44:46.315
support is changing.

00:44:46.315 --> 00:44:49.144
So if I remove this for example, then I

00:44:49.144 --> 00:44:51.328
think the line would like tilt this way

00:44:51.328 --> 00:44:53.944
so that it would depend on that X and

00:44:53.944 --> 00:44:54.651
this X.

00:44:54.651 --> 00:44:58.186
And if I remove this O then I think it

00:44:58.186 --> 00:45:00.240
would shift down this way so that it

00:45:00.240 --> 00:45:02.020
depends on this O and these X's.

00:45:02.660 --> 00:45:04.970
Birds find some boundary where three of

00:45:04.970 --> 00:45:06.920
those points are equidistant, 2 on one

00:45:06.920 --> 00:45:07.840
side and 1 on the other.

00:45:12.630 --> 00:45:14.120
Alright, so I'm going to give you an

00:45:14.120 --> 00:45:15.920
example of how it's used, and you may

00:45:15.920 --> 00:45:17.862
notice that almost all the examples are

00:45:17.862 --> 00:45:19.570
computer vision, and that's because I

00:45:19.570 --> 00:45:21.431
know a lot of computer vision and so

00:45:21.431 --> 00:45:22.700
that's always what occurs to me.

00:45:24.630 --> 00:45:29.090
But this is an object detection case,

00:45:29.090 --> 00:45:29.760
so.

00:45:30.620 --> 00:45:33.770
The method here it's like called

00:45:33.770 --> 00:45:35.790
sliding window object detection which

00:45:35.790 --> 00:45:37.370
you can visualize it as like you have

00:45:37.370 --> 00:45:38.853
some image and you take a little window

00:45:38.853 --> 00:45:41.230
and you slide it across the image and

00:45:41.230 --> 00:45:43.250
you extract a patch at each position.

00:45:44.180 --> 00:45:45.990
And then you rescale the image and do

00:45:45.990 --> 00:45:46.550
it again.

00:45:46.550 --> 00:45:48.467
So you end up with like a whole.

00:45:48.467 --> 00:45:50.290
You turn the image into a whole bunch

00:45:50.290 --> 00:45:53.290
of different patches of the same size.

00:45:54.400 --> 00:45:56.830
After rescaling them, but that

00:45:56.830 --> 00:45:59.690
correspond to different different

00:45:59.690 --> 00:46:01.650
overlapping patches at different

00:46:01.650 --> 00:46:03.170
positions and scales in the original

00:46:03.170 --> 00:46:03.550
image.

00:46:04.270 --> 00:46:06.360
And then for each of those patches you

00:46:06.360 --> 00:46:08.840
have to classify it as being the object

00:46:08.840 --> 00:46:10.470
of interest or not, in this case of

00:46:10.470 --> 00:46:11.120
pedestrian.

00:46:12.070 --> 00:46:14.830
Where pedestrian just means person.

00:46:14.830 --> 00:46:16.970
These aren't actually necessarily

00:46:16.970 --> 00:46:18.480
pedestrians like this guy's not on the

00:46:18.480 --> 00:46:19.000
road, but.

00:46:19.960 --> 00:46:20.846
This person.

00:46:20.846 --> 00:46:24.290
So these are all examples of patches

00:46:24.290 --> 00:46:26.126
that you would want to classify as a

00:46:26.126 --> 00:46:26.464
person.

00:46:26.464 --> 00:46:28.490
So you can see it's kind of difficult

00:46:28.490 --> 00:46:30.190
because there could be lots of

00:46:30.190 --> 00:46:31.880
different backgrounds or other people

00:46:31.880 --> 00:46:34.030
in the way and you have to distinguish

00:46:34.030 --> 00:46:36.580
it from like a fire hydrant that's like

00:46:36.580 --> 00:46:37.953
pretty far away and looks kind of

00:46:37.953 --> 00:46:39.420
person like or a lamp post.

00:46:42.390 --> 00:46:45.400
This method is to like extract

00:46:45.400 --> 00:46:46.330
features.

00:46:46.330 --> 00:46:48.060
Basically you normalize the colors,

00:46:48.060 --> 00:46:49.730
compute gradients, compute the gradient

00:46:49.730 --> 00:46:50.340
orientation.

00:46:50.340 --> 00:46:51.550
I'll show you an illustration in the

00:46:51.550 --> 00:46:53.760
next slide and then you apply a linear

00:46:53.760 --> 00:46:54.290
SVM.

00:46:55.040 --> 00:46:56.450
And so for each of these windows you

00:46:56.450 --> 00:46:57.902
want to say it's a person or not a

00:46:57.902 --> 00:46:58.098
person.

00:46:58.098 --> 00:46:59.840
So you train on some training set of

00:46:59.840 --> 00:47:01.400
images where you have some people that

00:47:01.400 --> 00:47:02.100
are annotated.

00:47:02.770 --> 00:47:04.650
And then you test on some held out set.

00:47:06.300 --> 00:47:09.515
So this is the feature representation.

00:47:09.515 --> 00:47:11.920
It's basically like where are the edges

00:47:11.920 --> 00:47:14.170
and the image and the patch and how

00:47:14.170 --> 00:47:15.470
strong are they and what are their

00:47:15.470 --> 00:47:16.185
orientations.

00:47:16.185 --> 00:47:18.460
It's called a hog or histogram of

00:47:18.460 --> 00:47:20.460
gradients representation.

00:47:21.200 --> 00:47:23.930
And this paper is cited over 40,000

00:47:23.930 --> 00:47:24.610
times.

00:47:24.610 --> 00:47:26.670
It's mostly for the hog features, but

00:47:26.670 --> 00:47:28.790
it was also the most effective person

00:47:28.790 --> 00:47:29.840
detector for a while.

00:47:34.610 --> 00:47:38.876
So it it's very effective.

00:47:38.876 --> 00:47:42.730
So these plots are the X axis is the

00:47:42.730 --> 00:47:44.432
number of false positives per window.

00:47:44.432 --> 00:47:47.180
So it's a chance that you misclassify

00:47:47.180 --> 00:47:49.040
one of these windows as a person when

00:47:49.040 --> 00:47:50.117
it's not really a person.

00:47:50.117 --> 00:47:52.460
It's like a fire hydrant or random

00:47:52.460 --> 00:47:53.520
leaves or something else.

00:47:54.660 --> 00:47:58.600
X axis, Y axis is the miss rate, which

00:47:58.600 --> 00:48:01.480
is the number of true people that you

00:48:01.480 --> 00:48:02.440
fail to detect.

00:48:03.080 --> 00:48:05.160
So the fact that it's way down here

00:48:05.160 --> 00:48:07.560
basically means that it never makes any

00:48:07.560 --> 00:48:09.630
mistakes on this data set, so it can

00:48:09.630 --> 00:48:13.110
classify it gets 99.8% of the fines,

00:48:13.110 --> 00:48:16.730
99.8% of the people, and almost never

00:48:16.730 --> 00:48:17.860
has false positives.

00:48:18.900 --> 00:48:20.400
That was on this MIT database.

00:48:21.040 --> 00:48:23.154
Then there's another data set which was

00:48:23.154 --> 00:48:25.140
like more, which was harder.

00:48:25.140 --> 00:48:27.490
Those were the examples I showed of St.

00:48:27.490 --> 00:48:29.170
scenes and more crowded scenes.

00:48:29.860 --> 00:48:32.870
And they're the previous approaches had

00:48:32.870 --> 00:48:35.230
like pretty high false positive rates.

00:48:35.230 --> 00:48:38.340
So as a rule of thumb I would say

00:48:38.340 --> 00:48:43.090
there's typically about 10,000 windows

00:48:43.090 --> 00:48:43.780
per image.

00:48:44.480 --> 00:48:46.427
So if you have like a false positive

00:48:46.427 --> 00:48:48.755
rate of 10 to the -, 4, that means that

00:48:48.755 --> 00:48:50.555
you make one mistake on every single

00:48:50.555 --> 00:48:50.920
image.

00:48:50.920 --> 00:48:51.650
On average.

00:48:51.650 --> 00:48:53.400
You like think that there's one person

00:48:53.400 --> 00:48:55.080
where there isn't anybody on average

00:48:55.080 --> 00:48:55.985
once per image.

00:48:55.985 --> 00:48:57.410
So that's kind of a that's an

00:48:57.410 --> 00:48:58.490
unacceptable rate.

00:48:59.950 --> 00:49:02.723
But this method is able to get like 10

00:49:02.723 --> 00:49:06.380
to the -, 6 which is a pretty good rate

00:49:06.380 --> 00:49:09.230
and still find like 70% of the people.

00:49:10.030 --> 00:49:11.400
So these like.

00:49:12.320 --> 00:49:14.665
These curves that are clustered here

00:49:14.665 --> 00:49:17.020
are all different SVMS.

00:49:17.020 --> 00:49:20.970
Linear SVMS, they also do.

00:49:21.040 --> 00:49:21.800


00:49:22.760 --> 00:49:23.060
Weight.

00:49:23.060 --> 00:49:23.930
Linear.

00:49:23.930 --> 00:49:25.860
Yeah, so the black one here is a

00:49:25.860 --> 00:49:28.110
kernelized SVM, which performs very

00:49:28.110 --> 00:49:30.130
similarly, but takes a lot longer to

00:49:30.130 --> 00:49:32.340
train and do inference, so it wouldn't

00:49:32.340 --> 00:49:32.890
be referred.

00:49:33.880 --> 00:49:35.790
And then the other previous approaches

00:49:35.790 --> 00:49:36.870
are doing worse.

00:49:36.870 --> 00:49:38.500
They have like higher false positives

00:49:38.500 --> 00:49:39.960
rates for the same detection rate.

00:49:42.860 --> 00:49:44.470
So that was just that was just one

00:49:44.470 --> 00:49:46.832
example, but as I said like SVMS where

00:49:46.832 --> 00:49:49.080
the dominant I think the most commonly

00:49:49.080 --> 00:49:50.903
used, I wouldn't say dominant, but most

00:49:50.903 --> 00:49:53.510
commonly used classifier for several

00:49:53.510 --> 00:49:53.930
years.

00:49:56.330 --> 00:49:58.440
So SVMS are good broadly applicable

00:49:58.440 --> 00:49:58.782
classifier.

00:49:58.782 --> 00:50:00.780
They have a strong foundation in

00:50:00.780 --> 00:50:01.970
statistical learning theory.

00:50:01.970 --> 00:50:04.000
They work even if you have a lot of

00:50:04.000 --> 00:50:05.480
weak features.

00:50:05.480 --> 00:50:08.400
You do have to tune the parameters like

00:50:08.400 --> 00:50:10.470
C and that can be time consuming.

00:50:11.160 --> 00:50:13.390
And if you're using nonlinear SVM, then

00:50:13.390 --> 00:50:14.817
you have to decide what kernel function

00:50:14.817 --> 00:50:16.560
you're going to use, which may involve

00:50:16.560 --> 00:50:19.010
even more tuning in it, and it means

00:50:19.010 --> 00:50:20.150
that it's going to be a slow

00:50:20.150 --> 00:50:21.940
optimization and slower inference.

00:50:22.860 --> 00:50:24.680
The main negatives of SVM, the

00:50:24.680 --> 00:50:25.550
downsides.

00:50:25.550 --> 00:50:27.160
It doesn't have feature learning as

00:50:27.160 --> 00:50:29.580
part of the framework, where trees for

00:50:29.580 --> 00:50:30.750
example, you're kind of learning

00:50:30.750 --> 00:50:32.620
features and for neural Nets you are as

00:50:32.620 --> 00:50:32.930
well.

00:50:33.770 --> 00:50:38.430
And it also can took could be very slow

00:50:38.430 --> 00:50:39.010
to train.

00:50:40.290 --> 00:50:42.930
Until Pegasus, which is the next thing

00:50:42.930 --> 00:50:44.510
that I'm talking about, South, this was

00:50:44.510 --> 00:50:46.660
like a much faster and simpler way to

00:50:46.660 --> 00:50:47.790
train these algorithms.

00:50:49.220 --> 00:50:50.755
So I'm not going to talk about the bad

00:50:50.755 --> 00:50:53.270
ways or they're slow ways to optimize

00:50:53.270 --> 00:50:53.380
it.

00:50:54.360 --> 00:50:56.750
So this is so the next thing I'm going

00:50:56.750 --> 00:50:57.710
to talk about.

00:50:57.980 --> 00:51:01.350
Is called Pegasus which is how you can

00:51:01.350 --> 00:51:04.100
optimize the SVM and it stands for

00:51:04.100 --> 00:51:06.510
primal estimated subgradient solver for

00:51:06.510 --> 00:51:07.360
SVM, so.

00:51:09.020 --> 00:51:11.095
Primal because you're solving it in the

00:51:11.095 --> 00:51:12.660
primal formulation where you're

00:51:12.660 --> 00:51:14.540
minimizing the weights and the margin.

00:51:15.460 --> 00:51:16.840
Estimated because that's where you're.

00:51:17.900 --> 00:51:20.090
The subgradient is because you're going

00:51:20.090 --> 00:51:21.860
to you're going to make decisions based

00:51:21.860 --> 00:51:24.970
on a subsample of the training data.

00:51:24.970 --> 00:51:27.030
So you're trying to take a step in the

00:51:27.030 --> 00:51:29.000
right direction based on a few training

00:51:29.000 --> 00:51:31.710
examples to solver for SVM.

00:51:33.540 --> 00:51:36.790
I found out yesterday when I was look

00:51:36.790 --> 00:51:39.460
searching for the paper that Pegasus is

00:51:39.460 --> 00:51:42.260
also like an assisted suicide system in

00:51:42.260 --> 00:51:42.880
Switzerland.

00:51:42.880 --> 00:51:45.420
So it's kind of an unfortunate name,

00:51:45.420 --> 00:51:46.820
unfortunate acronym.

00:51:48.920 --> 00:51:49.520
And.

00:51:50.550 --> 00:51:54.150
So the so this is the SVM problem that

00:51:54.150 --> 00:51:56.160
we want to solve, minimize the weights

00:51:56.160 --> 00:52:00.000
and while also minimizing the hinge

00:52:00.000 --> 00:52:01.260
loss on all the samples.

00:52:02.510 --> 00:52:04.200
But we can reframe this.

00:52:04.200 --> 00:52:06.780
We can reframe it in terms of one

00:52:06.780 --> 00:52:07.110
example.

00:52:07.110 --> 00:52:09.297
So we could say, well, let's say we

00:52:09.297 --> 00:52:10.870
want to minimize the weights and we

00:52:10.870 --> 00:52:12.706
want to minimize the loss for one

00:52:12.706 --> 00:52:13.079
example.

00:52:14.410 --> 00:52:17.200
Then we can ask like how would I change

00:52:17.200 --> 00:52:19.630
the weights if that were my objective?

00:52:19.630 --> 00:52:21.897
And if you want to know how you can

00:52:21.897 --> 00:52:23.913
improve something, improve some

00:52:23.913 --> 00:52:25.230
objective with respect to some

00:52:25.230 --> 00:52:25.780
variable.

00:52:26.670 --> 00:52:27.890
Then what you do is you take the

00:52:27.890 --> 00:52:30.260
partial derivative of the objective

00:52:30.260 --> 00:52:33.330
with respect to the variable, and if

00:52:33.330 --> 00:52:35.285
you want the objective to go down, this

00:52:35.285 --> 00:52:36.440
is like a loss function.

00:52:36.440 --> 00:52:38.090
So we wanted to go down.

00:52:38.090 --> 00:52:40.763
So I want to find the derivative with

00:52:40.763 --> 00:52:42.670
respect to my variable, in this case

00:52:42.670 --> 00:52:45.680
the weights, and I want to take a small

00:52:45.680 --> 00:52:47.450
step in the negative direction of that

00:52:47.450 --> 00:52:49.262
gradient of that derivative.

00:52:49.262 --> 00:52:51.750
So that will make my objective just a

00:52:51.750 --> 00:52:52.400
little bit better.

00:52:52.400 --> 00:52:53.990
It'll make my loss a little bit lower.

00:52:56.470 --> 00:52:58.690
And if I compute the gradient of this

00:52:58.690 --> 00:53:01.440
objective with respect to West.

00:53:02.110 --> 00:53:06.610
So the gradient of West squared is just

00:53:06.610 --> 00:53:10.502
is just two WI mean and also the

00:53:10.502 --> 00:53:11.210
gradient of.

00:53:11.210 --> 00:53:13.360
Again vector math like.

00:53:13.360 --> 00:53:15.750
You might not be familiar with doing

00:53:15.750 --> 00:53:17.440
like gradients of vectors and stuff,

00:53:17.440 --> 00:53:19.350
but it often works out kind of

00:53:19.350 --> 00:53:20.800
analogous to the scalars.

00:53:20.800 --> 00:53:23.385
So the gradient of W transpose W is

00:53:23.385 --> 00:53:24.130
also W.

00:53:26.290 --> 00:53:29.515
This loss function is this margin which

00:53:29.515 --> 00:53:30.850
is just Y of.

00:53:30.850 --> 00:53:32.650
This is like a dot product W transpose

00:53:32.650 --> 00:53:33.000
X.

00:53:34.380 --> 00:53:36.690
So the gradient of this with respect to

00:53:36.690 --> 00:53:39.770
West is.

00:53:39.830 --> 00:53:41.590
Negative YX, right?

00:53:42.320 --> 00:53:45.880
And so my gradient if I've got this Max

00:53:45.880 --> 00:53:46.570
here as well.

00:53:46.570 --> 00:53:49.260
So that means that if I'm already like

00:53:49.260 --> 00:53:50.890
confidently correct, then I have no

00:53:50.890 --> 00:53:52.780
loss so my gradient is 0.

00:53:53.620 --> 00:53:55.800
If I'm not confidently correct, if I'm

00:53:55.800 --> 00:53:58.380
within the margin of 1 then I have this

00:53:58.380 --> 00:54:01.630
loss and the size of this.

00:54:03.400 --> 00:54:06.490
The size of the size of the gradient.

00:54:07.180 --> 00:54:11.210
Is just one, has a magnitude of 1 and

00:54:11.210 --> 00:54:13.750
the direction because my hinge loss has

00:54:13.750 --> 00:54:14.320
this.

00:54:15.400 --> 00:54:17.315
So the size do the hinge loss is just

00:54:17.315 --> 00:54:18.900
one because the hinge loss just has a

00:54:18.900 --> 00:54:20.250
gradient of 1, it's just a straight

00:54:20.250 --> 00:54:20.550
line.

00:54:21.620 --> 00:54:24.950
And then the of this is YX, right?

00:54:24.950 --> 00:54:28.825
The gradient of YW transpose X is YX

00:54:28.825 --> 00:54:31.797
and so I get this gradient here, which

00:54:31.797 --> 00:54:35.696
is it's a 0 if my margin is good enough

00:54:35.696 --> 00:54:36.963
and it's a one.

00:54:36.963 --> 00:54:40.300
This term is A1 if I'm under the

00:54:40.300 --> 00:54:40.630
margin.

00:54:41.520 --> 00:54:44.500
Times Y which is one or - 1 depending

00:54:44.500 --> 00:54:46.419
on the label, times X which is the

00:54:46.420 --> 00:54:47.060
feature vector.

00:54:47.900 --> 00:54:48.830
So in other words.

00:54:49.930 --> 00:54:52.720
If I'm not happy with my score right

00:54:52.720 --> 00:54:56.070
now and let's say let's say W transpose

00:54:56.070 --> 00:54:58.690
X is oh .5 and y = 1.

00:54:59.660 --> 00:55:02.116
And let's say that X is positive, then

00:55:02.116 --> 00:55:06.612
I want to increase WA bit and if I

00:55:06.612 --> 00:55:09.710
increase WA bit then I'm going to.

00:55:10.070 --> 00:55:13.230
Increase my score or increase like the

00:55:13.230 --> 00:55:16.060
output of my linear model, which will

00:55:16.060 --> 00:55:18.380
then better satisfy the margin.

00:55:21.030 --> 00:55:23.160
And then I'm going to take.

00:55:23.160 --> 00:55:25.380
So this is just the gradient here

00:55:25.380 --> 00:55:27.760
Lambda times W Plus this thing that I

00:55:27.760 --> 00:55:28.740
just talked about.

00:55:30.920 --> 00:55:32.630
So we're going to use this to do what's

00:55:32.630 --> 00:55:34.300
called gradient descent.

00:55:35.500 --> 00:55:37.820
SGD stands for stochastic gradient

00:55:37.820 --> 00:55:38.310
descent.

00:55:39.280 --> 00:55:41.050
And I'll explain what stochastic, why

00:55:41.050 --> 00:55:43.420
it's stochastic, and a little bit.

00:55:43.420 --> 00:55:45.690
But this is like a nice illustration of

00:55:45.690 --> 00:55:47.990
gradient descent, basically.

00:55:48.700 --> 00:55:50.213
You visualize.

00:55:50.213 --> 00:55:52.600
You can mentally visualize it as you've

00:55:52.600 --> 00:55:53.270
got some.

00:55:54.370 --> 00:55:56.200
You've got some surface of your loss

00:55:56.200 --> 00:55:58.070
function, so depending on what your

00:55:58.070 --> 00:55:59.630
model is, you would have different

00:55:59.630 --> 00:56:00.220
losses.

00:56:00.950 --> 00:56:02.500
And so here it's just like if your

00:56:02.500 --> 00:56:04.600
model just has two parameters, then you

00:56:04.600 --> 00:56:07.400
can visualize this as like a 3D surface

00:56:07.400 --> 00:56:09.070
where the height is your loss.

00:56:09.730 --> 00:56:13.420
And the position XY position on this is

00:56:13.420 --> 00:56:14.950
the parameters.

00:56:16.390 --> 00:56:17.730
And gradient descent, you're just

00:56:17.730 --> 00:56:19.269
trying to roll down the hill.

00:56:19.270 --> 00:56:20.590
That's why I had a ball rolling down

00:56:20.590 --> 00:56:21.950
the hill on the first slide.

00:56:22.510 --> 00:56:25.710
And you try to every position you

00:56:25.710 --> 00:56:26.990
calculate gradient.

00:56:26.990 --> 00:56:29.070
That's the direction of the slope and

00:56:29.070 --> 00:56:29.830
its speed.

00:56:30.430 --> 00:56:32.240
And then you take a little step in the

00:56:32.240 --> 00:56:34.020
direction of that gradient downward.

00:56:35.560 --> 00:56:38.370
And there's a common terms that you'll

00:56:38.370 --> 00:56:40.532
hear in this kind of optimization are

00:56:40.532 --> 00:56:43.300
like global optimum and local optimum.

00:56:43.300 --> 00:56:45.956
So a global optimum is the lowest point

00:56:45.956 --> 00:56:48.780
in the whole like surface of solutions.

00:56:49.890 --> 00:56:51.660
That's where you want to go in.

00:56:51.660 --> 00:56:54.606
A local optimum means that if you have

00:56:54.606 --> 00:56:56.960
that solution then you can't improve it

00:56:56.960 --> 00:56:58.840
by taking a small step anywhere.

00:56:58.840 --> 00:57:00.460
So you have to go up the hill before

00:57:00.460 --> 00:57:01.320
you can go down the hill.

00:57:02.030 --> 00:57:04.613
So this is a global optimum here and

00:57:04.613 --> 00:57:06.329
this is a local optimum.

00:57:06.330 --> 00:57:09.720
Now SVMS, SVMS are just like a big

00:57:09.720 --> 00:57:10.430
bowl.

00:57:10.430 --> 00:57:11.650
They are convex.

00:57:11.650 --> 00:57:13.810
It's a convex problem where they're the

00:57:13.810 --> 00:57:15.820
only local optimum is global optimum.

00:57:16.960 --> 00:57:18.620
And so with the suitable optimization

00:57:18.620 --> 00:57:20.090
algorithm you should always be able to

00:57:20.090 --> 00:57:21.540
find the best solution.

00:57:22.320 --> 00:57:25.260
But neural networks, which we'll get to

00:57:25.260 --> 00:57:28.460
later, are like really bumpy, and so

00:57:28.460 --> 00:57:29.870
the optimization is much harder.

00:57:33.810 --> 00:57:36.080
So finally, this is the Pegasus

00:57:36.080 --> 00:57:38.380
algorithm for stochastic gradient

00:57:38.380 --> 00:57:38.920
descent.

00:57:39.910 --> 00:57:40.490
And.

00:57:41.120 --> 00:57:43.309
Fortunately, it's kind of it's kind of

00:57:43.310 --> 00:57:46.490
short, it's a simple algorithm, but it

00:57:46.490 --> 00:57:47.790
takes a little bit of explanation.

00:57:48.710 --> 00:57:50.200
Just laughing because my daughter has

00:57:50.200 --> 00:57:52.720
this book, fortunately, unfortunately,

00:57:52.720 --> 00:57:53.360
where?

00:57:54.040 --> 00:57:57.710
Fortunately, unfortunately, the he gets

00:57:57.710 --> 00:57:58.100
an airplane.

00:57:58.100 --> 00:58:00.041
The engine exploded, fortunately at a

00:58:00.041 --> 00:58:00.353
parachute.

00:58:00.353 --> 00:58:02.552
Unfortunately there is a hole in the

00:58:02.552 --> 00:58:02.933
parachute.

00:58:02.933 --> 00:58:05.110
Fortunately there is a haystack below

00:58:05.110 --> 00:58:05.380
him.

00:58:05.380 --> 00:58:07.500
Unfortunately there is a pitchfork in

00:58:07.500 --> 00:58:08.080
haystack.

00:58:08.080 --> 00:58:09.490
Just goes on like that for the whole

00:58:09.490 --> 00:58:10.010
book.

00:58:10.990 --> 00:58:12.700
It's really funny, so fortunately this

00:58:12.700 --> 00:58:13.420
is short.

00:58:13.420 --> 00:58:15.490
Unfortunately, it still may be hard to

00:58:15.490 --> 00:58:16.190
understand.

00:58:16.990 --> 00:58:18.760
And so the.

00:58:18.760 --> 00:58:21.250
So we have a training set here.

00:58:21.250 --> 00:58:23.280
These are the input training examples.

00:58:23.940 --> 00:58:25.950
I've got some regularization weight and

00:58:25.950 --> 00:58:27.380
I have some number of iterations that

00:58:27.380 --> 00:58:28.030
I'm going to do.

00:58:28.850 --> 00:58:30.370
And I initialize the weights to be

00:58:30.370 --> 00:58:31.120
zeros.

00:58:31.120 --> 00:58:32.630
These are the weights in my model.

00:58:33.290 --> 00:58:35.220
And then I step through each iteration.

00:58:36.070 --> 00:58:38.270
And I choose some sample.

00:58:39.280 --> 00:58:41.140
Uniformly at random, so I just choose

00:58:41.140 --> 00:58:43.170
one single training sample from my data

00:58:43.170 --> 00:58:43.480
set.

00:58:44.310 --> 00:58:48.440
And then I set my learning rate which

00:58:48.440 --> 00:58:49.100
is.

00:58:49.180 --> 00:58:49.790


00:58:52.030 --> 00:58:54.220
Or I should say, I guess that's it.

00:58:54.220 --> 00:58:55.720
So I choose some samples from my data

00:58:55.720 --> 00:58:56.220
set.

00:58:56.220 --> 00:58:57.840
Then I set my learning rate which is

00:58:57.840 --> 00:59:00.520
one over Lambda T so basically my step

00:59:00.520 --> 00:59:02.945
size is going to get smaller the more

00:59:02.945 --> 00:59:04.200
samples that I process.

00:59:06.200 --> 00:59:10.200
And if my margin is less than one, that

00:59:10.200 --> 00:59:12.330
means that I'm not happy with my score

00:59:12.330 --> 00:59:13.330
for that example.

00:59:14.120 --> 00:59:16.990
So I increment my weights by 1 minus

00:59:16.990 --> 00:59:20.828
ETA Lambda W so this is the.

00:59:20.828 --> 00:59:22.833
This part is just saying that I want my

00:59:22.833 --> 00:59:24.160
weights to get smaller in general

00:59:24.160 --> 00:59:25.760
because I'm trying to minimize the

00:59:25.760 --> 00:59:27.760
squared weights and that's based on the

00:59:27.760 --> 00:59:29.570
derivative of W transpose W.

00:59:30.480 --> 00:59:32.370
And then this part is saying I also

00:59:32.370 --> 00:59:34.180
want to improve my score for this

00:59:34.180 --> 00:59:36.110
example, so I add.

00:59:37.400 --> 00:59:44.440
I add ETA YX so if X is positive then

00:59:44.440 --> 00:59:46.712
I'm going to increase and Y is

00:59:46.712 --> 00:59:48.340
positive, then I'm going to increase

00:59:48.340 --> 00:59:50.790
the weight so that it becomes so that X

00:59:50.790 --> 00:59:51.920
becomes more positive.

00:59:52.550 --> 00:59:54.970
Is positive and Y is negative, then I'm

00:59:54.970 --> 00:59:57.438
going to decrease the weight so that so

00:59:57.438 --> 00:59:59.634
that X becomes less positive, more

00:59:59.634 --> 01:00:00.940
negative and more correct.

01:00:02.430 --> 01:00:04.410
And then if I'm happy with my score of

01:00:04.410 --> 01:00:06.830
the example, it's outside the margin YW

01:00:06.830 --> 01:00:07.750
transpose X.

01:00:08.950 --> 01:00:12.040
Is greater or equal to 1, then I only

01:00:12.040 --> 01:00:13.750
care about this regularization term, so

01:00:13.750 --> 01:00:15.010
I'm just going to make the weight a

01:00:15.010 --> 01:00:17.100
little bit smaller because I'm trying

01:00:17.100 --> 01:00:18.590
to again minimize the square of the

01:00:18.590 --> 01:00:18.850
weights.

01:00:20.220 --> 01:00:21.500
So I just that's it.

01:00:21.500 --> 01:00:23.145
I just stepped through all the

01:00:23.145 --> 01:00:23.420
examples.

01:00:23.420 --> 01:00:25.615
It's like a pretty short optimization.

01:00:25.615 --> 01:00:27.750
And what I'm doing is I'm just like

01:00:27.750 --> 01:00:30.530
incrementally trying to improve my

01:00:30.530 --> 01:00:32.479
solution for each example that I

01:00:32.480 --> 01:00:33.490
encounter.

01:00:33.490 --> 01:00:37.459
And what's not intuitive maybe is that

01:00:37.460 --> 01:00:38.810
theoretically you can show that this

01:00:38.810 --> 01:00:42.970
eventually improves gives you the best

01:00:42.970 --> 01:00:44.860
possible weights for all your examples.

01:00:47.930 --> 01:00:49.640
There's a there's another version of

01:00:49.640 --> 01:00:52.180
this where you use what's called a mini

01:00:52.180 --> 01:00:52.770
batch.

01:00:53.580 --> 01:00:55.290
We're just instead of sampling.

01:00:55.290 --> 01:00:57.165
Instead of taking one sample at a time,

01:00:57.165 --> 01:00:59.165
one training sample at a time, you take

01:00:59.165 --> 01:01:01.280
a whole set at a time of random set of

01:01:01.280 --> 01:01:01.930
examples.

01:01:03.000 --> 01:01:06.970
And then you take instead of instead of

01:01:06.970 --> 01:01:09.660
this term involving like the margin

01:01:09.660 --> 01:01:13.570
loss of one example involves the

01:01:13.570 --> 01:01:16.564
average of those losses for all the

01:01:16.564 --> 01:01:17.999
examples that violate the margin.

01:01:18.000 --> 01:01:23.340
So you're taking the average of YXI

01:01:23.340 --> 01:01:24.750
where these are the examples in your

01:01:24.750 --> 01:01:26.530
mini batch that violate the margin.

01:01:27.200 --> 01:01:29.270
And multiplying by ETA and adding it to

01:01:29.270 --> 01:01:29.640
West.

01:01:30.740 --> 01:01:32.470
So if your batch size is 1, it's the

01:01:32.470 --> 01:01:34.900
exact same algorithm as before, but by

01:01:34.900 --> 01:01:36.600
averaging your gradient over multiple

01:01:36.600 --> 01:01:38.220
examples you get a more stable

01:01:38.220 --> 01:01:39.230
optimization.

01:01:39.230 --> 01:01:41.250
And it can also be faster if you're

01:01:41.250 --> 01:01:44.800
able to parallelize your algorithm like

01:01:44.800 --> 01:01:47.470
you can with multiple GPUs, I mean CPUs

01:01:47.470 --> 01:01:48.120
or GPU.

01:01:52.450 --> 01:01:53.580
Any questions about that?

01:01:55.250 --> 01:01:55.480
Yeah.

01:01:56.770 --> 01:01:57.310
When it comes to.

01:01:58.820 --> 01:02:01.350
Divide the regular regularization

01:02:01.350 --> 01:02:02.740
constant by the mini batch.

01:02:04.020 --> 01:02:05.420
An.

01:02:05.770 --> 01:02:07.330
Just into when you're updating the

01:02:07.330 --> 01:02:07.680
weights.

01:02:10.790 --> 01:02:12.510
The average of that badge is not just

01:02:12.510 --> 01:02:15.110
like stochastic versus 1, right?

01:02:15.110 --> 01:02:17.145
So are you saying should you be taking

01:02:17.145 --> 01:02:19.781
like a bigger, are you saying should

01:02:19.781 --> 01:02:21.789
you change like how much weight you

01:02:21.790 --> 01:02:25.350
assign to this guy where you're trying

01:02:25.350 --> 01:02:26.350
to reduce the weight?

01:02:28.150 --> 01:02:30.930
Divided by the batch size by bad.

01:02:32.390 --> 01:02:32.960
This update.

01:02:34.290 --> 01:02:36.460
After 10 and then so you divide it by

01:02:36.460 --> 01:02:36.970
10.

01:02:36.970 --> 01:02:37.370
OK.

01:02:38.230 --> 01:02:39.950
You could do that.

01:02:39.950 --> 01:02:41.090
I mean this also.

01:02:41.090 --> 01:02:42.813
You don't have to have a 1 / K here,

01:02:42.813 --> 01:02:44.540
this could be just the sum.

01:02:44.540 --> 01:02:47.270
So here they averaged out the

01:02:47.270 --> 01:02:48.240
gradients.

01:02:48.300 --> 01:02:48.930
And.

01:02:49.910 --> 01:02:53.605
And also like sometimes, depending on

01:02:53.605 --> 01:02:56.210
your batch size, your ideal learning

01:02:56.210 --> 01:02:58.040
rate and other regularizations can

01:02:58.040 --> 01:02:58.970
sometimes change.

01:03:03.220 --> 01:03:07.570
So we saw SGD stochastic gradient

01:03:07.570 --> 01:03:10.420
descent for the hinge loss with, which

01:03:10.420 --> 01:03:11.740
is what the SVM uses.

01:03:13.340 --> 01:03:15.110
It's nice for the hinge loss because

01:03:15.110 --> 01:03:17.155
there's no gradient for incorrect or

01:03:17.155 --> 01:03:19.020
for confidently correct examples, so

01:03:19.020 --> 01:03:21.280
you only have to optimize over the ones

01:03:21.280 --> 01:03:22.310
that are within the margin.

01:03:24.320 --> 01:03:27.270
But you can also compute the gradients

01:03:27.270 --> 01:03:29.265
for all these other kinds of losses,

01:03:29.265 --> 01:03:30.830
like whoops, like the logistic

01:03:30.830 --> 01:03:32.810
regression loss or sigmoid loss.

01:03:35.540 --> 01:03:37.620
Another logistic loss, another kind of

01:03:37.620 --> 01:03:39.260
margin loss.

01:03:39.260 --> 01:03:40.730
These are not things that you should

01:03:40.730 --> 01:03:41.400
ever memorize.

01:03:41.400 --> 01:03:42.570
Or you can memorize them.

01:03:42.570 --> 01:03:44.470
I won't hold it against you, but.

01:03:45.510 --> 01:03:46.850
But you can always look them up, so

01:03:46.850 --> 01:03:47.820
they're not things you need to

01:03:47.820 --> 01:03:48.160
memorize.

01:03:50.430 --> 01:03:53.380
I will never ask you like what is the?

01:03:53.380 --> 01:03:55.270
I won't ask you like what's the

01:03:55.270 --> 01:03:56.600
gradient of some function.

01:03:58.090 --> 01:03:58.750
And.

01:03:59.660 --> 01:04:02.980
So this is just comparing like the

01:04:02.980 --> 01:04:05.930
optimization speed of the of this

01:04:05.930 --> 01:04:08.160
approach, Pegasus versus other

01:04:08.160 --> 01:04:08.900
optimizers.

01:04:10.000 --> 01:04:14.040
So for example, here's Pegasus.

01:04:14.040 --> 01:04:17.680
It goes like this is time on the X axis

01:04:17.680 --> 01:04:18.493
in seconds.

01:04:18.493 --> 01:04:20.920
So basically you want to get low

01:04:20.920 --> 01:04:22.300
because this is the objective that

01:04:22.300 --> 01:04:23.670
you're trying to minimize.

01:04:23.670 --> 01:04:25.900
So basically Pegasus shoots down to

01:04:25.900 --> 01:04:28.210
zero and like milliseconds and these

01:04:28.210 --> 01:04:29.980
other things are like still chugging

01:04:29.980 --> 01:04:31.940
away like many seconds later.

01:04:33.020 --> 01:04:33.730
And.

01:04:34.530 --> 01:04:37.500
And so consistently if you compare

01:04:37.500 --> 01:04:40.500
Pegasus to SVM perf, which is like

01:04:40.500 --> 01:04:41.920
stands for performance.

01:04:41.920 --> 01:04:45.050
It was a highly optimized SVM library.

01:04:45.940 --> 01:04:49.230
Or LA SVM, which I forget what that

01:04:49.230 --> 01:04:50.030
stands for right now.

01:04:50.740 --> 01:04:53.140
But two different SVM optimizers.

01:04:53.140 --> 01:04:56.056
Pegasus is just way faster you reach

01:04:56.056 --> 01:04:59.710
the you reach the ideal solution really

01:04:59.710 --> 01:05:00.690
really fast.

01:05:02.020 --> 01:05:04.290
The other one that performs just as

01:05:04.290 --> 01:05:06.280
well, if not better.

01:05:06.280 --> 01:05:09.180
Sdca is also a stochastic gradient

01:05:09.180 --> 01:05:13.470
descent method that just also chooses

01:05:13.470 --> 01:05:15.160
the learning rate dynamically instead

01:05:15.160 --> 01:05:16.738
of following a single schedule.

01:05:16.738 --> 01:05:19.080
The learning rate is the step size.

01:05:19.080 --> 01:05:20.460
It's like how much you move in the

01:05:20.460 --> 01:05:21.290
gradient direction.

01:05:24.240 --> 01:05:26.340
And then in terms of the error,

01:05:26.340 --> 01:05:28.440
training time and error, so it's so

01:05:28.440 --> 01:05:30.590
Pegasus is taking like under a second

01:05:30.590 --> 01:05:32.710
for all these different problems where

01:05:32.710 --> 01:05:34.390
some other libraries could take even

01:05:34.390 --> 01:05:35.380
hundreds of seconds.

01:05:36.290 --> 01:05:39.620
And it achieves just as good, if not

01:05:39.620 --> 01:05:42.120
better, error than most of them.

01:05:43.000 --> 01:05:44.800
And in part that's just like even

01:05:44.800 --> 01:05:46.090
though it's a global objective

01:05:46.090 --> 01:05:47.520
function, you have to like choose your

01:05:47.520 --> 01:05:50.120
regularization parameters and other

01:05:50.120 --> 01:05:50.720
parameters.

01:05:51.460 --> 01:05:53.490
And you have to.

01:05:53.860 --> 01:05:56.930
It may be hard to tell when you

01:05:56.930 --> 01:05:58.560
converge exactly, so you can get small

01:05:58.560 --> 01:06:00.180
differences between different

01:06:00.180 --> 01:06:00.800
algorithms.

01:06:04.300 --> 01:06:05.630
And then they also did.

01:06:05.630 --> 01:06:07.590
There's a kernelized version which

01:06:07.590 --> 01:06:07.873
won't.

01:06:07.873 --> 01:06:09.560
I won't go into, but it's the same

01:06:09.560 --> 01:06:10.350
principle.

01:06:10.770 --> 01:06:15.190
And so they're able to get.

01:06:15.300 --> 01:06:15.940


01:06:18.170 --> 01:06:20.520
They're able to use the kernelized

01:06:20.520 --> 01:06:21.960
version to get really good performance.

01:06:21.960 --> 01:06:24.470
So on MNIST for example, which was your

01:06:24.470 --> 01:06:29.010
homework one, they get 6% accuracy, 6%

01:06:29.010 --> 01:06:32.595
error rate using a kernelized SVM with

01:06:32.595 --> 01:06:33.460
a Gaussian kernel.

01:06:34.070 --> 01:06:35.330
So it's essentially just like a

01:06:35.330 --> 01:06:37.070
slightly smarter nearest neighbor

01:06:37.070 --> 01:06:37.850
algorithm.

01:06:40.840 --> 01:06:42.910
And the thing that's notable?

01:06:42.910 --> 01:06:44.210
Actually this takes.

01:06:48.920 --> 01:06:49.513
Kind of interesting.

01:06:49.513 --> 01:06:51.129
So it's not so fast.

01:06:51.130 --> 01:06:51.350
Sorry.

01:06:51.350 --> 01:06:52.590
It's just looking at the times.

01:06:52.590 --> 01:06:54.330
Yeah, so it's not so fast in the

01:06:54.330 --> 01:06:55.390
kernelized version, I guess.

01:06:55.390 --> 01:06:56.080
But it still works.

01:06:56.080 --> 01:06:57.650
I didn't look into that in depth, so

01:06:57.650 --> 01:06:57.965
I'm not.

01:06:57.965 --> 01:06:58.770
I can't explain it.

01:07:01.980 --> 01:07:02.290
Alright.

01:07:02.290 --> 01:07:04.050
And then finally like one other thing

01:07:04.050 --> 01:07:05.820
that they look at is the mini batch

01:07:05.820 --> 01:07:06.270
size.

01:07:06.270 --> 01:07:08.810
So if you as you like sample chunks of

01:07:08.810 --> 01:07:10.420
data and do the optimization with

01:07:10.420 --> 01:07:11.659
respect to each chunk of data.

01:07:12.730 --> 01:07:13.680
If you.

01:07:13.770 --> 01:07:14.430


01:07:15.530 --> 01:07:18.520
This is looking at the.

01:07:19.780 --> 01:07:22.780
At how close do you get to the ideal

01:07:22.780 --> 01:07:23.450
solution?

01:07:24.540 --> 01:07:26.830
And this is the mini batch size.

01:07:26.830 --> 01:07:28.860
So for a pretty big range of mini batch

01:07:28.860 --> 01:07:31.295
sizes you can get like very close to

01:07:31.295 --> 01:07:32.330
the ideal solution.

01:07:33.720 --> 01:07:36.570
So this is making an approximation

01:07:36.570 --> 01:07:39.660
because your every step you're choosing

01:07:39.660 --> 01:07:41.500
your step based on a subset of the

01:07:41.500 --> 01:07:41.860
data.

01:07:42.860 --> 01:07:47.530
But for like a big range of conditions,

01:07:47.530 --> 01:07:49.960
it gives you an ideal solution.

01:07:50.700 --> 01:07:53.459
And these are these are after different

01:07:53.460 --> 01:07:55.635
step length after different numbers of

01:07:55.635 --> 01:07:56.000
iterations.

01:07:56.000 --> 01:07:58.533
So if you do 4K iterations, you're at

01:07:58.533 --> 01:08:00.542
the Black line, 16 K iterations you're

01:08:00.542 --> 01:08:03.083
at the blue, and 64K iterations you're

01:08:03.083 --> 01:08:04.050
at the red.

01:08:05.030 --> 01:08:06.680
And yeah.

01:08:11.670 --> 01:08:13.200
And then they also did an experiment

01:08:13.200 --> 01:08:15.300
showing, like in their original paper,

01:08:15.300 --> 01:08:17.120
you would randomly sample with

01:08:17.120 --> 01:08:18.410
replacement the data.

01:08:18.410 --> 01:08:20.420
But if you randomly sample, if you just

01:08:20.420 --> 01:08:22.100
shuffle your data, essentially for

01:08:22.100 --> 01:08:23.750
what's called a epoch, which is like

01:08:23.750 --> 01:08:25.780
one cycle through the data, then you do

01:08:25.780 --> 01:08:26.250
better.

01:08:26.250 --> 01:08:28.680
So that's All in all optimization

01:08:28.680 --> 01:08:30.367
algorithms that I see now, you

01:08:30.367 --> 01:08:32.386
essentially shuffle the data, iterate

01:08:32.386 --> 01:08:35.440
through all the data and then reshuffle

01:08:35.440 --> 01:08:37.360
it and iterate again and each of those

01:08:37.360 --> 01:08:37.920
iterations.

01:08:37.970 --> 01:08:39.490
To the data is called at epoch.

01:08:41.110 --> 01:08:41.750
Epic.

01:08:41.750 --> 01:08:42.760
I never know how to pronounce it.

01:08:44.260 --> 01:08:46.440
And then they also just showed like

01:08:46.440 --> 01:08:48.363
their learning rate schedule seems to

01:08:48.363 --> 01:08:50.150
like provide much more stable results

01:08:50.150 --> 01:08:51.750
compared to a previous approach that

01:08:51.750 --> 01:08:53.540
would use a fixed learning rate for all

01:08:53.540 --> 01:08:55.200
the for all the iterations.

01:08:58.610 --> 01:09:02.230
So, takeaways and surprising facts

01:09:02.230 --> 01:09:03.190
about Pegasus.

01:09:04.460 --> 01:09:08.480
So it's using this SGD, which could be

01:09:08.480 --> 01:09:11.730
an acronym for sub gradient descent or

01:09:11.730 --> 01:09:13.560
stochastic gradient descent, and it

01:09:13.560 --> 01:09:14.780
applies both ways here.

01:09:15.580 --> 01:09:16.585
It's very simple.

01:09:16.585 --> 01:09:18.160
It's an effective optimization

01:09:18.160 --> 01:09:18.675
algorithm.

01:09:18.675 --> 01:09:20.830
It's probably the most widely used

01:09:20.830 --> 01:09:22.640
optimization algorithm in machine

01:09:22.640 --> 01:09:22.990
learning.

01:09:24.330 --> 01:09:26.230
There's very many variants of it, so

01:09:26.230 --> 01:09:28.590
I'll talk about some like atom in a

01:09:28.590 --> 01:09:30.990
couple classes, but the idea is that

01:09:30.990 --> 01:09:32.540
you just step towards a better solution

01:09:32.540 --> 01:09:34.380
of your parameters based on a small

01:09:34.380 --> 01:09:35.830
sample of the training data

01:09:35.830 --> 01:09:36.550
iteratively.

01:09:37.490 --> 01:09:39.370
It's not very sensitive that mini batch

01:09:39.370 --> 01:09:39.940
size.

01:09:40.990 --> 01:09:43.140
With larger batches you get like more

01:09:43.140 --> 01:09:44.720
stable estimates to the gradient and it

01:09:44.720 --> 01:09:46.560
can be a lot faster if you're doing GPU

01:09:46.560 --> 01:09:47.430
processing.

01:09:47.430 --> 01:09:50.860
So in machine learning and like large

01:09:50.860 --> 01:09:53.470
scale machine learning, deep learning.

01:09:54.150 --> 01:09:56.790
You tend to prefer large batches up to

01:09:56.790 --> 01:09:58.520
what you're GPU memory can hold.

01:09:59.680 --> 01:10:01.620
The same learning schedule is effective

01:10:01.620 --> 01:10:04.120
across many problems, so they're like

01:10:04.120 --> 01:10:05.865
decreasing the learning rate gradually

01:10:05.865 --> 01:10:08.610
is just like generally a good way to

01:10:08.610 --> 01:10:08.900
go.

01:10:08.900 --> 01:10:10.780
It doesn't require a lot of tuning.

01:10:12.550 --> 01:10:15.070
And the thing, so I don't know if it's

01:10:15.070 --> 01:10:17.350
in this paper, but this I forgot to

01:10:17.350 --> 01:10:18.880
mention, this work was done at TTI

01:10:18.880 --> 01:10:21.345
Chicago, so just very new here.

01:10:21.345 --> 01:10:23.890
So one of the first talks they give was

01:10:23.890 --> 01:10:25.540
for our group at UIUC.

01:10:25.540 --> 01:10:27.190
So I remember I remember them talking

01:10:27.190 --> 01:10:27.490
about it.

01:10:28.360 --> 01:10:29.810
And one of the things that's kind of a

01:10:29.810 --> 01:10:30.820
surprising result.

01:10:31.650 --> 01:10:35.390
Is that with this algorithm it's faster

01:10:35.390 --> 01:10:37.880
to train using a larger training set,

01:10:37.880 --> 01:10:40.180
so that's not super intuitive, right?

01:10:41.370 --> 01:10:42.710
In order to get the same test

01:10:42.710 --> 01:10:43.430
performance.

01:10:43.430 --> 01:10:46.990
And the reason is like if you think

01:10:46.990 --> 01:10:49.780
about like a little bit of data, if you

01:10:49.780 --> 01:10:51.970
have a little bit of data, then you

01:10:51.970 --> 01:10:53.540
have to like keep on iterating over

01:10:53.540 --> 01:10:55.450
that same little bit of data and each

01:10:55.450 --> 01:10:57.010
time you iterate over it, you're just

01:10:57.010 --> 01:10:58.330
like learning a little bit new.

01:10:58.330 --> 01:10:59.660
It's like trying to keep on like

01:10:59.660 --> 01:11:00.999
squeezing the same water out of a

01:11:01.000 --> 01:11:01.510
sponge.

01:11:02.560 --> 01:11:04.557
But if you have a lot of data and

01:11:04.557 --> 01:11:06.270
you're cycling through this big thing

01:11:06.270 --> 01:11:08.030
of data, you keep on seeing new things

01:11:08.030 --> 01:11:10.125
as you as you go through the data.

01:11:10.125 --> 01:11:12.290
And so you're learning more, like

01:11:12.290 --> 01:11:14.050
learning more per time.

01:11:14.690 --> 01:11:17.719
So if you have a million examples then,

01:11:17.719 --> 01:11:20.520
and you do like a million steps with

01:11:20.520 --> 01:11:22.220
one example each, then you learn a lot

01:11:22.220 --> 01:11:22.930
new.

01:11:22.930 --> 01:11:25.257
But if you have 10 examples and you do

01:11:25.257 --> 01:11:26.829
a million steps, million steps, then

01:11:26.830 --> 01:11:28.955
you've just seen there's 10 examples

01:11:28.955 --> 01:11:29.830
10,000 times.

01:11:30.660 --> 01:11:32.410
Or something 100,000 times.

01:11:32.410 --> 01:11:36.630
So if you get a larger training set,

01:11:36.630 --> 01:11:38.440
you actually get faster.

01:11:38.440 --> 01:11:40.230
It's faster to get the same test

01:11:40.230 --> 01:11:41.840
performance.

01:11:41.840 --> 01:11:44.020
And where that comes into play is that

01:11:44.020 --> 01:11:45.978
sometimes I'll have somebody say like,

01:11:45.978 --> 01:11:48.355
I don't like, I don't want to, I don't

01:11:48.355 --> 01:11:49.939
want to get more training examples

01:11:49.940 --> 01:11:51.700
because my optimization will take too

01:11:51.700 --> 01:11:52.390
long.

01:11:52.390 --> 01:11:54.650
But actually your optimization will be

01:11:54.650 --> 01:11:56.116
faster if you have more training

01:11:56.116 --> 01:11:57.500
examples, if you're using this kind of

01:11:57.500 --> 01:11:59.090
approach, if what you're trying to do

01:11:59.090 --> 01:12:01.490
is maximize your performance.

01:12:01.550 --> 01:12:02.780
Which is pretty much what you're always

01:12:02.780 --> 01:12:03.160
trying to do.

01:12:04.090 --> 01:12:06.810
So larger training set means faster

01:12:06.810 --> 01:12:07.920
runtime for training.

01:12:10.280 --> 01:12:14.330
So that's all about SVMS and SGDS.

01:12:14.330 --> 01:12:16.640
I know that's a lot to take in, but

01:12:16.640 --> 01:12:18.270
thank you for being patient and

01:12:18.270 --> 01:12:18.590
listening.

01:12:19.300 --> 01:12:21.480
And next week I'm going to start

01:12:21.480 --> 01:12:22.440
talking about neural networks.

01:12:22.440 --> 01:12:23.990
So I'll talk about multilayer

01:12:23.990 --> 01:12:26.450
perceptrons and then some concepts and

01:12:26.450 --> 01:12:28.120
deep networks.

01:12:28.120 --> 01:12:28.800
Thank you.

01:12:28.800 --> 01:12:30.040
Have a good weekend.