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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
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
WEBVTT Kind: captions; Language: en-US

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

00:01:05.170 --> 00:01:05.740
All right.

00:01:05.740 --> 00:01:06.410
Good morning.

00:01:07.400 --> 00:01:08.500
Happy Valentine's Day.

00:01:12.140 --> 00:01:16.250
So let's just start with some thinking.

00:01:16.250 --> 00:01:17.940
Warm up with some review questions.

00:01:17.940 --> 00:01:20.285
So just as a reminder, there's

00:01:20.285 --> 00:01:23.370
questions posted on the main page for

00:01:23.370 --> 00:01:24.250
each of the lectures.

00:01:24.250 --> 00:01:26.230
Couple days, usually after the lecture.

00:01:27.300 --> 00:01:29.060
So they are good review for the exam or

00:01:29.060 --> 00:01:30.350
just to refresh?

00:01:31.620 --> 00:01:34.450
So, first question, these are true,

00:01:34.450 --> 00:01:34.860
false.

00:01:34.860 --> 00:01:36.390
So there's just two answers.

00:01:37.710 --> 00:01:39.710
Unlike SVM, linear and logistic

00:01:39.710 --> 00:01:42.210
regression loss always adds a nonzero

00:01:42.210 --> 00:01:44.280
penalty over all training data points.

00:01:45.300 --> 00:01:46.970
How many people think that's true?

00:01:50.360 --> 00:01:52.040
How many people think it's False?

00:01:54.790 --> 00:01:56.690
I think the abstains have it.

00:01:57.990 --> 00:02:01.560
Alright, so this is true because

00:02:01.560 --> 00:02:03.260
logistic regression you always have a

00:02:03.260 --> 00:02:04.376
log probability loss.

00:02:04.376 --> 00:02:06.000
So that applies to every training

00:02:06.000 --> 00:02:10.595
example, where SVM by contrast only has

00:02:10.595 --> 00:02:12.340
loss on points that are within the

00:02:12.340 --> 00:02:12.590
margin.

00:02:12.590 --> 00:02:14.300
So as long as you're really confident,

00:02:14.300 --> 00:02:16.270
SVM doesn't really care about you.

00:02:16.880 --> 00:02:19.500
But logistic regression still does.

00:02:20.430 --> 00:02:23.670
So second question are we talked about

00:02:23.670 --> 00:02:25.640
the Pegasus algorithm for SVM which is

00:02:25.640 --> 00:02:28.170
doing like a gradient descent where you

00:02:28.170 --> 00:02:30.300
process examples one at a time or in

00:02:30.300 --> 00:02:31.250
small batches?

00:02:31.860 --> 00:02:35.580
And after each Example you compute the

00:02:35.580 --> 00:02:36.370
gradient.

00:02:37.140 --> 00:02:39.830
Of the error for those examples with

00:02:39.830 --> 00:02:41.140
respect to the Weights, and then you

00:02:41.140 --> 00:02:44.110
take a step to reduce your loss.

00:02:45.320 --> 00:02:47.280
That's the Pegasus algorithm when it's

00:02:47.280 --> 00:02:48.250
applied to SVM.

00:02:50.220 --> 00:02:53.900
So is it true?

00:02:53.900 --> 00:02:55.240
I guess I sort of.

00:02:56.480 --> 00:02:59.063
Said part of this, but is it true that

00:02:59.063 --> 00:03:01.170
this increases the computational

00:03:01.170 --> 00:03:03.668
efficiency versus like optimizing over

00:03:03.668 --> 00:03:04.460
the full data set?

00:03:04.460 --> 00:03:06.136
If you were to take a gradient over the

00:03:06.136 --> 00:03:07.589
full data set, True.

00:03:09.720 --> 00:03:10.550
OK, False.

00:03:12.460 --> 00:03:14.290
It's how many people think it's True.

00:03:14.290 --> 00:03:15.260
Put your hand up.

00:03:16.100 --> 00:03:18.100
How many people think it's False?

00:03:18.100 --> 00:03:18.959
Put your hand up.

00:03:18.960 --> 00:03:20.060
I don't think it's False, but I'm

00:03:20.060 --> 00:03:21.712
putting my hand up.

00:03:21.712 --> 00:03:22.690
It's true.

00:03:22.690 --> 00:03:24.016
So it does.

00:03:24.016 --> 00:03:26.230
It does give a big efficiency gain

00:03:26.230 --> 00:03:27.560
because you don't have to keep on

00:03:27.560 --> 00:03:29.205
computing the gradient over all the

00:03:29.205 --> 00:03:31.070
samples, which would be really slow.

00:03:31.070 --> 00:03:32.750
You just have to do it over a small

00:03:32.750 --> 00:03:34.240
number of samples and still take a

00:03:34.240 --> 00:03:34.980
productive step.

00:03:35.730 --> 00:03:38.510
And furthermore, it's a much better

00:03:38.510 --> 00:03:39.550
optimization algorithm.

00:03:39.550 --> 00:03:40.980
It gives you the ability to escape

00:03:40.980 --> 00:03:44.180
local minima to find better solutions,

00:03:44.180 --> 00:03:46.340
even if locally.

00:03:47.620 --> 00:03:49.370
Even if locally, there's nowhere to go

00:03:49.370 --> 00:03:51.480
to improve the total score of your data

00:03:51.480 --> 00:03:51.690
set.

00:03:53.270 --> 00:03:53.580
All right.

00:03:53.580 --> 00:03:56.460
And then the third question, Pegasus

00:03:56.460 --> 00:03:58.350
has a disadvantage that the larger the

00:03:58.350 --> 00:04:00.130
training data set, the slower it can be

00:04:00.130 --> 00:04:02.770
optimized to reach a particular test

00:04:02.770 --> 00:04:03.000
error.

00:04:03.000 --> 00:04:04.020
Is that true or false?

00:04:06.150 --> 00:04:08.710
So how many people think that is true?

00:04:11.020 --> 00:04:12.580
And how many people think that is

00:04:12.580 --> 00:04:12.980
False?

00:04:14.530 --> 00:04:16.290
So there's more falses, and that's

00:04:16.290 --> 00:04:16.705
correct.

00:04:16.705 --> 00:04:18.145
Yeah, it's False.

00:04:18.145 --> 00:04:21.280
The bigger your training set, it means

00:04:21.280 --> 00:04:23.265
that given a certain number of

00:04:23.265 --> 00:04:24.450
iterations, you're just going to see

00:04:24.450 --> 00:04:28.445
more new examples, and so you will take

00:04:28.445 --> 00:04:31.679
more informative steps of your

00:04:31.680 --> 00:04:32.310
gradient.

00:04:32.310 --> 00:04:35.060
And so you're given the same number of

00:04:35.060 --> 00:04:37.415
iterations, you're going to reach a

00:04:37.415 --> 00:04:38.990
given test error faster.

00:04:40.370 --> 00:04:42.340
To fully optimize over the data set,

00:04:42.340 --> 00:04:43.640
it's going to take more time.

00:04:43.640 --> 00:04:46.290
If you want to do say 300 passes

00:04:46.290 --> 00:04:47.804
through the data, then if you have more

00:04:47.804 --> 00:04:49.730
data then it's going to take longer to

00:04:49.730 --> 00:04:51.350
do those 300 passes.

00:04:51.350 --> 00:04:52.960
But you're going to reach the same test

00:04:52.960 --> 00:04:54.680
error a lot faster if you keep getting

00:04:54.680 --> 00:04:56.946
new examples then if you are processing

00:04:56.946 --> 00:04:58.820
the same examples over and over again.

00:05:02.240 --> 00:05:05.480
So the reason, one of the reasons that

00:05:05.480 --> 00:05:08.360
I talked about SVM and Pegasus is as an

00:05:08.360 --> 00:05:10.980
introduction to Perceptrons and MLPS.

00:05:11.790 --> 00:05:14.210
Because the optimization algorithm used

00:05:14.210 --> 00:05:16.260
for used in Pegasus.

00:05:17.060 --> 00:05:18.700
It's the same as what's used for

00:05:18.700 --> 00:05:22.070
Perceptrons and is extended when we do

00:05:22.070 --> 00:05:23.380
Backprop in MLP's.

00:05:24.410 --> 00:05:25.900
So I'm going to talk about what is the

00:05:25.900 --> 00:05:26.360
Perceptron?

00:05:26.360 --> 00:05:28.050
What is an MLP?

00:05:28.050 --> 00:05:29.050
Multilayer perceptron?

00:05:29.970 --> 00:05:32.790
And then how do we optimize it with SGD

00:05:32.790 --> 00:05:34.685
and Back propagation with some examples

00:05:34.685 --> 00:05:36.000
and demos and stuff?

00:05:37.300 --> 00:05:39.733
Alright, so Perceptron is actually just

00:05:39.733 --> 00:05:41.940
a linear classifier or linear

00:05:41.940 --> 00:05:42.670
predictor.

00:05:42.670 --> 00:05:45.490
It's you could say a linear logistic

00:05:45.490 --> 00:05:48.080
regressor is one form of a Perceptron

00:05:48.080 --> 00:05:49.797
and a linear regressor is another form

00:05:49.797 --> 00:05:50.600
of a Perceptron.

00:05:51.830 --> 00:05:54.275
What makes it a Perceptron is just like

00:05:54.275 --> 00:05:56.100
how you think about it or how you draw

00:05:56.100 --> 00:05:56.595
it.

00:05:56.595 --> 00:05:59.290
So in the representation you typically

00:05:59.290 --> 00:06:01.740
see a Perceptron as you have like some

00:06:01.740 --> 00:06:02.115
inputs.

00:06:02.115 --> 00:06:04.420
So these could be like pixels of an

00:06:04.420 --> 00:06:07.870
image, your features, the temperature

00:06:07.870 --> 00:06:09.640
data, whatever the features that you're

00:06:09.640 --> 00:06:10.640
going to use for prediction.

00:06:11.420 --> 00:06:13.179
And then you have some Weights.

00:06:13.180 --> 00:06:15.900
Those get multiplied by the inputs and

00:06:15.900 --> 00:06:16.580
summed up.

00:06:16.580 --> 00:06:18.500
And then you have your output

00:06:18.500 --> 00:06:19.450
prediction.

00:06:19.450 --> 00:06:22.220
And you may have if you have a

00:06:22.220 --> 00:06:25.180
classifier, you would say that if

00:06:25.180 --> 00:06:27.960
Weights X, this is a dot.

00:06:27.960 --> 00:06:29.650
SO dot product is the same as W

00:06:29.650 --> 00:06:32.170
transpose X plus some bias term.

00:06:32.170 --> 00:06:33.890
If it's greater than zero, then you

00:06:33.890 --> 00:06:35.424
predict A1, if it's less than zero, you

00:06:35.424 --> 00:06:36.189
predict a -, 1.

00:06:36.840 --> 00:06:38.316
So it's basically the same as the

00:06:38.316 --> 00:06:40.610
linear SVM, logistic regressor,

00:06:40.610 --> 00:06:42.140
anything any other kind of linear

00:06:42.140 --> 00:06:42.450
model.

00:06:44.690 --> 00:06:46.956
But you draw it as this network, as

00:06:46.956 --> 00:06:48.680
this little tiny network with a bunch

00:06:48.680 --> 00:06:50.180
of Weights and input and output.

00:06:53.260 --> 00:06:54.910
Though whoops.

00:06:54.910 --> 00:06:56.190
Skip something?

00:06:56.190 --> 00:06:56.680
No.

00:06:56.680 --> 00:06:59.530
OK, all right, so how do we optimize

00:06:59.530 --> 00:07:00.566
the Perceptron?

00:07:00.566 --> 00:07:03.010
So let's say you can have different

00:07:03.010 --> 00:07:04.539
error functions on the Perceptron.

00:07:04.540 --> 00:07:06.166
But let's say we have a squared error.

00:07:06.166 --> 00:07:09.010
So the prediction of the Perceptron is.

00:07:09.010 --> 00:07:10.670
Like I said before, it's a linear

00:07:10.670 --> 00:07:12.450
function, so it's a sum of the Weights

00:07:12.450 --> 00:07:14.630
times the inputs plus some bias term.

00:07:16.260 --> 00:07:18.660
And you could have a square a square

00:07:18.660 --> 00:07:20.820
error which says that you want the

00:07:20.820 --> 00:07:22.360
prediction to be close to the target.

00:07:24.240 --> 00:07:25.250
And then?

00:07:26.430 --> 00:07:31.100
So the update rule or the optimization

00:07:31.100 --> 00:07:34.350
is based on taking a step to update

00:07:34.350 --> 00:07:36.010
each of your Weights in order to

00:07:36.010 --> 00:07:38.520
decrease the error for particular

00:07:38.520 --> 00:07:39.200
examples.

00:07:40.470 --> 00:07:42.330
So to do that, we need to take the

00:07:42.330 --> 00:07:44.830
partial derivative of the error with

00:07:44.830 --> 00:07:46.320
respect to each of the Weights.

00:07:48.650 --> 00:07:50.137
And we're going to use the chain rule

00:07:50.137 --> 00:07:50.835
to do that.

00:07:50.835 --> 00:07:52.310
So I put the chain rule here for

00:07:52.310 --> 00:07:52.770
reference.

00:07:52.770 --> 00:07:53.890
So the chain rule says.

00:07:54.630 --> 00:07:57.010
If you have some function of X, that's

00:07:57.010 --> 00:07:59.250
actually a function of a function of X,

00:07:59.250 --> 00:08:00.280
so F of G of X.

00:08:01.110 --> 00:08:04.860
Then the derivative of that function H

00:08:04.860 --> 00:08:07.490
is the derivative of the outer function

00:08:07.490 --> 00:08:09.567
with the arguments of the inner

00:08:09.567 --> 00:08:12.086
function times the derivative of the

00:08:12.086 --> 00:08:12.789
inner function.

00:08:14.210 --> 00:08:16.660
If I apply that Chain Rule here, I've

00:08:16.660 --> 00:08:18.980
got a square function here, so I take

00:08:18.980 --> 00:08:20.290
the derivative of this.

00:08:21.030 --> 00:08:24.599
And I get 2 times the inside, so that's

00:08:24.600 --> 00:08:26.800
my F prime of G of X and that's over

00:08:26.800 --> 00:08:29.140
here, so two times of X -, Y.

00:08:29.990 --> 00:08:32.020
Times the derivative of the inside

00:08:32.020 --> 00:08:34.170
function, which is F of X -, Y.

00:08:34.970 --> 00:08:37.240
And the derivative of this guy with

00:08:37.240 --> 00:08:40.880
respect to WI will just be XI, because

00:08:40.880 --> 00:08:42.387
there's only one term, there's a.

00:08:42.387 --> 00:08:44.930
There's a big sum here, but only one of

00:08:44.930 --> 00:08:48.345
their terms involves WI, and that term

00:08:48.345 --> 00:08:51.005
is wixi, and all the rest are zero.

00:08:51.005 --> 00:08:52.820
I mean, all the rest don't involve it,

00:08:52.820 --> 00:08:53.870
so the derivative is 0.

00:08:54.860 --> 00:08:55.160
Right.

00:08:56.420 --> 00:08:59.840
So this gives me my update rule is 2 *

00:08:59.840 --> 00:09:02.380
F of X -, y times XI.

00:09:03.300 --> 00:09:04.860
So in other words, if my prediction is

00:09:04.860 --> 00:09:07.800
too high and XI is positive or wait,

00:09:07.800 --> 00:09:08.720
let me get to the update.

00:09:08.720 --> 00:09:10.539
OK, so first the update is.

00:09:10.540 --> 00:09:11.940
I'm going to subtract that off because

00:09:11.940 --> 00:09:13.150
I want to reduce the error so it's

00:09:13.150 --> 00:09:14.350
gradient descent.

00:09:14.350 --> 00:09:16.400
So I want the gradient to go down

00:09:16.400 --> 00:09:16.730
South.

00:09:16.730 --> 00:09:18.826
I take my weight and I subtract the

00:09:18.826 --> 00:09:20.260
gradient with some learning rate or

00:09:20.260 --> 00:09:20.940
step size.

00:09:21.770 --> 00:09:25.220
So of X -, Y is positive and XI is

00:09:25.220 --> 00:09:25.630
positive.

00:09:26.560 --> 00:09:27.970
That means that.

00:09:28.670 --> 00:09:30.548
That I'm overshooting and I want my

00:09:30.548 --> 00:09:32.000
weight to go down.

00:09:32.000 --> 00:09:34.929
If X -, Y is negative and XI is

00:09:34.930 --> 00:09:37.809
positive, then I want my weight to go

00:09:37.810 --> 00:09:38.870
in the opposite direction.

00:09:38.870 --> 00:09:39.200
Question.

00:09:44.340 --> 00:09:47.000
This update or this derivative?

00:09:51.770 --> 00:09:55.975
So first we're trying to figure out how

00:09:55.975 --> 00:09:58.740
do we minimize this error function?

00:09:58.740 --> 00:10:01.620
How do we change our Weights in a way

00:10:01.620 --> 00:10:03.490
that will reduce our error a bit for

00:10:03.490 --> 00:10:05.080
this for these particular examples?

00:10:06.420 --> 00:10:10.110
And if you want to know like how you.

00:10:10.710 --> 00:10:13.146
How you change the value, how some

00:10:13.146 --> 00:10:16.080
change in your parameters will change

00:10:16.080 --> 00:10:18.049
the output of some function.

00:10:18.050 --> 00:10:19.753
Then you take the derivative of that

00:10:19.753 --> 00:10:20.950
function with respect to your

00:10:20.950 --> 00:10:21.300
parameters.

00:10:21.300 --> 00:10:22.913
So that gives you like the slope of the

00:10:22.913 --> 00:10:24.400
function as you change your parameters.

00:10:25.490 --> 00:10:28.175
So that's why we're taking the partial

00:10:28.175 --> 00:10:29.732
derivative and then the partial

00:10:29.732 --> 00:10:30.960
derivative says like how you would

00:10:30.960 --> 00:10:32.430
change your parameters to increase the

00:10:32.430 --> 00:10:34.920
function, so we subtract that from the

00:10:34.920 --> 00:10:36.030
from the original value.

00:10:37.190 --> 00:10:37.500
OK.

00:10:39.410 --> 00:10:40.010
Question.

00:10:53.040 --> 00:10:54.590
So the question is, what if you had

00:10:54.590 --> 00:10:56.100
like additional labels?

00:10:56.100 --> 00:10:58.290
Then you would end up with essentially

00:10:58.290 --> 00:11:02.227
you have different F of X, so you'd

00:11:02.227 --> 00:11:04.261
have like one of X, F2 of X, et cetera.

00:11:04.261 --> 00:11:06.780
You'd have 1F of X for each label that

00:11:06.780 --> 00:11:07.600
you're producing.

00:11:10.740 --> 00:11:10.985
Yes.

00:11:10.985 --> 00:11:12.500
So you need to update their weights and

00:11:12.500 --> 00:11:13.120
they would all.

00:11:13.120 --> 00:11:14.820
In the case of a Perceptron, they'd all

00:11:14.820 --> 00:11:16.360
be independent because they're all just

00:11:16.360 --> 00:11:17.630
like linear models.

00:11:17.630 --> 00:11:20.060
So it would end up being essentially

00:11:20.060 --> 00:11:23.010
the same as training N Perceptrons to

00:11:23.010 --> 00:11:24.220
do and outputs.

00:11:25.810 --> 00:11:28.710
But yeah, that becomes a little more

00:11:28.710 --> 00:11:30.430
complicated in the case of MLPS where

00:11:30.430 --> 00:11:32.060
you could Share intermediate features,

00:11:32.060 --> 00:11:33.620
but we'll get to that a little bit.

00:11:35.340 --> 00:11:36.690
So here's my update.

00:11:36.690 --> 00:11:38.500
So I'm going to improve the weights a

00:11:38.500 --> 00:11:40.630
little bit to do reduce the error on

00:11:40.630 --> 00:11:42.640
these particular examples, and I just

00:11:42.640 --> 00:11:45.540
put the two into the learning rate.

00:11:45.540 --> 00:11:47.250
Sometimes people write this error is

00:11:47.250 --> 00:11:49.200
1/2 of this just so they don't have to

00:11:49.200 --> 00:11:50.150
deal with the two.

00:11:51.580 --> 00:11:53.130
Right, so here's the whole optimization

00:11:53.130 --> 00:11:53.630
algorithm.

00:11:54.600 --> 00:11:56.140
Randomly initialize my Weights.

00:11:56.140 --> 00:11:57.930
For example, I say W is drawn from some

00:11:57.930 --> 00:11:59.660
Gaussian with a mean of zero and

00:11:59.660 --> 00:12:00.590
standard deviation of.

00:12:01.380 --> 00:12:05.320
0.50 point 05 so just initialize them

00:12:05.320 --> 00:12:05.850
small.

00:12:06.870 --> 00:12:09.400
And then for each iteration or epoch.

00:12:09.400 --> 00:12:10.900
An epoch is like a cycle through the

00:12:10.900 --> 00:12:11.635
training data.

00:12:11.635 --> 00:12:14.050
I split the data into batches so I

00:12:14.050 --> 00:12:16.420
could have a batch size of 1 or 128,

00:12:16.420 --> 00:12:19.980
but I just chunk it into different sets

00:12:19.980 --> 00:12:21.219
that are partition of the data.

00:12:22.120 --> 00:12:23.740
And I set my learning rate.

00:12:23.740 --> 00:12:25.940
For example, this is the schedule used

00:12:25.940 --> 00:12:27.230
by Pegasus.

00:12:27.230 --> 00:12:29.150
But sometimes people use a constant

00:12:29.150 --> 00:12:29.660
learning rate.

00:12:31.140 --> 00:12:33.459
And then for each batch and for each

00:12:33.460 --> 00:12:34.040
weight.

00:12:34.880 --> 00:12:37.630
I have my update rule so I have this

00:12:37.630 --> 00:12:39.315
gradient for each.

00:12:39.315 --> 00:12:41.675
I take the sum over all the examples in

00:12:41.675 --> 00:12:42.330
my batch.

00:12:43.120 --> 00:12:46.480
And then I get the output the

00:12:46.480 --> 00:12:48.920
prediction for that sample subtract it

00:12:48.920 --> 00:12:50.510
from the true value according to my

00:12:50.510 --> 00:12:51.290
training labels.

00:12:52.200 --> 00:12:55.510
By the Input for that weight, which is

00:12:55.510 --> 00:12:58.810
xni, I sum that up, divide by the total

00:12:58.810 --> 00:13:00.260
number of samples in my batch.

00:13:00.910 --> 00:13:05.010
And then I take a step in that negative

00:13:05.010 --> 00:13:07.070
direction weighted by the learning

00:13:07.070 --> 00:13:07.460
rate.

00:13:07.460 --> 00:13:09.120
So if the learning rates really high,

00:13:09.120 --> 00:13:10.920
I'm going to take really big steps, but

00:13:10.920 --> 00:13:12.790
then you risk like overstepping the

00:13:12.790 --> 00:13:15.933
minimum or even kind of bouncing out of

00:13:15.933 --> 00:13:18.910
a into like a undefined solution.

00:13:19.540 --> 00:13:21.100
If you're learning is really low, then

00:13:21.100 --> 00:13:22.650
it's just going to take a long time to

00:13:22.650 --> 00:13:23.090
converge.

00:13:24.570 --> 00:13:26.820
Perceptrons it's a linear model, so

00:13:26.820 --> 00:13:28.610
it's Fully optimizable.

00:13:28.610 --> 00:13:30.910
You can always it's possible to find

00:13:30.910 --> 00:13:32.060
global minimum.

00:13:32.060 --> 00:13:34.220
It's a really nicely behaved

00:13:34.220 --> 00:13:35.400
optimization problem.

00:13:41.540 --> 00:13:45.580
So you can have different losses if I

00:13:45.580 --> 00:13:47.840
instead of having a squared loss if I

00:13:47.840 --> 00:13:49.980
had a logistic loss for example.

00:13:50.650 --> 00:13:53.110
Then it would mean that I have this

00:13:53.110 --> 00:13:55.170
function that the Perceptron is still

00:13:55.170 --> 00:13:56.660
computing this linear function.

00:13:57.260 --> 00:13:59.220
But then I say that my error is a

00:13:59.220 --> 00:14:01.290
negative log probability of the True

00:14:01.290 --> 00:14:03.220
label given the features.

00:14:04.450 --> 00:14:06.280
And where the probability is given by

00:14:06.280 --> 00:14:07.740
this Sigmoid function.

00:14:08.640 --> 00:14:12.230
Which is 1 / 1 + E to the negative like

00:14:12.230 --> 00:14:14.060
F of Y of F of X so.

00:14:15.050 --> 00:14:15.730
So this.

00:14:15.810 --> 00:14:16.430


00:14:17.800 --> 00:14:21.280
Now the derivative of this you can.

00:14:21.280 --> 00:14:23.536
It's not super complicated to take this

00:14:23.536 --> 00:14:25.050
derivative, but it does involve like

00:14:25.050 --> 00:14:27.510
several lines and I decide it's not

00:14:27.510 --> 00:14:29.833
really worth stepping through the

00:14:29.833 --> 00:14:30.109
lines.

00:14:30.880 --> 00:14:33.974
The main point is that for any kind of

00:14:33.974 --> 00:14:35.908
activation function, you can compute

00:14:35.908 --> 00:14:37.843
the derivative of that activation

00:14:37.843 --> 00:14:40.208
function, or for any kind of error

00:14:40.208 --> 00:14:41.920
function, I mean you can compute the

00:14:41.920 --> 00:14:43.190
derivative of that error function.

00:14:44.000 --> 00:14:45.480
And then you plug it in there.

00:14:45.480 --> 00:14:50.453
So now this becomes Y&X and I times and

00:14:50.453 --> 00:14:53.990
it works out to 1 minus the probability

00:14:53.990 --> 00:14:56.170
of the correct label given the data.

00:14:57.450 --> 00:14:58.705
So this kind of makes sense.

00:14:58.705 --> 00:15:02.120
So if this plus this.

00:15:02.210 --> 00:15:02.440
OK.

00:15:03.080 --> 00:15:04.930
This ends up being a plus because I'm

00:15:04.930 --> 00:15:06.760
decreasing the negative log likelihood,

00:15:06.760 --> 00:15:08.696
which is the same as increasing the log

00:15:08.696 --> 00:15:08.999
likelihood.

00:15:09.790 --> 00:15:14.120
And if XNXN is positive and Y is

00:15:14.120 --> 00:15:15.750
positive then I want to increase the

00:15:15.750 --> 00:15:18.680
score further and so I want the weight

00:15:18.680 --> 00:15:19.740
to go up.

00:15:20.690 --> 00:15:24.610
And the step size will be weighted by

00:15:24.610 --> 00:15:26.050
how wrong I was.

00:15:26.050 --> 00:15:29.540
So 1 minus the probability of y = y N

00:15:29.540 --> 00:15:30.910
given XN is like how wrong I was if

00:15:30.910 --> 00:15:31.370
this is.

00:15:32.010 --> 00:15:33.490
If I was perfectly correct, then this

00:15:33.490 --> 00:15:34.380
is going to be zero.

00:15:34.380 --> 00:15:35.557
I don't need to take any step.

00:15:35.557 --> 00:15:38.240
If I was completely confidently wrong,

00:15:38.240 --> 00:15:39.500
then this is going to be one and so

00:15:39.500 --> 00:15:40.320
I'll take a bigger step.

00:15:43.020 --> 00:15:47.330
Right, so the, so just the.

00:15:47.410 --> 00:15:50.280
Step depends on the loss, but with any

00:15:50.280 --> 00:15:51.950
loss you can do a similar kind of

00:15:51.950 --> 00:15:53.670
strategy as long as you can take a

00:15:53.670 --> 00:15:54.640
derivative of the loss.

00:15:58.860 --> 00:15:59.150
OK.

00:16:02.620 --> 00:16:06.160
Alright, so let's see, is a Perceptron

00:16:06.160 --> 00:16:06.550
enough?

00:16:06.550 --> 00:16:10.046
So which of these functions do you

00:16:10.046 --> 00:16:14.166
think can be fit with the Perceptron?

00:16:14.166 --> 00:16:17.085
So what about the first function?

00:16:17.085 --> 00:16:19.036
Do you think we can fit that with the

00:16:19.036 --> 00:16:19.349
Perceptron?

00:16:21.040 --> 00:16:21.600
Yeah.

00:16:21.600 --> 00:16:23.050
What about the second one?

00:16:26.950 --> 00:16:29.620
OK, yeah, some people are confidently

00:16:29.620 --> 00:16:33.150
yes, and some people are not so sure we

00:16:33.150 --> 00:16:34.170
will see.

00:16:34.170 --> 00:16:35.320
What about this function?

00:16:37.440 --> 00:16:38.599
Yeah, definitely not.

00:16:38.600 --> 00:16:40.260
Well, I'm giving away, but definitely

00:16:40.260 --> 00:16:41.010
not that one, right?

00:16:42.700 --> 00:16:43.920
All right, so let's see.

00:16:43.920 --> 00:16:45.030
So here's Demo.

00:16:46.770 --> 00:16:48.060
I'm going to switch.

00:16:48.060 --> 00:16:49.205
I only have one.

00:16:49.205 --> 00:16:51.620
I only have one USB port, so.

00:16:54.050 --> 00:16:56.210
I don't want to use my touchpad.

00:17:06.710 --> 00:17:07.770
OK.

00:17:07.770 --> 00:17:08.500
Don't go there.

00:17:08.500 --> 00:17:09.120
OK.

00:17:31.910 --> 00:17:34.170
OK, so I've got some functions here.

00:17:34.170 --> 00:17:35.889
I've got that linear function that I

00:17:35.889 --> 00:17:36.163
showed.

00:17:36.163 --> 00:17:38.378
I've got the rounded function that I

00:17:38.378 --> 00:17:39.790
showed, continuous, nonlinear.

00:17:40.600 --> 00:17:44.060
Giving it away but and then I've got a

00:17:44.060 --> 00:17:45.850
more non linear function that had like

00:17:45.850 --> 00:17:47.380
that little circle on the right side.

00:17:49.580 --> 00:17:51.750
Got display functions that I don't want

00:17:51.750 --> 00:17:54.455
to talk about because they're just for

00:17:54.455 --> 00:17:55.636
display and they're really complicated

00:17:55.636 --> 00:17:57.560
and I sort of like found it somewhere

00:17:57.560 --> 00:17:59.530
and modified it, but it's definitely

00:17:59.530 --> 00:17:59.980
not the point.

00:18:00.730 --> 00:18:02.650
Let me just see if this will run.

00:18:06.740 --> 00:18:08.060
All right, let's take for granted that

00:18:08.060 --> 00:18:09.130
it will and move on.

00:18:09.250 --> 00:18:09.870


00:18:11.440 --> 00:18:15.200
So then I've got so this is all display

00:18:15.200 --> 00:18:15.650
function.

00:18:16.260 --> 00:18:18.140
And then I've got the Perceptron down

00:18:18.140 --> 00:18:18.610
here.

00:18:18.610 --> 00:18:20.415
So just a second, let me make sure.

00:18:20.415 --> 00:18:22.430
OK, that's good, let me run my display

00:18:22.430 --> 00:18:23.850
functions, OK.

00:18:25.280 --> 00:18:27.460
So the Perceptron.

00:18:27.460 --> 00:18:29.800
OK, so I've got my prediction function

00:18:29.800 --> 00:18:33.746
that's just basically matmul X and

00:18:33.746 --> 00:18:33.993
West.

00:18:33.993 --> 00:18:36.050
So I just multiply my Weights by West.

00:18:37.050 --> 00:18:38.870
I've got an evaluation function to

00:18:38.870 --> 00:18:40.230
compute a loss.

00:18:40.230 --> 00:18:43.160
It's just one over 1 + E to the

00:18:43.160 --> 00:18:45.490
negative prediction times Y.

00:18:46.360 --> 00:18:48.650
The negative log of that just so it's

00:18:48.650 --> 00:18:49.520
the logistic loss.

00:18:51.210 --> 00:18:53.346
And I'm also computing an accuracy here

00:18:53.346 --> 00:18:56.430
which is just whether Y times the

00:18:56.430 --> 00:18:59.710
prediction which is greater than zero

00:18:59.710 --> 00:19:00.130
or not.

00:19:01.210 --> 00:19:02.160
The average of that?

00:19:03.080 --> 00:19:07.420
And then I've got my SGD Perceptron

00:19:07.420 --> 00:19:07.780
here.

00:19:08.540 --> 00:19:11.460
So I randomly initialized my Weights.

00:19:11.460 --> 00:19:13.480
Here I just did a uniform random, which

00:19:13.480 --> 00:19:14.530
is OK too.

00:19:14.670 --> 00:19:15.310


00:19:17.730 --> 00:19:18.900
And.

00:19:20.280 --> 00:19:22.040
So this is a uniform random

00:19:22.040 --> 00:19:26.040
initialization from -, .25 to .025.

00:19:27.020 --> 00:19:29.670
I added a one to my features as a way

00:19:29.670 --> 00:19:30.940
of dealing with the bias term.

00:19:32.500 --> 00:19:33.740
And then I've got some number of

00:19:33.740 --> 00:19:34.610
iterations set.

00:19:36.000 --> 00:19:37.920
And initializing something to keep

00:19:37.920 --> 00:19:39.770
track of their loss and the accuracy.

00:19:40.470 --> 00:19:42.940
I'm going to just Evaluate to start

00:19:42.940 --> 00:19:44.620
with my random Weights, so I'm not

00:19:44.620 --> 00:19:45.970
expecting anything to be good, but I

00:19:45.970 --> 00:19:46.840
want to start tracking it.

00:19:48.010 --> 00:19:50.410
Gotta batch size of 100 so I'm going to

00:19:50.410 --> 00:19:52.210
process 100 examples at a time.

00:19:53.660 --> 00:19:55.610
I start iterating through my data.

00:19:56.470 --> 00:19:58.002
I set my learning rate.

00:19:58.002 --> 00:20:00.440
I did the initial learning rate.

00:20:00.550 --> 00:20:01.200


00:20:02.210 --> 00:20:06.440
Divided by this thing, another number

00:20:06.440 --> 00:20:09.135
and then divide by the step size.

00:20:09.135 --> 00:20:11.910
This was based on the Pegasus learning

00:20:11.910 --> 00:20:12.490
rate schedule.

00:20:13.660 --> 00:20:15.210
Then I do.

00:20:15.300 --> 00:20:18.366
I've randomly permute my data order, so

00:20:18.366 --> 00:20:20.230
I randomly permute indices.

00:20:20.230 --> 00:20:22.300
So I've shuffled my data so that every

00:20:22.300 --> 00:20:23.856
time I pass through I'm going to pass

00:20:23.856 --> 00:20:24.920
through it in a different order.

00:20:26.730 --> 00:20:29.120
Then I step through and steps of batch

00:20:29.120 --> 00:20:29.360
size.

00:20:29.360 --> 00:20:30.928
I step through my data in steps of

00:20:30.928 --> 00:20:31.396
batch size.

00:20:31.396 --> 00:20:34.790
I get the indices of size batch size.

00:20:35.970 --> 00:20:37.840
I make a prediction for all those

00:20:37.840 --> 00:20:39.100
indices and like.

00:20:39.100 --> 00:20:40.770
These reshapes make the Code kind of

00:20:40.770 --> 00:20:42.690
ugly, but necessary.

00:20:42.690 --> 00:20:44.080
At least seem necessary.

00:20:45.260 --> 00:20:52.000
So I multiply my by my ex and I do the

00:20:52.000 --> 00:20:52.830
exponent of that.

00:20:52.830 --> 00:20:54.300
So this is 1 minus the.

00:20:54.300 --> 00:20:55.790
Since I don't have a negative here,

00:20:55.790 --> 00:20:57.940
this is 1 minus the probability of the

00:20:57.940 --> 00:20:58.390
True label.

00:20:59.980 --> 00:21:01.830
This whole pred is 1 minus the

00:21:01.830 --> 00:21:02.910
probability of the True label.

00:21:03.650 --> 00:21:05.009
And then I have my weight update.

00:21:05.010 --> 00:21:07.010
So my weight update is one over the

00:21:07.010 --> 00:21:09.255
batch size times the learning rate

00:21:09.255 --> 00:21:12.260
times X * Y.

00:21:12.970 --> 00:21:16.750
Times this error function evaluation

00:21:16.750 --> 00:21:17.390
which is pred.

00:21:18.690 --> 00:21:19.360
And.

00:21:20.000 --> 00:21:21.510
I'm going to sum it over all the

00:21:21.510 --> 00:21:22.220
examples.

00:21:23.050 --> 00:21:25.920
So this is my loss update.

00:21:25.920 --> 00:21:27.550
And then I also have an L2

00:21:27.550 --> 00:21:29.560
regularization, so I'm penalizing the

00:21:29.560 --> 00:21:30.550
square of Weights.

00:21:30.550 --> 00:21:32.027
When you penalize the square of

00:21:32.027 --> 00:21:33.420
Weights, take the derivative of West

00:21:33.420 --> 00:21:35.620
squared and you get 2 W so you subtract

00:21:35.620 --> 00:21:36.400
off 2 W.

00:21:37.870 --> 00:21:40.460
And so I take a step in that negative W

00:21:40.460 --> 00:21:40.950
direction.

00:21:43.170 --> 00:21:45.420
OK, so these are the same as the

00:21:45.420 --> 00:21:46.610
equations I showed, they're just

00:21:46.610 --> 00:21:48.487
vectorized so that I'm updating all the

00:21:48.487 --> 00:21:50.510
weights at the same time and processing

00:21:50.510 --> 00:21:52.462
all the data in the batch at the same

00:21:52.462 --> 00:21:54.362
time, rather than looping through the

00:21:54.362 --> 00:21:56.060
data and looping through the Weights.

00:21:57.820 --> 00:21:59.920
Then I do this.

00:22:00.750 --> 00:22:02.570
Until I finish get to the end of my

00:22:02.570 --> 00:22:06.120
data, I compute my accuracy and my loss

00:22:06.120 --> 00:22:07.870
just for plotting purposes.

00:22:08.720 --> 00:22:10.950
And then at the end I do an evaluation

00:22:10.950 --> 00:22:11.990
and I.

00:22:12.820 --> 00:22:15.860
And I print my error and my loss and my

00:22:15.860 --> 00:22:19.150
accuracy and plot plot things OK, so

00:22:19.150 --> 00:22:19.400
that's.

00:22:20.560 --> 00:22:22.680
That's SGD for Perceptron.

00:22:23.940 --> 00:22:25.466
And so now let's look at it at the

00:22:25.466 --> 00:22:26.640
linear for the linear problem.

00:22:27.740 --> 00:22:29.260
So I'm going to generate some random

00:22:29.260 --> 00:22:29.770
data.

00:22:30.610 --> 00:22:31.190


00:22:32.380 --> 00:22:34.865
So here's some like randomly generated

00:22:34.865 --> 00:22:37.190
data where like half the data is on one

00:22:37.190 --> 00:22:38.730
side of this diagonal and half on the

00:22:38.730 --> 00:22:39.250
other side.

00:22:40.900 --> 00:22:43.220
And I plot it and then I run this

00:22:43.220 --> 00:22:44.760
function that I just described.

00:22:46.290 --> 00:22:48.070
And so this is what happens to the

00:22:48.070 --> 00:22:48.800
loss.

00:22:48.800 --> 00:22:50.800
So first, the first, the learning rate

00:22:50.800 --> 00:22:53.120
is pretty high, so it's actually kind

00:22:53.120 --> 00:22:55.140
of a little wild, but then it settles

00:22:55.140 --> 00:22:57.430
down and it quickly descends and

00:22:57.430 --> 00:22:59.480
reaches a.

00:22:59.600 --> 00:23:00.000
The loss.

00:23:01.380 --> 00:23:02.890
And here's what happens to the

00:23:02.890 --> 00:23:03.930
accuracy.

00:23:04.340 --> 00:23:07.910
The accuracy goes up to pretty close to

00:23:07.910 --> 00:23:08.140
1.

00:23:09.950 --> 00:23:12.680
And I just ran it for 10 iterations.

00:23:12.680 --> 00:23:15.810
So if I decrease my learning rate and

00:23:15.810 --> 00:23:17.290
let it run more, I could probably get a

00:23:17.290 --> 00:23:18.490
little higher accuracy, but.

00:23:21.070 --> 00:23:22.720
So notice the loss is still like far

00:23:22.720 --> 00:23:25.270
from zero, even though here's my

00:23:25.270 --> 00:23:26.560
decision boundary.

00:23:27.800 --> 00:23:29.780
I'm going to have to zoom out.

00:23:29.780 --> 00:23:31.010
That's a big boundary.

00:23:31.900 --> 00:23:33.070
All right, so here's my decision

00:23:33.070 --> 00:23:35.450
boundary, and you can see it's

00:23:35.450 --> 00:23:37.880
classifying almost everything perfect.

00:23:37.880 --> 00:23:40.210
There's some red dots that ended up on

00:23:40.210 --> 00:23:41.450
the wrong side of the line.

00:23:42.990 --> 00:23:45.330
And but pretty good.

00:23:45.940 --> 00:23:47.880
But the loss is still fairly high

00:23:47.880 --> 00:23:49.430
because it's still paying a loss even

00:23:49.430 --> 00:23:51.370
for these correctly classified samples

00:23:51.370 --> 00:23:52.350
that are near the boundary.

00:23:52.350 --> 00:23:54.020
In fact, all the samples it's paying

00:23:54.020 --> 00:23:55.880
some loss, but here pretty much fit

00:23:55.880 --> 00:23:56.620
this function right.

00:23:58.160 --> 00:23:59.790
Alright, so now let's look at our non

00:23:59.790 --> 00:24:00.770
linear problem.

00:24:01.520 --> 00:24:04.910
With the rounded curve.

00:24:04.910 --> 00:24:06.560
So I just basically did like a circle

00:24:06.560 --> 00:24:08.040
that overlaps with the feature space.

00:24:11.370 --> 00:24:13.630
Here's what happened in loss.

00:24:13.630 --> 00:24:15.960
Nice descent leveled out.

00:24:17.390 --> 00:24:21.400
My accuracy went up, but it's topped

00:24:21.400 --> 00:24:22.210
out at 90%.

00:24:23.150 --> 00:24:25.000
And that's because I can't fit this

00:24:25.000 --> 00:24:26.380
perfectly with the linear function,

00:24:26.380 --> 00:24:26.620
right?

00:24:26.620 --> 00:24:28.518
The best I can do with the linear

00:24:28.518 --> 00:24:29.800
function it means that I'm drawing a

00:24:29.800 --> 00:24:31.070
line in this 2D space.

00:24:31.970 --> 00:24:34.610
And the True boundary is not a line,

00:24:34.610 --> 00:24:36.280
it's a semi circle.

00:24:36.960 --> 00:24:39.040
And so I get these points over here

00:24:39.040 --> 00:24:41.396
incorrect the red dots and I get.

00:24:41.396 --> 00:24:41.989
I get.

00:24:43.310 --> 00:24:47.429
It shows a line and then I get these

00:24:47.430 --> 00:24:49.056
red dots incorrect, and then I get

00:24:49.056 --> 00:24:49.960
these blue dots correct.

00:24:49.960 --> 00:24:52.240
So it's the best line it can find, but

00:24:52.240 --> 00:24:52.981
it can't fit.

00:24:52.981 --> 00:24:55.340
You can't fit a nonlinear shape with

00:24:55.340 --> 00:24:57.170
the line, just like you can't put a

00:24:57.170 --> 00:24:58.810
square in a round hole.

00:24:59.720 --> 00:25:00.453
Right.

00:25:00.453 --> 00:25:03.710
So not perfect, but not horrible.

00:25:04.710 --> 00:25:06.220
And then if we go to this.

00:25:06.330 --> 00:25:07.010
And.

00:25:07.860 --> 00:25:09.030
We go to this guy.

00:25:09.830 --> 00:25:11.400
And this has this big BLOB here.

00:25:11.400 --> 00:25:12.770
So obviously we're not going to fit

00:25:12.770 --> 00:25:14.100
this perfectly with a line like.

00:25:14.100 --> 00:25:15.470
I could do that, I could do that.

00:25:16.330 --> 00:25:20.270
But it does its best, minimizes the

00:25:20.270 --> 00:25:20.730
loss.

00:25:20.730 --> 00:25:23.140
Now it gets an error of 85% or an

00:25:23.140 --> 00:25:24.220
accuracy of 85%.

00:25:24.220 --> 00:25:25.420
This is accuracy that I've been

00:25:25.420 --> 00:25:25.700
plotting.

00:25:26.590 --> 00:25:28.580
So a little bit lower and what it does

00:25:28.580 --> 00:25:30.340
is it puts like a straight line, like

00:25:30.340 --> 00:25:31.330
straight through.

00:25:31.330 --> 00:25:32.820
It just moves it a little bit to the

00:25:32.820 --> 00:25:34.800
right so that these guys don't have

00:25:34.800 --> 00:25:36.010
quite as high of a loss.

00:25:36.990 --> 00:25:38.820
And it's still getting a lot of the

00:25:38.820 --> 00:25:40.475
same examples wrong.

00:25:40.475 --> 00:25:42.940
And it also gets this like BLOB over

00:25:42.940 --> 00:25:43.480
here wrong.

00:25:44.300 --> 00:25:46.610
So these I should have said, these

00:25:46.610 --> 00:25:49.890
boundaries are showing where the model

00:25:49.890 --> 00:25:50.563
predicts 0.

00:25:50.563 --> 00:25:52.170
So this is like the decision boundary.

00:25:53.140 --> 00:25:53.960
And then the.

00:25:54.700 --> 00:25:56.718
Faded background is showing like the

00:25:56.718 --> 00:25:59.007
probability of the blue class or the

00:25:59.007 --> 00:26:00.420
probability of the red class.

00:26:00.420 --> 00:26:01.570
So it's bigger if it's.

00:26:02.880 --> 00:26:04.200
Excuse me if it's more probable.

00:26:04.830 --> 00:26:07.240
And then the dark dots are the training

00:26:07.240 --> 00:26:08.980
examples question.

00:26:10.930 --> 00:26:11.280
Decision.

00:26:13.920 --> 00:26:15.120
It's a straight line.

00:26:15.120 --> 00:26:16.880
It's just that in order to plot, you

00:26:16.880 --> 00:26:18.810
have to discretize the space and take

00:26:18.810 --> 00:26:20.690
samples at different positions.

00:26:20.690 --> 00:26:22.860
So we need discretize it and fit a

00:26:22.860 --> 00:26:23.770
contour to it.

00:26:23.770 --> 00:26:25.826
It's like wiggling, but it's really a

00:26:25.826 --> 00:26:26.299
straight line.

00:26:27.170 --> 00:26:27.910
Yeah, question.

00:26:33.180 --> 00:26:35.320
So that's one thing you could do, but I

00:26:35.320 --> 00:26:37.550
would say in this case.

00:26:39.180 --> 00:26:42.890
Even polar coordinates I think would

00:26:42.890 --> 00:26:45.260
probably not be linear still, but it's

00:26:45.260 --> 00:26:46.580
true that you could project it into a

00:26:46.580 --> 00:26:48.520
higher dimension dimensionality and

00:26:48.520 --> 00:26:50.274
make it linear, and polar coordinates

00:26:50.274 --> 00:26:51.280
could be part of that.

00:26:52.030 --> 00:26:52.400
Question.

00:27:02.770 --> 00:27:05.630
So the question was, could layer lines

00:27:05.630 --> 00:27:07.089
on top of each other and use like a

00:27:07.090 --> 00:27:08.560
combination of lines to make a

00:27:08.560 --> 00:27:10.110
prediction like with the decision tree?

00:27:11.280 --> 00:27:12.130
So definitely.

00:27:12.130 --> 00:27:13.780
So you could just literally use a

00:27:13.780 --> 00:27:14.930
decision tree.

00:27:15.910 --> 00:27:16.870
And.

00:27:17.840 --> 00:27:19.870
Multi layer Perceptron, which is the

00:27:19.870 --> 00:27:21.070
next thing that we're going to talk

00:27:21.070 --> 00:27:22.742
about, is essentially doing just that.

00:27:22.742 --> 00:27:25.510
You make a bunch of linear predictions

00:27:25.510 --> 00:27:27.335
as your intermediate features and then

00:27:27.335 --> 00:27:29.480
you have some nonlinearity like a

00:27:29.480 --> 00:27:31.755
threshold and then you make linear

00:27:31.755 --> 00:27:32.945
predictions from those.

00:27:32.945 --> 00:27:34.800
And so that's how we're going to do it.

00:27:34.860 --> 00:27:35.430
Yep.

00:27:41.910 --> 00:27:42.880
So.

00:27:43.640 --> 00:27:44.690
There's here.

00:27:44.690 --> 00:27:46.820
It's not important because it's a

00:27:46.820 --> 00:27:48.510
convex function and it's a small

00:27:48.510 --> 00:27:51.195
function, but there's two purposes to a

00:27:51.195 --> 00:27:51.380
batch.

00:27:51.380 --> 00:27:53.550
Size 1 is that you can process the

00:27:53.550 --> 00:27:55.110
whole batch in parallel, especially if

00:27:55.110 --> 00:27:56.660
you're doing like GPU processing.

00:27:57.380 --> 00:27:59.440
The other is that it gives you a more

00:27:59.440 --> 00:28:00.756
stable estimate of the gradient.

00:28:00.756 --> 00:28:02.290
So we're computing the gradient for

00:28:02.290 --> 00:28:04.200
each of the examples, and then we're

00:28:04.200 --> 00:28:06.190
summing it and dividing by the number

00:28:06.190 --> 00:28:06.890
of samples.

00:28:06.890 --> 00:28:08.670
So I'm getting a more I'm getting like

00:28:08.670 --> 00:28:10.840
a better estimate of the mean gradient.

00:28:11.490 --> 00:28:13.760
So what I'm really doing is for each

00:28:13.760 --> 00:28:16.640
sample I'm getting an unexpected

00:28:16.640 --> 00:28:19.605
gradient function for all the data, but

00:28:19.605 --> 00:28:21.450
the expectation is based on just one

00:28:21.450 --> 00:28:22.143
small sample.

00:28:22.143 --> 00:28:24.430
So the bigger the sample, the better

00:28:24.430 --> 00:28:25.910
approximates the true gradient.

00:28:27.930 --> 00:28:31.620
In practice, usually bigger batch sizes

00:28:31.620 --> 00:28:32.440
are better.

00:28:32.590 --> 00:28:33.280


00:28:35.380 --> 00:28:37.440
And so usually people use the biggest

00:28:37.440 --> 00:28:39.240
batch size that can fit into their GPU

00:28:39.240 --> 00:28:41.290
memory when they're doing like deep

00:28:41.290 --> 00:28:41.890
learning.

00:28:42.090 --> 00:28:45.970
But you have to like tune different

00:28:45.970 --> 00:28:47.660
some parameters, like you might

00:28:47.660 --> 00:28:48.810
increase your learning rate, for

00:28:48.810 --> 00:28:50.460
example if you have a bigger batch size

00:28:50.460 --> 00:28:51.840
because you have a more stable estimate

00:28:51.840 --> 00:28:53.450
of your gradient, so you can take

00:28:53.450 --> 00:28:54.140
bigger steps.

00:28:54.140 --> 00:28:55.180
But there's.

00:28:55.850 --> 00:28:56.780
Yeah.

00:29:00.230 --> 00:29:00.870
Alright.

00:29:01.600 --> 00:29:03.225
So now I'm going to jump out of that.

00:29:03.225 --> 00:29:05.350
I'm going to come back to this Demo.

00:29:06.700 --> 00:29:07.560
In a bit.

00:29:13.580 --> 00:29:16.570
Right, so I can fit linear functions

00:29:16.570 --> 00:29:19.040
with this Perceptron, but sometimes I

00:29:19.040 --> 00:29:20.360
want a nonlinear function.

00:29:22.070 --> 00:29:23.830
So that's where the multilayer

00:29:23.830 --> 00:29:25.210
perceptron comes in.

00:29:25.950 --> 00:29:27.120
It's just a.

00:29:28.060 --> 00:29:28.990
Perceptron with.

00:29:29.770 --> 00:29:31.420
More layers of Perceptrons.

00:29:31.420 --> 00:29:33.760
So basically this guy.

00:29:33.760 --> 00:29:36.081
So you have in a multilayer perceptron,

00:29:36.081 --> 00:29:39.245
you have your, you have your output or

00:29:39.245 --> 00:29:41.010
outputs, and then you have what people

00:29:41.010 --> 00:29:42.880
call hidden layers, which are like

00:29:42.880 --> 00:29:44.500
intermediate outputs.

00:29:44.690 --> 00:29:45.390


00:29:46.180 --> 00:29:47.955
That you can think of as being some

00:29:47.955 --> 00:29:50.290
kind of latent feature, some kind of

00:29:50.290 --> 00:29:52.300
combination of the Input data that may

00:29:52.300 --> 00:29:54.510
be useful for making a prediction, but

00:29:54.510 --> 00:29:56.466
it's not like explicitly part of your

00:29:56.466 --> 00:29:58.100
data vector or part of your label

00:29:58.100 --> 00:29:58.570
vector.

00:30:00.050 --> 00:30:02.518
So for example, this is somebody else's

00:30:02.518 --> 00:30:05.340
Example, but if you wanted to predict

00:30:05.340 --> 00:30:07.530
whether somebody's going to survive the

00:30:07.530 --> 00:30:08.830
cancer, I think that's what this is

00:30:08.830 --> 00:30:09.010
from.

00:30:09.670 --> 00:30:11.900
Then you could take the age, the gender

00:30:11.900 --> 00:30:14.170
of the stage, and you could just try a

00:30:14.170 --> 00:30:14.930
linear prediction.

00:30:14.930 --> 00:30:16.030
But maybe that doesn't work well

00:30:16.030 --> 00:30:16.600
enough.

00:30:16.600 --> 00:30:18.880
So you create an MLP, a multilayer

00:30:18.880 --> 00:30:21.500
perceptron, and then this is

00:30:21.500 --> 00:30:23.029
essentially making a prediction, a

00:30:23.030 --> 00:30:24.885
weighted combination of these inputs.

00:30:24.885 --> 00:30:27.060
It goes through a Sigmoid, so it gets

00:30:27.060 --> 00:30:28.595
mapped from zero to one.

00:30:28.595 --> 00:30:30.510
You do the same for this node.

00:30:31.450 --> 00:30:34.150
And then you and then you make another

00:30:34.150 --> 00:30:35.770
prediction based on the outputs of

00:30:35.770 --> 00:30:37.410
these two nodes, and that gives you

00:30:37.410 --> 00:30:38.620
your final probability.

00:30:41.610 --> 00:30:44.510
So this becomes a nonlinear function

00:30:44.510 --> 00:30:47.597
because of these like nonlinearities in

00:30:47.597 --> 00:30:48.880
that in that activation.

00:30:48.880 --> 00:30:50.795
But I know I'm throwing out a lot of

00:30:50.795 --> 00:30:51.740
throwing around a lot of terms.

00:30:51.740 --> 00:30:53.720
I'm going to get through it all later,

00:30:53.720 --> 00:30:56.400
but that's just the basic idea, all

00:30:56.400 --> 00:30:56.580
right?

00:30:56.580 --> 00:30:59.586
So here's another example for Digits

00:30:59.586 --> 00:31:02.480
for MNIST digits, which is part of your

00:31:02.480 --> 00:31:03.140
homework too.

00:31:04.090 --> 00:31:05.180
So.

00:31:05.800 --> 00:31:07.590
So we have in the digit problem.

00:31:07.590 --> 00:31:11.830
We have 28 by 28 digit images and we

00:31:11.830 --> 00:31:14.430
then reshape it to a 784 dimensional

00:31:14.430 --> 00:31:16.650
vector so the inputs are the pixel

00:31:16.650 --> 00:31:17.380
intensities.

00:31:19.680 --> 00:31:20.500
That's here.

00:31:20.500 --> 00:31:24.650
So I have X0 which is 784 Values.

00:31:25.720 --> 00:31:27.650
I pass it through what's called a fully

00:31:27.650 --> 00:31:28.550
connected layer.

00:31:28.550 --> 00:31:32.520
It's a linear, it's just linear

00:31:32.520 --> 00:31:33.350
product.

00:31:34.490 --> 00:31:36.870
And now the thing here is that I've got

00:31:36.870 --> 00:31:40.110
I've got here 256 nodes in this layer,

00:31:40.110 --> 00:31:42.235
which means that I'm going to predict

00:31:42.235 --> 00:31:44.130
256 different Values.

00:31:44.790 --> 00:31:47.489
Each one has its own vector of weights

00:31:47.490 --> 00:31:50.735
and the vector of weights that size

00:31:50.735 --> 00:31:53.260
2784 plus one for the bias.

00:31:54.530 --> 00:31:57.330
So I've got 256 values that I'm going

00:31:57.330 --> 00:31:58.360
to produce here.

00:31:58.360 --> 00:32:00.550
Each of them is based on a linear

00:32:00.550 --> 00:32:02.210
combination of these inputs.

00:32:03.690 --> 00:32:05.830
And I can store that as a matrix.

00:32:07.730 --> 00:32:11.070
The matrix is W10 and it has a shape.

00:32:11.750 --> 00:32:15.985
256 by 784 so when I multiply this 256

00:32:15.985 --> 00:32:22.817
by 784 matrix by X0 then I get 256 by 1

00:32:22.817 --> 00:32:23.940
vector right?

00:32:23.940 --> 00:32:26.150
If this is a 784 by 1 vector?

00:32:29.000 --> 00:32:31.510
So now I've got 256 Values.

00:32:31.510 --> 00:32:34.380
I pass it through a nonlinearity and I

00:32:34.380 --> 00:32:36.030
am going to talk about these things

00:32:36.030 --> 00:32:36.380
more.

00:32:36.380 --> 00:32:36.680
But.

00:32:37.450 --> 00:32:38.820
Call it a veliu.

00:32:38.820 --> 00:32:40.605
So this just sets.

00:32:40.605 --> 00:32:42.490
If the Values would have been negative

00:32:42.490 --> 00:32:44.740
then they become zero and if they're

00:32:44.740 --> 00:32:48.100
positive then they stay the same.

00:32:48.100 --> 00:32:49.640
So this.

00:32:49.640 --> 00:32:52.629
I passed my X1 through this and it

00:32:52.630 --> 00:32:55.729
becomes a Max of X1 and zero and I

00:32:55.730 --> 00:32:58.060
still have 256 Values here but now it's

00:32:58.060 --> 00:32:59.440
either zero or positive.

00:33:01.070 --> 00:33:03.470
And then I pass it through another

00:33:03.470 --> 00:33:04.910
fully connected layer if.

00:33:04.910 --> 00:33:06.580
This is if I'm doing 2 hidden layers.

00:33:07.490 --> 00:33:10.780
And this maps it from 256 to 10 because

00:33:10.780 --> 00:33:12.250
I want to predict 10 digits.

00:33:13.370 --> 00:33:16.340
So I've got a 10 by 256 matrix.

00:33:16.340 --> 00:33:21.380
I do a linear mapping into 10 Values.

00:33:22.120 --> 00:33:25.300
And then these can be my scores, my

00:33:25.300 --> 00:33:26.115
logic scores.

00:33:26.115 --> 00:33:28.460
I could have a Sigmoid after this if I

00:33:28.460 --> 00:33:29.859
wanted to map it into zero to 1.

00:33:31.350 --> 00:33:33.020
So these are like the main components

00:33:33.020 --> 00:33:34.405
and again I'm going to talk through

00:33:34.405 --> 00:33:36.130
these a bit more and show you Code and

00:33:36.130 --> 00:33:36.650
stuff, but.

00:33:37.680 --> 00:33:38.750
I've got my Input.

00:33:38.750 --> 00:33:41.690
I've got usually like a series of fully

00:33:41.690 --> 00:33:43.130
connected layers, which are just

00:33:43.130 --> 00:33:45.460
matrices that are learnable matrices of

00:33:45.460 --> 00:33:45.910
Weights.

00:33:47.370 --> 00:33:49.480
Some kind of non linear activation?

00:33:49.480 --> 00:33:51.595
Because if I were to just stack a bunch

00:33:51.595 --> 00:33:54.205
of linear weight multiplications on top

00:33:54.205 --> 00:33:56.233
of each other, that just gives me a

00:33:56.233 --> 00:33:58.110
linear multiplication, so there's no

00:33:58.110 --> 00:33:58.836
point, right?

00:33:58.836 --> 00:34:00.750
If I do a bunch of linear operations,

00:34:00.750 --> 00:34:01.440
it's still linear.

00:34:02.510 --> 00:34:05.289
And one second, and then I have A and

00:34:05.290 --> 00:34:06.690
so I usually have a bunch of a couple

00:34:06.690 --> 00:34:08.192
of these stacked together, and then I

00:34:08.192 --> 00:34:08.800
have my output.

00:34:08.880 --> 00:34:09.050
Yeah.

00:34:14.250 --> 00:34:16.210
So this is the non linear thing this

00:34:16.210 --> 00:34:18.520
Relu this.

00:34:20.290 --> 00:34:23.845
So it's non linear because if I'll show

00:34:23.845 --> 00:34:27.040
you but if it's negative it maps to 0

00:34:27.040 --> 00:34:28.678
so that's pretty non linear and then

00:34:28.678 --> 00:34:30.490
you have this bend and then if it's

00:34:30.490 --> 00:34:32.250
positive it keeps its value.

00:34:37.820 --> 00:34:42.019
So when they lose so I mean so these

00:34:42.020 --> 00:34:44.600
networks, these multilayer perceptrons,

00:34:44.600 --> 00:34:46.610
they're a combination of linear

00:34:46.610 --> 00:34:48.369
functions and non linear functions.

00:34:49.140 --> 00:34:50.930
The linear functions you're taking the

00:34:50.930 --> 00:34:53.430
original Input, Values it by some

00:34:53.430 --> 00:34:55.590
Weights, summing it up, and then you

00:34:55.590 --> 00:34:56.970
get some new output value.

00:34:57.550 --> 00:34:59.670
And then you have usually a nonlinear

00:34:59.670 --> 00:35:01.440
function so that you can.

00:35:02.390 --> 00:35:03.900
So that when you stack a bunch of the

00:35:03.900 --> 00:35:05.340
linear functions together, you end up

00:35:05.340 --> 00:35:06.830
with a non linear function.

00:35:06.830 --> 00:35:08.734
Similar to decision trees and decision

00:35:08.734 --> 00:35:10.633
trees, you have a very simple linear

00:35:10.633 --> 00:35:11.089
function.

00:35:11.090 --> 00:35:13.412
Usually you pick a feature and then you

00:35:13.412 --> 00:35:13.969
threshold it.

00:35:13.970 --> 00:35:15.618
That's a nonlinearity, and then you

00:35:15.618 --> 00:35:17.185
pick a new feature and threshold it.

00:35:17.185 --> 00:35:19.230
And so you're stacking together simple

00:35:19.230 --> 00:35:21.780
linear and nonlinear functions by

00:35:21.780 --> 00:35:23.260
choosing a single variable and then

00:35:23.260 --> 00:35:23.820
thresholding.

00:35:25.770 --> 00:35:29.880
So the simplest activation is a linear

00:35:29.880 --> 00:35:31.560
activation, which is basically a number

00:35:31.560 --> 00:35:31.930
op.

00:35:31.930 --> 00:35:32.820
It doesn't do anything.

00:35:34.060 --> 00:35:37.140
So F of X = X, the derivative of it is

00:35:37.140 --> 00:35:37.863
equal to 1.

00:35:37.863 --> 00:35:39.350
And I'm going to keep on mentioning the

00:35:39.350 --> 00:35:41.866
derivatives because as we'll see, we're

00:35:41.866 --> 00:35:43.240
going to be doing like a Back

00:35:43.240 --> 00:35:44.050
propagation.

00:35:44.050 --> 00:35:46.180
So you flow the gradient back through

00:35:46.180 --> 00:35:48.330
the network, and so you need to know

00:35:48.330 --> 00:35:49.510
what the gradient is of these

00:35:49.510 --> 00:35:51.060
activation functions in order to

00:35:51.060 --> 00:35:51.550
compute that.

00:35:53.050 --> 00:35:55.420
And the size of this gradient is pretty

00:35:55.420 --> 00:35:56.080
important.

00:35:57.530 --> 00:36:00.220
So you could do you could use a linear

00:36:00.220 --> 00:36:01.820
layer if you for example want to

00:36:01.820 --> 00:36:02.358
compress data.

00:36:02.358 --> 00:36:06.050
If you want to map it from 784 Input

00:36:06.050 --> 00:36:09.501
pixels down to 100 Input Values down to

00:36:09.501 --> 00:36:10.289
100 Values.

00:36:10.290 --> 00:36:13.220
Maybe you think 784 is like too high of

00:36:13.220 --> 00:36:14.670
a dimension or some of those features

00:36:14.670 --> 00:36:15.105
are useless.

00:36:15.105 --> 00:36:17.250
So as a first step you just want to map

00:36:17.250 --> 00:36:18.967
it down and you don't need to, you

00:36:18.967 --> 00:36:20.720
don't need to apply any nonlinearity.

00:36:22.380 --> 00:36:24.030
But you would never really stack

00:36:24.030 --> 00:36:26.630
together multiple linear layers.

00:36:27.670 --> 00:36:29.980
Because without non linear activation

00:36:29.980 --> 00:36:31.420
because that's just equivalent to a

00:36:31.420 --> 00:36:32.390
single linear layer.

00:36:35.120 --> 00:36:37.770
Alright, so this Sigmoid.

00:36:38.960 --> 00:36:42.770
So the so the Sigmoid it maps.

00:36:42.870 --> 00:36:43.490


00:36:44.160 --> 00:36:46.060
It maps from an infinite range, from

00:36:46.060 --> 00:36:48.930
negative Infinity to Infinity to some.

00:36:50.690 --> 00:36:52.062
To some zero to 1.

00:36:52.062 --> 00:36:54.358
So basically it can turn anything into

00:36:54.358 --> 00:36:55.114
a probability.

00:36:55.114 --> 00:36:56.485
So it's part of the logistic.

00:36:56.485 --> 00:36:59.170
It's a logistic function, so it maps a

00:36:59.170 --> 00:37:00.890
continuous score into a probability.

00:37:04.020 --> 00:37:04.690
So.

00:37:06.100 --> 00:37:08.240
Sigmoid is actually.

00:37:09.410 --> 00:37:10.820
The.

00:37:11.050 --> 00:37:13.680
It's actually the reason that AI

00:37:13.680 --> 00:37:15.140
stalled for 10 years.

00:37:15.950 --> 00:37:18.560
So this and the reason is the gradient.

00:37:19.610 --> 00:37:20.510
So.

00:37:20.800 --> 00:37:21.560


00:37:24.180 --> 00:37:26.295
All right, so I'm going to try this.

00:37:26.295 --> 00:37:28.610
So rather than talking behind the

00:37:28.610 --> 00:37:31.330
Sigmoid's back, I am going to dramatize

00:37:31.330 --> 00:37:32.370
the Sigmoid.

00:37:32.620 --> 00:37:35.390
Right, Sigmoid.

00:37:36.720 --> 00:37:37.640
What is it?

00:37:38.680 --> 00:37:41.410
You say I Back for 10 years.

00:37:41.410 --> 00:37:42.470
How?

00:37:43.520 --> 00:37:46.120
One problem is your veins.

00:37:46.120 --> 00:37:48.523
You only map from zero to one or from

00:37:48.523 --> 00:37:49.359
zero to 1.

00:37:49.360 --> 00:37:50.980
Sometimes people want a little bit less

00:37:50.980 --> 00:37:52.130
or a little bit more.

00:37:52.130 --> 00:37:53.730
It's like, OK, I like things neat, but

00:37:53.730 --> 00:37:54.690
that doesn't seem too bad.

00:37:55.350 --> 00:37:58.715
Sigmoid, it's not just your range, it's

00:37:58.715 --> 00:37:59.760
your gradient.

00:37:59.760 --> 00:38:00.370
What?

00:38:00.370 --> 00:38:02.020
It's your curves?

00:38:02.020 --> 00:38:02.740
Your slope.

00:38:02.740 --> 00:38:03.640
Have you looked at it?

00:38:04.230 --> 00:38:05.490
It's like, So what?

00:38:05.490 --> 00:38:07.680
I like my lump Black Eyed Peas saying a

00:38:07.680 --> 00:38:08.395
song about it.

00:38:08.395 --> 00:38:08.870
It's good.

00:38:12.150 --> 00:38:16.670
But the problem is that if you get the

00:38:16.670 --> 00:38:19.000
lump may look good, but if you get out

00:38:19.000 --> 00:38:21.110
into the very high values or the very

00:38:21.110 --> 00:38:21.940
low Values.

00:38:22.570 --> 00:38:25.920
You end up with this flat slope.

00:38:25.920 --> 00:38:28.369
So what happens is that if you get on

00:38:28.369 --> 00:38:30.307
top of this hill, you slide down into

00:38:30.307 --> 00:38:32.400
the high Values or you slide down into

00:38:32.400 --> 00:38:34.440
low values and then you can't move

00:38:34.440 --> 00:38:34.910
anymore.

00:38:34.910 --> 00:38:36.180
It's like you're sitting on top of a

00:38:36.180 --> 00:38:37.677
nice till you slide down and you can't

00:38:37.677 --> 00:38:38.730
get back up the ice hill.

00:38:39.600 --> 00:38:41.535
And then if you negate it, then you

00:38:41.535 --> 00:38:43.030
just slide into the center.

00:38:43.030 --> 00:38:44.286
Here you still have a second derivative

00:38:44.286 --> 00:38:46.250
of 0 and you just sit in there.

00:38:46.250 --> 00:38:48.220
So basically you gum up the whole

00:38:48.220 --> 00:38:48.526
works.

00:38:48.526 --> 00:38:50.370
If you get a bunch of these stacked

00:38:50.370 --> 00:38:52.070
together, you end up with a low

00:38:52.070 --> 00:38:54.140
gradient somewhere and then you can't

00:38:54.140 --> 00:38:55.830
optimize it and nothing happens.

00:38:56.500 --> 00:39:00.690
And then Sigmoid is said, man I sorry

00:39:00.690 --> 00:39:02.150
man, I thought I was pretty cool.

00:39:02.150 --> 00:39:04.850
I people have been using me for years.

00:39:04.850 --> 00:39:05.920
It's like OK Sigmoid.

00:39:06.770 --> 00:39:07.500
It's OK.

00:39:07.500 --> 00:39:09.410
You're still a good closer.

00:39:09.410 --> 00:39:11.710
You're still good at getting the

00:39:11.710 --> 00:39:12.860
probability at the end.

00:39:12.860 --> 00:39:16.120
Just please don't go inside the MLP.

00:39:17.370 --> 00:39:19.280
So I hope, I hope he wasn't too sad

00:39:19.280 --> 00:39:20.800
about that.

00:39:20.800 --> 00:39:21.770
But I am pretty mad.

00:39:21.770 --> 00:39:22.130
What?

00:39:27.940 --> 00:39:30.206
The problem with this Sigmoid function

00:39:30.206 --> 00:39:33.160
is that stupid low gradient.

00:39:33.160 --> 00:39:34.880
So everywhere out here it gets a really

00:39:34.880 --> 00:39:35.440
low gradient.

00:39:35.440 --> 00:39:36.980
And the problem is that remember that

00:39:36.980 --> 00:39:38.570
we're going to be taking steps to try

00:39:38.570 --> 00:39:40.090
to improve our.

00:39:40.860 --> 00:39:42.590
Improve our error with respect to the

00:39:42.590 --> 00:39:42.990
gradient.

00:39:43.650 --> 00:39:45.780
And the great if the gradient is 0, it

00:39:45.780 --> 00:39:46.967
means that your steps are zero.

00:39:46.967 --> 00:39:49.226
And this is so close to zero that

00:39:49.226 --> 00:39:49.729
basically.

00:39:49.730 --> 00:39:51.810
I'll show you a demo later, but

00:39:51.810 --> 00:39:53.960
basically this means that you.

00:39:54.610 --> 00:39:56.521
You get unlucky, you get out into this.

00:39:56.521 --> 00:39:57.346
It's not even unlucky.

00:39:57.346 --> 00:39:58.600
It's trying to force you into this

00:39:58.600 --> 00:39:59.340
side.

00:39:59.340 --> 00:40:00.750
But then when you get out here you

00:40:00.750 --> 00:40:02.790
can't move anymore and so you're

00:40:02.790 --> 00:40:05.380
gradient based optimization just gets

00:40:05.380 --> 00:40:06.600
stuck, yeah.

00:40:09.560 --> 00:40:13.270
OK, so the lesson don't put sigmoids

00:40:13.270 --> 00:40:14.280
inside of your MLP.

00:40:15.820 --> 00:40:18.350
This guy Relu is pretty cool.

00:40:18.350 --> 00:40:22.070
He looks very unassuming and stupid,

00:40:22.070 --> 00:40:24.340
but it works.

00:40:24.340 --> 00:40:26.750
So you just have a.

00:40:26.750 --> 00:40:28.170
Anywhere it's negative, it's zero.

00:40:28.170 --> 00:40:30.470
Anywhere it's positive, you pass

00:40:30.470 --> 00:40:30.850
through.

00:40:31.470 --> 00:40:34.830
And is so good about this is that for

00:40:34.830 --> 00:40:37.457
all of these values, the gradient is 11

00:40:37.457 --> 00:40:39.466
is like a pretty high, pretty high

00:40:39.466 --> 00:40:39.759
gradient.

00:40:40.390 --> 00:40:42.590
So if you notice with the Sigmoid, the

00:40:42.590 --> 00:40:45.040
gradient function is the Sigmoid times

00:40:45.040 --> 00:40:46.530
1 minus the Sigmoid.

00:40:46.530 --> 00:40:50.240
This is maximized when F of X is equal

00:40:50.240 --> 00:40:53.035
to 5 and that leads to a 25.

00:40:53.035 --> 00:40:55.920
So it's at most .25 and then it quickly

00:40:55.920 --> 00:40:57.070
goes to zero everywhere.

00:40:58.090 --> 00:40:58.890
This guy.

00:40:59.570 --> 00:41:02.050
Has a gradient of 1 as long as X is

00:41:02.050 --> 00:41:03.120
greater than zero.

00:41:03.120 --> 00:41:04.720
And that means you've got like a lot

00:41:04.720 --> 00:41:06.130
more gradient flowing through your

00:41:06.130 --> 00:41:06.690
network.

00:41:06.690 --> 00:41:09.140
So you can do better optimization.

00:41:09.140 --> 00:41:10.813
And the range is not limited from zero

00:41:10.813 --> 00:41:12.429
to 1, the range can go from zero to

00:41:12.430 --> 00:41:12.900
Infinity.

00:41:15.800 --> 00:41:17.670
So.

00:41:17.740 --> 00:41:18.460


00:41:19.610 --> 00:41:21.840
So let's talk about MLP architectures.

00:41:21.840 --> 00:41:24.545
So the MLP architecture is that you've

00:41:24.545 --> 00:41:26.482
got your inputs, you've got a bunch of

00:41:26.482 --> 00:41:28.136
layers, each of those layers has a

00:41:28.136 --> 00:41:29.530
bunch of nodes, and then you've got

00:41:29.530 --> 00:41:30.830
Activations in between.

00:41:31.700 --> 00:41:33.340
So how do you choose the number of

00:41:33.340 --> 00:41:33.840
layers?

00:41:33.840 --> 00:41:35.290
How do you choose the number of nodes

00:41:35.290 --> 00:41:35.810
per layer?

00:41:35.810 --> 00:41:37.240
It's a little bit of a black art, but

00:41:37.240 --> 00:41:37.980
there is some.

00:41:39.100 --> 00:41:40.580
Reasoning behind it.

00:41:40.580 --> 00:41:42.640
So first, if you don't have any hidden

00:41:42.640 --> 00:41:43.920
layers, then you're stuck with the

00:41:43.920 --> 00:41:44.600
Perceptron.

00:41:45.200 --> 00:41:47.650
And you have a linear model, so you can

00:41:47.650 --> 00:41:48.860
only fit linear boundaries.

00:41:50.580 --> 00:41:52.692
If you only have enough, if you only

00:41:52.692 --> 00:41:54.600
have 1 hidden layer, you can actually

00:41:54.600 --> 00:41:56.500
fit any Boolean function, which means

00:41:56.500 --> 00:41:57.789
anything where you have.

00:41:58.420 --> 00:42:01.650
A bunch of 01 inputs and the output is

00:42:01.650 --> 00:42:03.160
01 like classification.

00:42:03.870 --> 00:42:05.780
You can fit any of those functions, but

00:42:05.780 --> 00:42:07.995
the catch is that you need that the

00:42:07.995 --> 00:42:09.480
number of nodes required grows

00:42:09.480 --> 00:42:10.972
exponentially in the number of inputs

00:42:10.972 --> 00:42:13.150
in the worst case, because essentially

00:42:13.150 --> 00:42:15.340
you just enumerating all the different

00:42:15.340 --> 00:42:16.760
combinations of inputs that are

00:42:16.760 --> 00:42:18.220
possible with your internal layer.

00:42:20.730 --> 00:42:26.070
So further, if you have a single

00:42:26.070 --> 00:42:29.090
Sigmoid layer, that's internal.

00:42:30.080 --> 00:42:32.490
Then, and it's big enough, you can

00:42:32.490 --> 00:42:34.840
model every single bounded continuous

00:42:34.840 --> 00:42:36.610
function, which means that if you have

00:42:36.610 --> 00:42:39.333
a bunch of inputs and your output is a

00:42:39.333 --> 00:42:40.610
single continuous value.

00:42:41.620 --> 00:42:43.340
Or even really Multiple continuous

00:42:43.340 --> 00:42:43.930
values.

00:42:43.930 --> 00:42:47.100
You can approximate it to arbitrary

00:42:47.100 --> 00:42:48.010
accuracy.

00:42:49.240 --> 00:42:50.610
With this single Sigmoid.

00:42:51.540 --> 00:42:53.610
So one layer MLP can fit like almost

00:42:53.610 --> 00:42:54.170
everything.

00:42:55.750 --> 00:42:58.620
And if you have a two layer MLP.

00:42:59.950 --> 00:43:01.450
With Sigmoid activation.

00:43:02.350 --> 00:43:03.260
Then.

00:43:04.150 --> 00:43:06.900
Then you can approximate any function

00:43:06.900 --> 00:43:09.700
with arbitrary accuracy, right?

00:43:09.700 --> 00:43:12.510
So this all sounds pretty good.

00:43:15.040 --> 00:43:16.330
So here's a question.

00:43:16.330 --> 00:43:18.170
Does it ever make sense to have more

00:43:18.170 --> 00:43:20.160
than two internal layers given this?

00:43:23.460 --> 00:43:24.430
Why?

00:43:26.170 --> 00:43:29.124
I just said that you can fit any

00:43:29.124 --> 00:43:30.570
function, or I didn't say you could fit

00:43:30.570 --> 00:43:30.680
it.

00:43:30.680 --> 00:43:33.470
I said you can approximate any function

00:43:33.470 --> 00:43:35.460
to arbitrary accuracy, which means

00:43:35.460 --> 00:43:36.350
infinite precision.

00:43:37.320 --> 00:43:38.110
With two layers.

00:43:45.400 --> 00:43:48.000
So one thing you could say is maybe

00:43:48.000 --> 00:43:50.010
like maybe it's possible to do it too

00:43:50.010 --> 00:43:51.140
layers, but you can't find the right

00:43:51.140 --> 00:43:52.810
two layers, so maybe add some more and

00:43:52.810 --> 00:43:53.500
then maybe you'll get.

00:43:54.380 --> 00:43:55.500
OK, that's reasonable.

00:43:55.500 --> 00:43:56.260
Any other answer?

00:43:56.900 --> 00:43:57.180
Yeah.

00:44:04.590 --> 00:44:07.290
Right, so that's an issue that these

00:44:07.290 --> 00:44:09.600
may require like a huge number of

00:44:09.600 --> 00:44:10.100
nodes.

00:44:10.910 --> 00:44:14.300
And so the reason to go deeper is

00:44:14.300 --> 00:44:15.470
compositionality.

00:44:16.980 --> 00:44:20.660
So you may be able to enumerate, for

00:44:20.660 --> 00:44:22.460
example, all the different Boolean

00:44:22.460 --> 00:44:24.220
things with a single layer.

00:44:24.220 --> 00:44:26.760
But if you had a stack of layers, then

00:44:26.760 --> 00:44:29.462
you can model, then one of them is

00:44:29.462 --> 00:44:29.915
like.

00:44:29.915 --> 00:44:32.570
Is like partitions the data, so it

00:44:32.570 --> 00:44:34.194
creates like a bunch of models, a bunch

00:44:34.194 --> 00:44:35.675
of functions, and then the next one

00:44:35.675 --> 00:44:37.103
models functions of functions and

00:44:37.103 --> 00:44:37.959
functions of functions.

00:44:39.370 --> 00:44:42.790
Functions of functions and functions.

00:44:42.790 --> 00:44:45.780
So compositionality is a more efficient

00:44:45.780 --> 00:44:46.570
representation.

00:44:46.570 --> 00:44:48.540
You can model model things, and then

00:44:48.540 --> 00:44:49.905
model combinations of those things.

00:44:49.905 --> 00:44:51.600
And you can do it with fewer nodes.

00:44:52.890 --> 00:44:54.060
Fewer nodes, OK.

00:44:54.830 --> 00:44:57.230
So it can make sense to make have more

00:44:57.230 --> 00:44:58.590
than two internal layers.

00:45:00.830 --> 00:45:02.745
And you can see the seductiveness of

00:45:02.745 --> 00:45:03.840
the Sigmoid here like.

00:45:04.650 --> 00:45:06.340
You can model anything with Sigmoid

00:45:06.340 --> 00:45:08.800
activation, so why not use it right?

00:45:08.800 --> 00:45:10.230
So that's why people used it.

00:45:11.270 --> 00:45:12.960
That's why it got stuck.

00:45:13.980 --> 00:45:14.880
So.

00:45:14.950 --> 00:45:15.730
And.

00:45:16.840 --> 00:45:18.770
You also have, like the number the

00:45:18.770 --> 00:45:20.440
other parameters, the number of nodes

00:45:20.440 --> 00:45:21.950
per hidden layer, called the width.

00:45:21.950 --> 00:45:23.800
If you have more nodes, it means more

00:45:23.800 --> 00:45:25.790
representational power and more

00:45:25.790 --> 00:45:26.230
parameters.

00:45:27.690 --> 00:45:30.460
So, and that's just a design decision.

00:45:31.600 --> 00:45:33.420
That you could use fit with cross

00:45:33.420 --> 00:45:34.820
validation or something.

00:45:35.650 --> 00:45:37.610
And then each layer has an activation

00:45:37.610 --> 00:45:39.145
function, and I talked about those

00:45:39.145 --> 00:45:40.080
activation functions.

00:45:41.820 --> 00:45:43.440
Here's one early example.

00:45:43.440 --> 00:45:45.082
It's not an early example, but here's

00:45:45.082 --> 00:45:47.700
an example of application of MLP.

00:45:48.860 --> 00:45:51.020
To backgammon, this is a famous case.

00:45:51.790 --> 00:45:53.480
From 1992.

00:45:54.400 --> 00:45:56.490
They for the first version.

00:45:57.620 --> 00:46:00.419
So first backgammon you one side is

00:46:00.419 --> 00:46:02.120
trying to move their pieces around the

00:46:02.120 --> 00:46:03.307
board one way to their home.

00:46:03.307 --> 00:46:04.903
The other side is trying to move the

00:46:04.903 --> 00:46:06.300
pieces around the other way to their

00:46:06.300 --> 00:46:06.499
home.

00:46:07.660 --> 00:46:09.060
And it's a dice based game.

00:46:10.130 --> 00:46:13.110
So one way that you can represent the

00:46:13.110 --> 00:46:14.900
game is just the number of pieces that

00:46:14.900 --> 00:46:16.876
are on each of these spaces.

00:46:16.876 --> 00:46:19.250
So the earliest version they just

00:46:19.250 --> 00:46:20.510
directly represented that.

00:46:21.460 --> 00:46:23.670
Then they have an MLP with one internal

00:46:23.670 --> 00:46:27.420
layer that just had 40 hidden units.

00:46:28.570 --> 00:46:32.270
And they played two hundred 200,000

00:46:32.270 --> 00:46:34.440
games against other programs using

00:46:34.440 --> 00:46:35.390
reinforcement learning.

00:46:35.390 --> 00:46:37.345
So the main idea of reinforcement

00:46:37.345 --> 00:46:40.160
learning is that you have some problem

00:46:40.160 --> 00:46:41.640
you want to solve, like winning the

00:46:41.640 --> 00:46:41.950
game.

00:46:42.740 --> 00:46:44.250
And you want to take actions that bring

00:46:44.250 --> 00:46:45.990
you closer to that goal, but you don't

00:46:45.990 --> 00:46:48.439
know if you won right away and so you

00:46:48.440 --> 00:46:50.883
need to use like a discounted reward.

00:46:50.883 --> 00:46:53.200
So usually I have like 2 reward

00:46:53.200 --> 00:46:53.710
functions.

00:46:53.710 --> 00:46:55.736
One is like how good is my game state?

00:46:55.736 --> 00:46:57.490
So moving your pieces closer to home

00:46:57.490 --> 00:46:58.985
might improve your score of the game

00:46:58.985 --> 00:46:59.260
state.

00:46:59.960 --> 00:47:01.760
And the other is like, did you win?

00:47:01.760 --> 00:47:05.010
And then you're going to score your

00:47:05.010 --> 00:47:09.060
decisions based on the reward of taking

00:47:09.060 --> 00:47:10.590
the step, as well as like future

00:47:10.590 --> 00:47:11.690
rewards that you receive.

00:47:11.690 --> 00:47:13.888
So at the end of the game you win, then

00:47:13.888 --> 00:47:15.526
that kind of flows back and tells you

00:47:15.526 --> 00:47:16.956
that the steps that you took during the

00:47:16.956 --> 00:47:17.560
game were good.

00:47:19.060 --> 00:47:20.400
There's a whole classes on

00:47:20.400 --> 00:47:22.320
reinforcement learning, but that's the

00:47:22.320 --> 00:47:23.770
basic idea and that's how they.

00:47:24.700 --> 00:47:26.620
Solve this problem.

00:47:28.420 --> 00:47:30.810
So even the first version, which had

00:47:30.810 --> 00:47:33.090
no, which was just like very simple

00:47:33.090 --> 00:47:35.360
inputs, was able to perform competitive

00:47:35.360 --> 00:47:37.205
competitively with world experts.

00:47:37.205 --> 00:47:39.250
And so that was an impressive

00:47:39.250 --> 00:47:43.100
demonstration that AI and machine

00:47:43.100 --> 00:47:45.300
learning can do amazing things.

00:47:45.300 --> 00:47:47.510
You can beat world experts in this game

00:47:47.510 --> 00:47:49.540
without any expertise just by setting

00:47:49.540 --> 00:47:50.760
up a machine learning problem and

00:47:50.760 --> 00:47:52.880
having a computer play other computers.

00:47:54.150 --> 00:47:56.050
Then they put some experts in it,

00:47:56.050 --> 00:47:57.620
designed better features, made the

00:47:57.620 --> 00:47:59.710
network a little bit bigger, trained,

00:47:59.710 --> 00:48:02.255
played more games, virtual games, and

00:48:02.255 --> 00:48:04.660
then they were able to again compete

00:48:04.660 --> 00:48:07.210
well with Grand Masters and experts.

00:48:08.280 --> 00:48:10.110
So this is kind of like the forerunner

00:48:10.110 --> 00:48:12.560
of deep blue or is it deep blue,

00:48:12.560 --> 00:48:13.100
Watson?

00:48:13.770 --> 00:48:15.635
Maybe Watson, I don't know the guy that

00:48:15.635 --> 00:48:17.060
the computer that played chess.

00:48:17.910 --> 00:48:19.210
As well as alpha go.

00:48:22.370 --> 00:48:26.070
So now I want to talk about how we

00:48:26.070 --> 00:48:27.080
optimize this thing.

00:48:27.770 --> 00:48:31.930
And the details are not too important,

00:48:31.930 --> 00:48:33.650
but the concept is really, really

00:48:33.650 --> 00:48:33.940
important.

00:48:35.150 --> 00:48:38.190
So we're going to optimize these MLP's

00:48:38.190 --> 00:48:40.150
using Back propagation.

00:48:40.580 --> 00:48:45.070
Back propagation is just an extension

00:48:45.070 --> 00:48:46.430
of.

00:48:46.570 --> 00:48:49.540
Of SGD of stochastic gradient descent.

00:48:50.460 --> 00:48:51.850
Where we just apply the chain rule a

00:48:51.850 --> 00:48:53.180
little bit more.

00:48:53.180 --> 00:48:54.442
So let's take this simple network.

00:48:54.442 --> 00:48:56.199
I've got two inputs, I've got 2

00:48:56.200 --> 00:48:57.210
intermediate nodes.

00:48:58.230 --> 00:48:59.956
Going to represent their outputs as F3

00:48:59.956 --> 00:49:00.840
and four.

00:49:00.840 --> 00:49:03.290
I've gotten output node which I'll call

00:49:03.290 --> 00:49:04.590
G5 and the Weights.

00:49:04.590 --> 00:49:06.910
I'm using a like weight and then two

00:49:06.910 --> 00:49:08.559
indices which are like where it's

00:49:08.560 --> 00:49:09.750
coming from and where it's going.

00:49:09.750 --> 00:49:11.920
So F3 to G5 is W 35.

00:49:13.420 --> 00:49:18.210
And so the output here is some function

00:49:18.210 --> 00:49:20.550
of the two intermediate nodes and each

00:49:20.550 --> 00:49:21.230
of those.

00:49:21.230 --> 00:49:24.140
So in particular W 3/5 times if three

00:49:24.140 --> 00:49:25.880
plus W four 5 * 4.

00:49:26.650 --> 00:49:28.420
And each of those intermediate nodes is

00:49:28.420 --> 00:49:29.955
a linear combination of the inputs.

00:49:29.955 --> 00:49:31.660
And to keep things simple, I'll just

00:49:31.660 --> 00:49:33.070
say linear activation for now.

00:49:33.990 --> 00:49:35.904
My error function is the squared

00:49:35.904 --> 00:49:37.970
function, the squared difference of the

00:49:37.970 --> 00:49:39.400
prediction and the output.

00:49:41.880 --> 00:49:44.320
So I just as before, if I want to

00:49:44.320 --> 00:49:46.210
optimize this, I compute the partial

00:49:46.210 --> 00:49:47.985
derivative of my error with respect to

00:49:47.985 --> 00:49:49.420
the Weights for a given sample.

00:49:50.600 --> 00:49:53.400
And I apply the chain rule again.

00:49:54.620 --> 00:49:57.130
And I get for this weight.

00:49:57.130 --> 00:50:02.400
Here it becomes again two times this

00:50:02.400 --> 00:50:04.320
derivative of the error function, the

00:50:04.320 --> 00:50:05.440
prediction minus Y.

00:50:06.200 --> 00:50:10.530
Times the derivative of the inside of

00:50:10.530 --> 00:50:12.550
this function with respect to my weight

00:50:12.550 --> 00:50:13.440
W 35.

00:50:13.440 --> 00:50:15.180
I'm optimizing it for W 35.

00:50:16.390 --> 00:50:16.800
Right.

00:50:16.800 --> 00:50:18.770
So the derivative of this guy with

00:50:18.770 --> 00:50:21.220
respect to the weight, if I look up at

00:50:21.220 --> 00:50:21.540
this.

00:50:24.490 --> 00:50:26.880
If I look at this function up here.

00:50:27.590 --> 00:50:31.278
The derivative of W-35 times F3 plus W

00:50:31.278 --> 00:50:33.670
Four 5 * 4 is just F3.

00:50:34.560 --> 00:50:36.530
Right, so that gives me that my

00:50:36.530 --> 00:50:41.050
derivative is 2 * g Five X -, y * F

00:50:41.050 --> 00:50:41.750
three of X.

00:50:42.480 --> 00:50:44.670
And then I take a step in that negative

00:50:44.670 --> 00:50:46.695
direction in order to do my update for

00:50:46.695 --> 00:50:47.190
this weight.

00:50:47.190 --> 00:50:48.760
So this is very similar to the

00:50:48.760 --> 00:50:50.574
Perceptron, except instead of the Input

00:50:50.574 --> 00:50:53.243
I have the previous node as part of

00:50:53.243 --> 00:50:54.106
this function here.

00:50:54.106 --> 00:50:55.610
So I have my error gradient and then

00:50:55.610 --> 00:50:56.490
the input to the.

00:50:57.100 --> 00:50:59.240
Being multiplied together and that

00:50:59.240 --> 00:51:01.830
gives me my direction of the gradient.

00:51:03.860 --> 00:51:06.250
For the internal nodes, I have to just

00:51:06.250 --> 00:51:08.160
apply the chain rule recursively.

00:51:08.870 --> 00:51:11.985
So if I want to solve for the update

00:51:11.985 --> 00:51:13.380
for W 113.

00:51:14.360 --> 00:51:17.626
Then I take the derivative.

00:51:17.626 --> 00:51:19.920
I do again, again, again get this

00:51:19.920 --> 00:51:21.410
derivative of the error.

00:51:21.410 --> 00:51:23.236
Then I take the derivative of the

00:51:23.236 --> 00:51:25.930
output with respect to West 1/3, which

00:51:25.930 --> 00:51:27.250
brings me into this.

00:51:27.250 --> 00:51:29.720
And then if I follow that through, I

00:51:29.720 --> 00:51:32.450
end up with the derivative of the

00:51:32.450 --> 00:51:36.610
output with respect to W13 is W-35

00:51:36.610 --> 00:51:37.830
times X1.

00:51:38.720 --> 00:51:40.540
And so I get this as my update.

00:51:42.270 --> 00:51:44.100
And so I end up with these three parts

00:51:44.100 --> 00:51:45.180
to the update.

00:51:45.180 --> 00:51:47.450
This product of three terms, that one

00:51:47.450 --> 00:51:49.111
term is the error gradient, the

00:51:49.111 --> 00:51:50.310
gradient error gradient in my

00:51:50.310 --> 00:51:50.870
prediction.

00:51:51.570 --> 00:51:54.030
The other is like the input into the

00:51:54.030 --> 00:51:56.890
function and the third is the

00:51:56.890 --> 00:51:59.400
contribution how this like contributed

00:51:59.400 --> 00:52:02.510
to the output which is through W 35

00:52:02.510 --> 00:52:06.300
because W 113 Help create F3 which then

00:52:06.300 --> 00:52:08.499
contributes to the output through W 35.

00:52:12.700 --> 00:52:15.080
And this was for a linear activation.

00:52:15.080 --> 00:52:18.759
But if I had a Relu all I would do is I

00:52:18.760 --> 00:52:19.920
modify this.

00:52:19.920 --> 00:52:22.677
Like if I have a Relu after F3 and F4

00:52:22.677 --> 00:52:27.970
that means that F3 is going to be W 1/3

00:52:27.970 --> 00:52:30.380
times Max of X10.

00:52:31.790 --> 00:52:33.690
And.

00:52:34.310 --> 00:52:35.620
Did I put that really in the right

00:52:35.620 --> 00:52:36.140
place?

00:52:36.140 --> 00:52:38.190
All right, let me go with it.

00:52:38.190 --> 00:52:38.980
So.

00:52:39.080 --> 00:52:42.890
FW13 times this is if I put a rally

00:52:42.890 --> 00:52:44.360
right here, which is a weird place.

00:52:44.360 --> 00:52:47.353
But let's just say I did it OK W 1/3

00:52:47.353 --> 00:52:50.737
times Max of X10 plus W 2/3 of Max X20.

00:52:50.737 --> 00:52:54.060
And then I just plug that into my.

00:52:54.060 --> 00:52:56.938
So then the Max of X10 just becomes.

00:52:56.938 --> 00:52:59.880
I mean the X1 becomes Max of X1 and 0.

00:53:01.190 --> 00:53:02.990
I think I put it value here where I

00:53:02.990 --> 00:53:04.780
meant to put it here, but the main

00:53:04.780 --> 00:53:06.658
point is that you then take the

00:53:06.658 --> 00:53:09.170
derivative, then you just follow the

00:53:09.170 --> 00:53:10.870
chain rule, take the derivative of the

00:53:10.870 --> 00:53:11.840
activation as well.

00:53:16.130 --> 00:53:20.219
So the general concept of the.

00:53:20.700 --> 00:53:23.480
Backprop is that each Weights gradient

00:53:23.480 --> 00:53:26.000
based on a single training sample is a

00:53:26.000 --> 00:53:27.540
product of the gradient of the loss

00:53:27.540 --> 00:53:28.070
function.

00:53:29.060 --> 00:53:30.981
And the gradient of the prediction with

00:53:30.981 --> 00:53:33.507
respect to the activation and the

00:53:33.507 --> 00:53:36.033
gradient of the activation with respect

00:53:36.033 --> 00:53:38.800
to the with respect to the weight.

00:53:39.460 --> 00:53:41.570
So it's like a gradient that says how I

00:53:41.570 --> 00:53:42.886
got for W13.

00:53:42.886 --> 00:53:45.670
It's like what was fed into me.

00:53:45.670 --> 00:53:47.990
How does how does the value that I'm

00:53:47.990 --> 00:53:49.859
producing depend on what's fed into me?

00:53:50.500 --> 00:53:51.630
What did I produce?

00:53:51.630 --> 00:53:53.920
How did I influence this W this F3

00:53:53.920 --> 00:53:57.360
function and how did that impact my

00:53:57.360 --> 00:53:58.880
gradient error gradient?

00:54:00.980 --> 00:54:03.380
And because you're applying chain rule

00:54:03.380 --> 00:54:05.495
recursively, you can save computation

00:54:05.495 --> 00:54:08.920
and each weight ends up being like a

00:54:08.920 --> 00:54:11.940
kind of a product of the gradient that

00:54:11.940 --> 00:54:13.890
was accumulated in the Weights after it

00:54:13.890 --> 00:54:16.100
with the Input that came before it.

00:54:19.910 --> 00:54:21.450
OK, so it's a little bit late for this,

00:54:21.450 --> 00:54:22.440
but let's do it anyway.

00:54:22.440 --> 00:54:25.330
So take a 2 minute break and you can

00:54:25.330 --> 00:54:26.610
think about this question.

00:54:26.610 --> 00:54:29.127
So if I want to fill in the blanks, if

00:54:29.127 --> 00:54:31.320
I want to get the gradient with respect

00:54:31.320 --> 00:54:34.290
to W 8 and the gradient with respect to

00:54:34.290 --> 00:54:34.950
W 2.

00:54:36.150 --> 00:54:37.960
How do I fill in those blanks?

00:54:38.920 --> 00:54:40.880
And let's say that it's all linear

00:54:40.880 --> 00:54:41.430
layers.

00:54:44.280 --> 00:54:45.690
I'll set a timer for 2 minutes.

00:55:12.550 --> 00:55:14.880
The input size and that output size.

00:55:17.260 --> 00:55:17.900
Yeah.

00:55:18.070 --> 00:55:20.310
Input size are we talking like the row

00:55:20.310 --> 00:55:20.590
of the?

00:55:22.870 --> 00:55:23.650
Yes.

00:55:23.650 --> 00:55:25.669
So it'll be like 784, right?

00:55:25.670 --> 00:55:28.670
And then output sizes colon, right,

00:55:28.670 --> 00:55:30.350
because we're talking about the number

00:55:30.350 --> 00:55:30.520
of.

00:55:32.050 --> 00:55:35.820
Out output size is the number of values

00:55:35.820 --> 00:55:36.795
that you're trying to predict.

00:55:36.795 --> 00:55:39.130
So for Digits it would be 10 all

00:55:39.130 --> 00:55:41.550
because that's the testing, that's the

00:55:41.550 --> 00:55:42.980
label side, the number of labels that

00:55:42.980 --> 00:55:43.400
you have.

00:55:43.400 --> 00:55:45.645
So it's a row of the test, right?

00:55:45.645 --> 00:55:46.580
That's would be my.

00:55:49.290 --> 00:55:51.140
But it's not the number of examples,

00:55:51.140 --> 00:55:52.560
it's a number of different labels that

00:55:52.560 --> 00:55:53.310
you can have.

00:55:53.310 --> 00:55:53.866
So doesn't.

00:55:53.866 --> 00:55:56.080
It's not really a row or a column,

00:55:56.080 --> 00:55:56.320
right?

00:55:57.500 --> 00:55:59.335
Because then you're data vectors you

00:55:59.335 --> 00:56:01.040
have like X which is number of examples

00:56:01.040 --> 00:56:02.742
by number of features, and then you

00:56:02.742 --> 00:56:04.328
have Y which is number of examples by

00:56:04.328 --> 00:56:04.549
1.

00:56:05.440 --> 00:56:07.580
But the out you have one output per

00:56:07.580 --> 00:56:10.410
label, so per class.

00:56:11.650 --> 00:56:12.460
There, it's 10.

00:56:13.080 --> 00:56:14.450
Because you have 10 digits.

00:56:14.450 --> 00:56:16.520
Alright, thank you.

00:56:16.520 --> 00:56:17.250
You're welcome.

00:56:29.150 --> 00:56:31.060
Alright, so let's try it.

00:56:31.160 --> 00:56:31.770


00:56:34.070 --> 00:56:37.195
So this is probably a hard question.

00:56:37.195 --> 00:56:40.160
You've just been exposed to Backprop,

00:56:40.160 --> 00:56:42.330
but I think solving it out loud will

00:56:42.330 --> 00:56:43.680
probably make this a little more clear.

00:56:43.680 --> 00:56:44.000
So.

00:56:44.730 --> 00:56:46.330
Gradient with respect to W.

00:56:46.330 --> 00:56:48.840
Does anyone have an idea what these

00:56:48.840 --> 00:56:49.810
blanks would be?

00:57:07.100 --> 00:57:08.815
It might be, I'm not sure.

00:57:08.815 --> 00:57:11.147
I'm not sure I can do it without the.

00:57:11.147 --> 00:57:13.710
I was not putting it in terms of

00:57:13.710 --> 00:57:16.000
derivatives though, just in terms of

00:57:16.000 --> 00:57:17.860
purely in terms of the X's.

00:57:17.860 --> 00:57:19.730
H is the G's and the W's.

00:57:21.200 --> 00:57:24.970
Alright, so part of it is that I would

00:57:24.970 --> 00:57:27.019
have how this.

00:57:27.020 --> 00:57:29.880
Here I have how this weight contributes

00:57:29.880 --> 00:57:30.560
to the output.

00:57:31.490 --> 00:57:34.052
So it's going to flow through these

00:57:34.052 --> 00:57:37.698
guys, right, goes through W7 and W3

00:57:37.698 --> 00:57:40.513
through G1 and it also flows through

00:57:40.513 --> 00:57:41.219
these guys.

00:57:42.790 --> 00:57:45.280
Right, so part of it will end up being

00:57:45.280 --> 00:57:48.427
W 0 times W 9 this path and part of it

00:57:48.427 --> 00:57:52.570
will be W 7 three times W 7 this path.

00:57:54.720 --> 00:57:57.500
So this is 1 portion like how it's

00:57:57.500 --> 00:57:58.755
influenced the output.

00:57:58.755 --> 00:58:00.610
This is my output gradient which I

00:58:00.610 --> 00:58:01.290
started with.

00:58:02.070 --> 00:58:04.486
My error gradient and then it's going

00:58:04.486 --> 00:58:07.100
to be multiplied by the input, which is

00:58:07.100 --> 00:58:09.220
like how the magnitude, how this

00:58:09.220 --> 00:58:11.610
Weights, whether it made a positive or

00:58:11.610 --> 00:58:13.050
negative number for example, and how

00:58:13.050 --> 00:58:15.900
big, and that's going to depend on X2.

00:58:16.940 --> 00:58:17.250
Right.

00:58:17.250 --> 00:58:18.230
So it's just the.

00:58:19.270 --> 00:58:21.670
The sum of the paths to the output

00:58:21.670 --> 00:58:23.250
times the Input, yeah.

00:58:27.530 --> 00:58:29.240
I'm computing the gradient with respect

00:58:29.240 --> 00:58:30.430
to weight here.

00:58:31.610 --> 00:58:32.030
Yeah.

00:58:33.290 --> 00:58:33.480
Yeah.

00:58:42.070 --> 00:58:45.172
Yeah, it's not like it's a.

00:58:45.172 --> 00:58:47.240
It's written as an undirected graph,

00:58:47.240 --> 00:58:49.390
but it's not like a.

00:58:49.390 --> 00:58:50.830
It doesn't imply a flow direction

00:58:50.830 --> 00:58:51.490
necessarily.

00:58:52.440 --> 00:58:54.790
But when you do, but we do think of it

00:58:54.790 --> 00:58:55.080
that way.

00:58:55.080 --> 00:58:56.880
So we think of forward as you're making

00:58:56.880 --> 00:58:59.480
a prediction and Backprop is your

00:58:59.480 --> 00:59:01.480
propagating the error gradients back to

00:59:01.480 --> 00:59:02.450
the Weights to update them.

00:59:04.440 --> 00:59:05.240
And then?

00:59:10.810 --> 00:59:13.260
Yeah, it doesn't imply causality or

00:59:13.260 --> 00:59:15.070
anything like that like a like a

00:59:15.070 --> 00:59:16.020
Bayesian network might.

00:59:19.570 --> 00:59:23.061
All right, and then with W 2, it'll be

00:59:23.061 --> 00:59:25.910
the connection of the output is through

00:59:25.910 --> 00:59:29.845
W 3, and the connection to the Input is

00:59:29.845 --> 00:59:32.400
H1, so it will be the output of H1

00:59:32.400 --> 00:59:34.240
times W 3.

00:59:39.320 --> 00:59:41.500
So that's for linear and then if you

00:59:41.500 --> 00:59:43.430
have non linear it will be.

00:59:43.510 --> 00:59:44.940
I like it.

00:59:44.940 --> 00:59:46.710
Will be longer, you'll have more.

00:59:46.710 --> 00:59:48.320
You'll have those nonlinearities like

00:59:48.320 --> 00:59:49.270
come into play, yeah?

00:59:58.440 --> 01:00:00.325
So it would end up being.

01:00:00.325 --> 01:00:03.420
So it's kind of like so I did it for a

01:00:03.420 --> 01:00:04.600
smaller function here.

01:00:05.290 --> 01:00:07.833
But if you take if you do the chain

01:00:07.833 --> 01:00:10.240
rule through, if you take the partial

01:00:10.240 --> 01:00:11.790
derivative and then you follow the

01:00:11.790 --> 01:00:13.430
chain rule or you expand your

01:00:13.430 --> 01:00:14.080
functions.

01:00:14.800 --> 01:00:15.930
Then you will.

01:00:16.740 --> 01:00:17.640
You'll get there.

01:00:18.930 --> 01:00:19.490
So.

01:00:21.900 --> 01:00:23.730
Mathematically, you would get there

01:00:23.730 --> 01:00:25.890
this way, and then in practice the way

01:00:25.890 --> 01:00:28.305
that it's implemented usually is that

01:00:28.305 --> 01:00:30.720
you would accumulate you can compute

01:00:30.720 --> 01:00:32.800
the contribution of the error.

01:00:33.680 --> 01:00:36.200
Each node like how this nodes output

01:00:36.200 --> 01:00:38.370
affected the error the error.

01:00:38.990 --> 01:00:41.489
And then you propagate and then you

01:00:41.490 --> 01:00:41.710
can.

01:00:42.380 --> 01:00:45.790
Can say that this Weights gradient is

01:00:45.790 --> 01:00:47.830
its error contribution on this node

01:00:47.830 --> 01:00:49.990
times the Input.

01:00:50.660 --> 01:00:52.460
And then you keep on like propagating

01:00:52.460 --> 01:00:54.110
that error contribution backwards

01:00:54.110 --> 01:00:56.220
recursively and then updating the

01:00:56.220 --> 01:00:57.650
previous layers we.

01:00:59.610 --> 01:01:01.980
So one thing I would like to clarify is

01:01:01.980 --> 01:01:04.190
that I'm not going to ask any questions

01:01:04.190 --> 01:01:07.016
about how you compute the.

01:01:07.016 --> 01:01:10.700
I'm not going to ask you guys in an

01:01:10.700 --> 01:01:13.130
exam like to compute the gradient or to

01:01:13.130 --> 01:01:13.980
perform Backprop.

01:01:14.840 --> 01:01:16.850
But I think it's important to

01:01:16.850 --> 01:01:20.279
understand this concept that the

01:01:20.280 --> 01:01:22.740
gradients are flowing back through the

01:01:22.740 --> 01:01:25.220
Weights and one consequence of that.

01:01:25.980 --> 01:01:27.640
Is that you can imagine if this layer

01:01:27.640 --> 01:01:29.930
were really deep, if any of these

01:01:29.930 --> 01:01:32.025
weights are zero, or if some fraction

01:01:32.025 --> 01:01:34.160
of them are zero, then it's pretty easy

01:01:34.160 --> 01:01:35.830
for this gradient to become zero, which

01:01:35.830 --> 01:01:36.950
means you don't get any update.

01:01:37.610 --> 01:01:39.240
And if you have Sigmoid adds, a lot of

01:01:39.240 --> 01:01:40.680
these weights are zero, which means

01:01:40.680 --> 01:01:42.260
that there's no updates flowing into

01:01:42.260 --> 01:01:43.870
the early layers, which is what

01:01:43.870 --> 01:01:44.720
cripples the learning.

01:01:45.520 --> 01:01:47.590
And even with raley's, if this gets

01:01:47.590 --> 01:01:50.020
really deep, then you end up with a lot

01:01:50.020 --> 01:01:52.790
of zeros and you end up also having the

01:01:52.790 --> 01:01:53.490
same problem.

01:01:54.880 --> 01:01:57.240
So that's going to foreshadowing some

01:01:57.240 --> 01:01:59.760
of the difficulties that neural

01:01:59.760 --> 01:02:00.500
networks will have.

01:02:02.140 --> 01:02:06.255
If I want to do optimization by SGD,

01:02:06.255 --> 01:02:09.250
then it's, then this is the basic

01:02:09.250 --> 01:02:09.525
algorithm.

01:02:09.525 --> 01:02:11.090
I split the data into batches.

01:02:11.090 --> 01:02:12.110
I set some learning rate.

01:02:13.170 --> 01:02:15.715
I go for each or for each epac POC.

01:02:15.715 --> 01:02:17.380
I do that so for each pass through the

01:02:17.380 --> 01:02:19.630
data for each batch I compute the

01:02:19.630 --> 01:02:20.120
output.

01:02:22.250 --> 01:02:23.010
My predictions.

01:02:23.010 --> 01:02:25.790
In other words, I Evaluate the loss, I

01:02:25.790 --> 01:02:27.160
compute the gradients with Back

01:02:27.160 --> 01:02:29.170
propagation, and then I update the

01:02:29.170 --> 01:02:29.660
weights.

01:02:29.660 --> 01:02:30.780
Those are the four steps.

01:02:31.910 --> 01:02:33.520
And I'll show you that how we do that

01:02:33.520 --> 01:02:36.700
in Code with torch in a minute, but

01:02:36.700 --> 01:02:37.110
first.

01:02:38.480 --> 01:02:40.550
Why go from Perceptrons to MLPS?

01:02:40.550 --> 01:02:43.310
So the big benefit is that we get a lot

01:02:43.310 --> 01:02:44.430
more expressivity.

01:02:44.430 --> 01:02:46.370
We can model potentially any function

01:02:46.370 --> 01:02:49.187
with MLPS, while with Perceptrons we

01:02:49.187 --> 01:02:50.910
can only model linear functions.

01:02:50.910 --> 01:02:52.357
So that's a big benefit.

01:02:52.357 --> 01:02:53.970
And of course like we could like

01:02:53.970 --> 01:02:55.670
manually project things into higher

01:02:55.670 --> 01:02:57.540
dimensions and use polar coordinates or

01:02:57.540 --> 01:02:58.790
squares or whatever.

01:02:58.790 --> 01:03:01.500
But the nice thing is that the MLP's

01:03:01.500 --> 01:03:03.650
you can optimize the features and your

01:03:03.650 --> 01:03:05.150
prediction at the same time to work

01:03:05.150 --> 01:03:06.050
well together.

01:03:06.050 --> 01:03:08.310
And so it takes the.

01:03:08.380 --> 01:03:10.719
Expert out of the loop a bit if you can

01:03:10.720 --> 01:03:12.320
do this really well, so you can just

01:03:12.320 --> 01:03:14.240
take your data and learn really good

01:03:14.240 --> 01:03:15.620
features and learn a really good

01:03:15.620 --> 01:03:16.230
prediction.

01:03:16.900 --> 01:03:19.570
Jointly, so that you can get a good

01:03:19.570 --> 01:03:22.220
predictor based on simple features.

01:03:24.090 --> 01:03:26.050
The problems are that the optimization

01:03:26.050 --> 01:03:29.640
is no longer convex, you can get stuck

01:03:29.640 --> 01:03:30.480
in local minima.

01:03:30.480 --> 01:03:31.930
You're no longer guaranteed to reach a

01:03:31.930 --> 01:03:33.440
globally optimum solution.

01:03:33.440 --> 01:03:34.560
I'm going to talk more about

01:03:34.560 --> 01:03:37.210
optimization and this issue next class.

01:03:37.840 --> 01:03:39.730
You also have a larger model, which

01:03:39.730 --> 01:03:41.265
means more training and inference time

01:03:41.265 --> 01:03:43.299
and also more data is required to get a

01:03:43.300 --> 01:03:43.828
good fit.

01:03:43.828 --> 01:03:45.870
You have higher, lower, in other words,

01:03:45.870 --> 01:03:47.580
the MLP has lower bias and higher

01:03:47.580 --> 01:03:48.270
variance.

01:03:48.270 --> 01:03:50.840
And also you get additional error due

01:03:50.840 --> 01:03:53.330
to the challenge of optimization.

01:03:53.330 --> 01:03:56.594
So even though the theory is that you

01:03:56.594 --> 01:03:59.316
can fit that, there is a function that

01:03:59.316 --> 01:04:01.396
the MLP, the MLP can represent any

01:04:01.396 --> 01:04:01.623
function.

01:04:01.623 --> 01:04:02.960
It doesn't mean you can find it.

01:04:03.840 --> 01:04:05.400
So it's not enough that it has

01:04:05.400 --> 01:04:07.010
essentially 0 bias.

01:04:07.010 --> 01:04:09.400
If you have a really huge network, you

01:04:09.400 --> 01:04:10.770
may still not be able to fit your

01:04:10.770 --> 01:04:12.826
training data because of the deficiency

01:04:12.826 --> 01:04:14.230
of your optimization.

01:04:16.960 --> 01:04:20.370
Alright, so now let's see.

01:04:20.370 --> 01:04:21.640
I don't need to open a new one.

01:04:23.140 --> 01:04:24.310
Go back to the old one.

01:04:24.310 --> 01:04:25.990
OK, so now let's see how this works.

01:04:25.990 --> 01:04:28.370
So now I've got torch torches or

01:04:28.370 --> 01:04:29.580
framework for deep learning.

01:04:30.710 --> 01:04:33.429
And I'm specifying a model.

01:04:33.430 --> 01:04:35.609
So in torch you specify a model and

01:04:35.610 --> 01:04:38.030
I've got two models specified here.

01:04:38.850 --> 01:04:41.170
One has a linear layer that goes from

01:04:41.170 --> 01:04:43.850
Input size to hidden size.

01:04:43.850 --> 01:04:45.230
In this example it's just from 2

01:04:45.230 --> 01:04:46.850
because I'm doing 2 dimensional problem

01:04:46.850 --> 01:04:49.270
for visualization and a hidden size

01:04:49.270 --> 01:04:51.180
which I'll set when I call the model.

01:04:52.460 --> 01:04:55.225
Then I've got a Relu so do the Max of

01:04:55.225 --> 01:04:57.620
the input and zero.

01:04:57.620 --> 01:05:00.470
Then I have a linear function.

01:05:00.660 --> 01:05:03.500
That then maps into my output size,

01:05:03.500 --> 01:05:04.940
which in this case is 1 because I'm

01:05:04.940 --> 01:05:06.550
just doing classification binary

01:05:06.550 --> 01:05:09.000
classification and then I do I put a

01:05:09.000 --> 01:05:10.789
Sigmoid here to map it from zero to 1.

01:05:12.820 --> 01:05:14.800
And then I also defined A2 layer

01:05:14.800 --> 01:05:17.459
network where I pass in a two-part

01:05:17.460 --> 01:05:20.400
hidden size and I have linear layer

01:05:20.400 --> 01:05:22.290
Velu, linear layer we're fully

01:05:22.290 --> 01:05:24.310
connected layer Relu.

01:05:25.490 --> 01:05:28.180
Then my output layer and then Sigmoid.

01:05:28.880 --> 01:05:30.800
So this defines my network structure

01:05:30.800 --> 01:05:31.110
here.

01:05:32.610 --> 01:05:36.820
And then my forward, because I'm using

01:05:36.820 --> 01:05:39.540
this sequential, if I just call self

01:05:39.540 --> 01:05:42.140
doubt layers it just does like step

01:05:42.140 --> 01:05:43.239
through the layers.

01:05:43.240 --> 01:05:46.040
So it means that it goes from the input

01:05:46.040 --> 01:05:47.464
to this layer, to this layer, to this

01:05:47.464 --> 01:05:49.060
layer to list layer, blah blah blah all

01:05:49.060 --> 01:05:49.985
the way through.

01:05:49.985 --> 01:05:52.230
You can also just define these layers

01:05:52.230 --> 01:05:53.904
separately outside of sequential and

01:05:53.904 --> 01:05:56.640
then you're forward will be like X

01:05:56.640 --> 01:05:57.715
equals.

01:05:57.715 --> 01:06:00.500
You name the layers and then you say

01:06:00.500 --> 01:06:02.645
like you call them one by one and

01:06:02.645 --> 01:06:03.190
you're forward.

01:06:03.750 --> 01:06:04.320
Step here.

01:06:06.460 --> 01:06:08.290
Here's the training code.

01:06:08.980 --> 01:06:10.410
I've got my.

01:06:11.000 --> 01:06:14.280
I've got my X training and my train and

01:06:14.280 --> 01:06:14.980
some model.

01:06:16.010 --> 01:06:19.009
And I need to make them into torch

01:06:19.010 --> 01:06:21.350
tensors, like a data structure that

01:06:21.350 --> 01:06:22.270
torch can use.

01:06:22.270 --> 01:06:24.946
So I call this torch tensor X and torch

01:06:24.946 --> 01:06:27.930
tensor reshaping Y into a column vector

01:06:27.930 --> 01:06:31.000
in case it was a north comma vector.

01:06:33.020 --> 01:06:34.110
And.

01:06:34.180 --> 01:06:37.027
And then I so that creates a train set

01:06:37.027 --> 01:06:38.847
and then I call my data loader.

01:06:38.847 --> 01:06:40.380
So the data loader is just something

01:06:40.380 --> 01:06:42.440
that deals with all that shuffling and

01:06:42.440 --> 01:06:43.890
loading and all of that stuff.

01:06:43.890 --> 01:06:47.105
For you can give it like your source of

01:06:47.105 --> 01:06:48.360
data, or you can give it the data

01:06:48.360 --> 01:06:50.795
directly and it will handle the

01:06:50.795 --> 01:06:52.210
shuffling and stepping.

01:06:52.210 --> 01:06:54.530
So I give it a batch size, told it to

01:06:54.530 --> 01:06:57.026
Shuffle, told it how many CPU threads

01:06:57.026 --> 01:06:57.760
it can use.

01:06:58.670 --> 01:06:59.780
And I gave it the data.

01:07:01.670 --> 01:07:04.240
I set my loss to binary cross entropy

01:07:04.240 --> 01:07:07.515
loss, which is just the log probability

01:07:07.515 --> 01:07:09.810
loss in the case of a binary

01:07:09.810 --> 01:07:10.500
classifier.

01:07:11.950 --> 01:07:15.920
And I'm using an atom optimizer because

01:07:15.920 --> 01:07:18.680
it's a little more friendly than SGD.

01:07:18.680 --> 01:07:20.310
I'll talk about Adam in the next class.

01:07:23.140 --> 01:07:25.320
Then I'm doing epoch, so I'm stepping

01:07:25.320 --> 01:07:27.282
through my data or cycling through my

01:07:27.282 --> 01:07:28.580
data number of epochs.

01:07:30.020 --> 01:07:32.370
Then I'm stepping through my batches,

01:07:32.370 --> 01:07:34.260
enumerating my train loader.

01:07:34.260 --> 01:07:35.830
It gets each batch.

01:07:37.120 --> 01:07:39.160
I split the data into the targets and

01:07:39.160 --> 01:07:40.190
the inputs.

01:07:40.190 --> 01:07:42.350
I zero out my gradients.

01:07:43.260 --> 01:07:44.790
I.

01:07:45.780 --> 01:07:48.280
Make my prediction which is just MLP

01:07:48.280 --> 01:07:48.860
inputs.

01:07:50.710 --> 01:07:53.040
Then I call my loss function.

01:07:53.040 --> 01:07:55.030
So I compute the loss based on my

01:07:55.030 --> 01:07:56.410
outputs and my targets.

01:07:57.610 --> 01:07:59.930
Then I do Back propagation loss dot

01:07:59.930 --> 01:08:01.450
backwards, backward.

01:08:02.740 --> 01:08:04.550
And then I tell the optimizer to step

01:08:04.550 --> 01:08:06.954
so it updates the Weights based on that

01:08:06.954 --> 01:08:08.440
based on that loss.

01:08:10.180 --> 01:08:11.090
And that's it.

01:08:12.100 --> 01:08:13.600
And then keep looping through the

01:08:13.600 --> 01:08:14.620
through the batches.

01:08:14.620 --> 01:08:16.800
So code wise is pretty simple.

01:08:16.800 --> 01:08:18.360
Computing partial derivatives of

01:08:18.360 --> 01:08:20.730
complex functions is not so simple, but

01:08:20.730 --> 01:08:22.250
implementing it in torch is simple.

01:08:23.540 --> 01:08:26.270
And then I'm just like doing some

01:08:26.270 --> 01:08:28.180
record keeping to compute accuracy and

01:08:28.180 --> 01:08:30.720
losses and then record it and plot it,

01:08:30.720 --> 01:08:31.200
all right.

01:08:31.200 --> 01:08:33.340
So let's go back to those same

01:08:33.340 --> 01:08:33.820
problems.

01:08:39.330 --> 01:08:41.710
So I've got some.

01:08:43.730 --> 01:08:45.480
And then here I just have like a

01:08:45.480 --> 01:08:47.040
prediction function that I'm using for

01:08:47.040 --> 01:08:47.540
display.

01:08:50.720 --> 01:08:52.800
Alright, so here's my loss.

01:08:52.800 --> 01:08:54.570
A nice descent.

01:08:55.890 --> 01:08:59.330
And my accuracy goes up to close to 1.

01:09:00.670 --> 01:09:03.660
And this is now on this like curved

01:09:03.660 --> 01:09:04.440
problem, right?

01:09:04.440 --> 01:09:07.020
So this is one that the Perceptron

01:09:07.020 --> 01:09:09.480
couldn't fit exactly, but here I get

01:09:09.480 --> 01:09:11.410
like a pretty good fit OK.

01:09:12.240 --> 01:09:14.000
Still not perfect, but if I add more

01:09:14.000 --> 01:09:16.190
nodes or optimize further, I can

01:09:16.190 --> 01:09:17.310
probably fit these guys too.

01:09:19.890 --> 01:09:20.830
So that's cool.

01:09:22.390 --> 01:09:24.660
Just for my own sanity checks, I tried

01:09:24.660 --> 01:09:29.265
using the MLP in SKLEARN and it gives

01:09:29.265 --> 01:09:30.210
the same result.

01:09:31.580 --> 01:09:33.170
Show you similar result.

01:09:33.170 --> 01:09:35.779
Anyway, so here I SET Max Iters, I set

01:09:35.780 --> 01:09:36.930
some network size.

01:09:37.720 --> 01:09:40.270
Here's using Sklearn and did like

01:09:40.270 --> 01:09:42.890
bigger optimization so better fit.

01:09:43.840 --> 01:09:44.910
But basically the same thing.

01:09:46.780 --> 01:09:51.090
And then here I can let's try the other

01:09:51.090 --> 01:09:51.770
One South.

01:09:51.770 --> 01:09:54.800
Let's do a one layer network with 100

01:09:54.800 --> 01:09:56.140
nodes hidden.

01:10:02.710 --> 01:10:03.760
It's optimizing.

01:10:03.760 --> 01:10:04.710
It'll take a little bit.

01:10:06.550 --> 01:10:10.550
I'm just using CPU so it did decrease

01:10:10.550 --> 01:10:11.300
the loss.

01:10:11.300 --> 01:10:13.790
It got pretty good error but not

01:10:13.790 --> 01:10:14.280
perfect.

01:10:14.280 --> 01:10:15.990
It didn't like fit that little circle

01:10:15.990 --> 01:10:16.470
in there.

01:10:17.460 --> 01:10:18.580
It kind of went around.

01:10:18.580 --> 01:10:20.150
It decided to.

01:10:21.030 --> 01:10:22.950
These guys are not important enough and

01:10:22.950 --> 01:10:24.880
justice fit everything in there.

01:10:25.880 --> 01:10:27.160
If I run it with different random

01:10:27.160 --> 01:10:29.145
seeds, sometimes it will fit that even

01:10:29.145 --> 01:10:31.980
with one layer, but let's go with two

01:10:31.980 --> 01:10:32.370
layers.

01:10:32.370 --> 01:10:33.779
So now I'm going to train the two layer

01:10:33.780 --> 01:10:35.550
network, each with the hidden size of

01:10:35.550 --> 01:10:36.040
50.

01:10:37.970 --> 01:10:39.090
And try it again.

01:10:44.940 --> 01:10:45.870
Executing.

01:10:48.470 --> 01:10:50.430
All right, so now here's my loss

01:10:50.430 --> 01:10:51.120
function.

01:10:52.940 --> 01:10:54.490
Still going down, if I trained it

01:10:54.490 --> 01:10:55.790
further I'd probably decrease the loss

01:10:55.790 --> 01:10:56.245
further.

01:10:56.245 --> 01:10:58.710
My error is like my accuracy is super

01:10:58.710 --> 01:10:59.440
close to 1.

01:11:00.180 --> 01:11:02.580
And you can see that it fit both these

01:11:02.580 --> 01:11:03.940
guys pretty well, right?

01:11:03.940 --> 01:11:05.696
So with the more layers I got like a

01:11:05.696 --> 01:11:07.270
more easier to get a more expressive

01:11:07.270 --> 01:11:07.710
function.

01:11:08.350 --> 01:11:10.020
That could deal with these different

01:11:10.020 --> 01:11:11.200
parts of the feature space.

01:11:18.170 --> 01:11:20.270
I also want to show you this demo.

01:11:20.270 --> 01:11:22.710
This is like so cool I think.

01:11:24.820 --> 01:11:26.190
I realized that this was here before.

01:11:26.190 --> 01:11:27.820
I might not have even made another

01:11:27.820 --> 01:11:28.340
demo, but.

01:11:29.010 --> 01:11:32.723
So this so here you get to choose your

01:11:32.723 --> 01:11:33.126
problem.

01:11:33.126 --> 01:11:34.910
So like let's say this problem.

01:11:35.590 --> 01:11:39.340
And you choose your number of layers,

01:11:39.340 --> 01:11:41.400
and you choose the number of neurons,

01:11:41.400 --> 01:11:43.072
and you choose your learning rate, and

01:11:43.072 --> 01:11:44.320
you choose your activation function.

01:11:44.940 --> 01:11:45.850
And then you can't play.

01:11:46.430 --> 01:11:50.490
And then it optimizes and it shows you

01:11:50.490 --> 01:11:52.100
like the function that's fitting.

01:11:53.140 --> 01:11:54.600
And this.

01:11:56.140 --> 01:11:57.690
Alright, I think, is it making

01:11:57.690 --> 01:11:58.065
progress?

01:11:58.065 --> 01:12:00.210
It's getting there, it's maybe doing

01:12:00.210 --> 01:12:00.890
things.

01:12:00.890 --> 01:12:03.380
So here I'm doing a Sigmoid with just

01:12:03.380 --> 01:12:04.760
these few neurons.

01:12:05.500 --> 01:12:09.279
And these two inputs so just X1 and X2.

01:12:09.970 --> 01:12:12.170
And then it's trying to predict two

01:12:12.170 --> 01:12:12.580
values.

01:12:12.580 --> 01:12:14.100
So it took a long time.

01:12:14.100 --> 01:12:16.520
It was started in a big plateau, but it

01:12:16.520 --> 01:12:18.103
eventually got there alright.

01:12:18.103 --> 01:12:20.710
So this Sigmoid did OK this time.

01:12:22.330 --> 01:12:25.270
And let's give it a harder problem.

01:12:25.270 --> 01:12:27.980
So this guy is really tough.

01:12:29.770 --> 01:12:31.770
Now it's not going to be able to do it,

01:12:31.770 --> 01:12:32.740
I don't think.

01:12:32.740 --> 01:12:33.720
Maybe.

01:12:35.540 --> 01:12:37.860
It's going somewhere.

01:12:37.860 --> 01:12:39.450
I don't think it has enough expressive

01:12:39.450 --> 01:12:41.630
power to fit this weird spiral.

01:12:42.800 --> 01:12:44.320
But I'll let it run for a little bit to

01:12:44.320 --> 01:12:44.890
see.

01:12:44.890 --> 01:12:46.180
So it's going to try to do some

01:12:46.180 --> 01:12:46.880
approximation.

01:12:46.880 --> 01:12:48.243
The loss over here is going.

01:12:48.243 --> 01:12:49.623
It's gone down a little bit.

01:12:49.623 --> 01:12:50.815
So it did something.

01:12:50.815 --> 01:12:53.090
It got better than chance, but still

01:12:53.090 --> 01:12:53.710
not great.

01:12:53.710 --> 01:12:54.410
Let me stop it.

01:12:55.120 --> 01:12:58.015
So let's add some more layers.

01:12:58.015 --> 01:13:00.530
Let's make it super powerful.

01:13:08.430 --> 01:13:10.200
And then let's run it.

01:13:13.620 --> 01:13:15.380
And it's like not doing anything.

01:13:16.770 --> 01:13:18.540
Yeah, you can't do anything.

01:13:20.290 --> 01:13:22.140
Because it's got all these, it's pretty

01:13:22.140 --> 01:13:25.240
slow too and it's sigmoids.

01:13:25.240 --> 01:13:26.500
I mean it looks like it's doing

01:13:26.500 --> 01:13:29.385
something but it's in like 6 digit or

01:13:29.385 --> 01:13:29.650
something.

01:13:30.550 --> 01:13:33.180
Alright, so now let's try Relu.

01:13:37.430 --> 01:13:38.340
Is it gonna work?

01:13:42.800 --> 01:13:43.650
Go in.

01:13:48.120 --> 01:13:49.100
It is really slow.

01:13:51.890 --> 01:13:52.910
It's getting there.

01:14:06.670 --> 01:14:08.420
And you can see what's so cool is like

01:14:08.420 --> 01:14:08.972
each of these.

01:14:08.972 --> 01:14:10.298
You can see what they're predicting,

01:14:10.298 --> 01:14:12.080
what each of these nodes is

01:14:12.080 --> 01:14:12.860
representing.

01:14:14.230 --> 01:14:16.340
It's slow because it's calculating all

01:14:16.340 --> 01:14:17.830
this stuff and you can see the gradient

01:14:17.830 --> 01:14:18.880
visualization.

01:14:18.880 --> 01:14:20.920
See all these gradients flowing through

01:14:20.920 --> 01:14:21.170
here.

01:14:22.710 --> 01:14:25.450
Though it did it like it's pretty good,

01:14:25.450 --> 01:14:26.970
the loss is really low.

01:14:30.590 --> 01:14:32.530
I mean it's getting all that data

01:14:32.530 --> 01:14:32.900
correct.

01:14:32.900 --> 01:14:34.460
It might be overfitting a little bit or

01:14:34.460 --> 01:14:35.740
not fitting perfectly but.

01:14:36.870 --> 01:14:39.140
Still optimizing and then if I want to

01:14:39.140 --> 01:14:40.710
lower my learning rate.

01:14:41.460 --> 01:14:41.890
Let's.

01:14:44.580 --> 01:14:46.060
Then it will like optimize a little

01:14:46.060 --> 01:14:46.480
more.

01:14:46.480 --> 01:14:48.610
OK, so basically though it did it and

01:14:48.610 --> 01:14:49.720
notice that there's like a lot of

01:14:49.720 --> 01:14:50.640
strong gradients here.

01:14:51.410 --> 01:14:54.430
We're with this Sigmoid the problem.

01:14:55.430 --> 01:14:58.060
Is that it's all like low gradients.

01:14:58.060 --> 01:15:00.120
There's no strong lines here because

01:15:00.120 --> 01:15:01.760
this Sigmoid has those low Values.

01:15:03.620 --> 01:15:04.130
All right.

01:15:04.820 --> 01:15:06.770
So you guys can play with that more.

01:15:06.770 --> 01:15:07.660
It's pretty fun.

01:15:08.820 --> 01:15:12.570
And then will, I am out of time.

01:15:12.570 --> 01:15:14.500
So I'm going to talk about these things

01:15:14.500 --> 01:15:15.655
at the start of the next class.

01:15:15.655 --> 01:15:17.180
You have everything that you need now

01:15:17.180 --> 01:15:18.120
to do homework 2.

01:15:19.250 --> 01:15:22.880
And so next class I'm going to talk

01:15:22.880 --> 01:15:24.800
about deep learning.

01:15:25.980 --> 01:15:28.270
And then I've got a review after that.

01:15:28.270 --> 01:15:29.430
Thank you.

01:15:31.290 --> 01:15:32.530
I got some questions.