File size: 106,669 Bytes
2ffb90d |
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 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 |
1
00:00:03,879 --> 00:00:07,480
cool um so this time I'm going to talk
2
00:00:05,480 --> 00:00:08,880
about word representation and text
3
00:00:07,480 --> 00:00:11,480
classifiers these are kind of the
4
00:00:08,880 --> 00:00:14,080
foundations that you need to know uh in
5
00:00:11,480 --> 00:00:15,640
order to move on to the more complex
6
00:00:14,080 --> 00:00:17,920
things that we'll be talking in future
7
00:00:15,640 --> 00:00:19,640
classes uh but actually the in
8
00:00:17,920 --> 00:00:22,760
particular the word representation part
9
00:00:19,640 --> 00:00:25,439
is pretty important it's a major uh
10
00:00:22,760 --> 00:00:31,800
thing that we need to do for all NLP
11
00:00:25,439 --> 00:00:34,239
models so uh let's go into it
12
00:00:31,800 --> 00:00:38,200
so last class I talked about the bag of
13
00:00:34,239 --> 00:00:40,239
words model um and just to review this
14
00:00:38,200 --> 00:00:43,920
was a model where basically we take each
15
00:00:40,239 --> 00:00:45,520
word we represent it as a one hot Vector
16
00:00:43,920 --> 00:00:48,760
uh like
17
00:00:45,520 --> 00:00:51,120
this and we add all of these vectors
18
00:00:48,760 --> 00:00:53,160
together we multiply the resulting
19
00:00:51,120 --> 00:00:55,160
frequency vector by some weights and we
20
00:00:53,160 --> 00:00:57,239
get a score out of this and we can use
21
00:00:55,160 --> 00:00:58,559
this score for binary classification or
22
00:00:57,239 --> 00:01:00,239
if we want to do multiclass
23
00:00:58,559 --> 00:01:02,519
classification we get you know multiple
24
00:01:00,239 --> 00:01:05,720
scores for each
25
00:01:02,519 --> 00:01:08,040
class and the features F were just based
26
00:01:05,720 --> 00:01:08,920
on our word identities and the weights
27
00:01:08,040 --> 00:01:12,159
were
28
00:01:08,920 --> 00:01:14,680
learned and um if we look at what's
29
00:01:12,159 --> 00:01:17,520
missing in bag of words
30
00:01:14,680 --> 00:01:19,600
models um we talked about handling of
31
00:01:17,520 --> 00:01:23,280
conjugated or compound
32
00:01:19,600 --> 00:01:25,439
words we talked about handling of word
33
00:01:23,280 --> 00:01:27,880
similarity and we talked about handling
34
00:01:25,439 --> 00:01:30,240
of combination features and handling of
35
00:01:27,880 --> 00:01:33,280
sentence structure and so all of these
36
00:01:30,240 --> 00:01:35,000
are are tricky problems uh we saw that
37
00:01:33,280 --> 00:01:37,000
you know creating a rule-based system to
38
00:01:35,000 --> 00:01:39,000
solve these problems is non-trivial and
39
00:01:37,000 --> 00:01:41,399
at the very least would take a lot of
40
00:01:39,000 --> 00:01:44,079
time and so now I want to talk about
41
00:01:41,399 --> 00:01:47,119
some solutions to the problems in this
42
00:01:44,079 --> 00:01:49,280
class so the first the solution to the
43
00:01:47,119 --> 00:01:52,240
first problem or a solution to the first
44
00:01:49,280 --> 00:01:54,880
problem is uh subword or character based
45
00:01:52,240 --> 00:01:57,520
models and that's what I'll talk about
46
00:01:54,880 --> 00:02:00,719
first handling of word similarity this
47
00:01:57,520 --> 00:02:02,960
can be handled uh using Word edings
48
00:02:00,719 --> 00:02:05,079
and the word embeddings uh will be
49
00:02:02,960 --> 00:02:07,159
another thing we'll talk about this time
50
00:02:05,079 --> 00:02:08,879
handling of combination features uh we
51
00:02:07,159 --> 00:02:11,039
can handle through neural networks which
52
00:02:08,879 --> 00:02:14,040
we'll also talk about this time and then
53
00:02:11,039 --> 00:02:15,560
handling of sentence structure uh the
54
00:02:14,040 --> 00:02:17,720
kind of standard way of handling this
55
00:02:15,560 --> 00:02:20,120
now is through sequence-based models and
56
00:02:17,720 --> 00:02:24,879
that will be uh starting in a few
57
00:02:20,120 --> 00:02:28,080
classes so uh let's jump into
58
00:02:24,879 --> 00:02:30,000
it so subword models uh as I mentioned
59
00:02:28,080 --> 00:02:31,840
this is a really really important part
60
00:02:30,000 --> 00:02:33,360
all of the models that we're building
61
00:02:31,840 --> 00:02:35,480
nowadays including you know
62
00:02:33,360 --> 00:02:38,239
state-of-the-art language models and and
63
00:02:35,480 --> 00:02:42,200
things like this and the basic idea
64
00:02:38,239 --> 00:02:44,720
behind this is that we want to split uh
65
00:02:42,200 --> 00:02:48,040
in particular split less common words up
66
00:02:44,720 --> 00:02:50,200
into multiple subboard tokens so to give
67
00:02:48,040 --> 00:02:52,200
an example of this uh if we have
68
00:02:50,200 --> 00:02:55,040
something like the companies are
69
00:02:52,200 --> 00:02:57,000
expanding uh it might split companies
70
00:02:55,040 --> 00:03:02,120
into compan
71
00:02:57,000 --> 00:03:05,000
e and expand in like this and there are
72
00:03:02,120 --> 00:03:08,480
a few benefits of this uh the first
73
00:03:05,000 --> 00:03:10,760
benefit is that this allows you to
74
00:03:08,480 --> 00:03:13,360
parameters between word varieties or
75
00:03:10,760 --> 00:03:15,200
compound words and the other one is to
76
00:03:13,360 --> 00:03:17,400
reduce parameter size and save compute
77
00:03:15,200 --> 00:03:19,720
and meming and both of these are kind of
78
00:03:17,400 --> 00:03:23,239
like equally important things that we
79
00:03:19,720 --> 00:03:25,519
need to be uh we need to be considering
80
00:03:23,239 --> 00:03:26,440
so does anyone know how many words there
81
00:03:25,519 --> 00:03:28,680
are in
82
00:03:26,440 --> 00:03:31,680
English any
83
00:03:28,680 --> 00:03:31,680
ideas
84
00:03:36,799 --> 00:03:43,400
yeah two
85
00:03:38,599 --> 00:03:45,560
million pretty good um any other
86
00:03:43,400 --> 00:03:47,159
ideas
87
00:03:45,560 --> 00:03:50,360
yeah
88
00:03:47,159 --> 00:03:53,599
60,000 some models use 60,000 I I think
89
00:03:50,360 --> 00:03:56,200
60,000 is probably these subword models
90
00:03:53,599 --> 00:03:58,079
uh when you're talking about this so
91
00:03:56,200 --> 00:03:59,319
they can use sub models to take the 2
92
00:03:58,079 --> 00:04:03,480
million which I think is a reasonable
93
00:03:59,319 --> 00:04:07,400
guess to 6 60,000 any other
94
00:04:03,480 --> 00:04:08,840
ideas 700,000 okay pretty good um so
95
00:04:07,400 --> 00:04:11,799
this was a per question it doesn't
96
00:04:08,840 --> 00:04:14,760
really have a good answer um but two 200
97
00:04:11,799 --> 00:04:17,479
million's probably pretty good six uh
98
00:04:14,760 --> 00:04:19,160
700,000 is pretty good the reason why
99
00:04:17,479 --> 00:04:21,360
this is a trick question is because are
100
00:04:19,160 --> 00:04:24,440
company and companies different
101
00:04:21,360 --> 00:04:26,840
words uh maybe maybe not right because
102
00:04:24,440 --> 00:04:30,120
if we know the word company we can you
103
00:04:26,840 --> 00:04:32,520
know guess what the word companies means
104
00:04:30,120 --> 00:04:35,720
um what about automobile is that a
105
00:04:32,520 --> 00:04:37,400
different word well maybe if we know
106
00:04:35,720 --> 00:04:39,400
Auto and mobile we can kind of guess
107
00:04:37,400 --> 00:04:41,160
what automobile means but not really so
108
00:04:39,400 --> 00:04:43,479
maybe that's a different word there's
109
00:04:41,160 --> 00:04:45,960
all kinds of Shades of Gray there and
110
00:04:43,479 --> 00:04:48,120
also we have really frequent words that
111
00:04:45,960 --> 00:04:50,360
everybody can probably acknowledge our
112
00:04:48,120 --> 00:04:52,320
words like
113
00:04:50,360 --> 00:04:55,639
the and
114
00:04:52,320 --> 00:04:58,520
a and um maybe
115
00:04:55,639 --> 00:05:00,680
car and then we have words down here
116
00:04:58,520 --> 00:05:02,320
which are like Miss spellings or
117
00:05:00,680 --> 00:05:04,160
something like that misspellings of
118
00:05:02,320 --> 00:05:06,520
actual correct words or
119
00:05:04,160 --> 00:05:09,199
slay uh or other things like that and
120
00:05:06,520 --> 00:05:12,520
then it's questionable whether those are
121
00:05:09,199 --> 00:05:17,199
actual words or not so um there's a
122
00:05:12,520 --> 00:05:19,520
famous uh law called Zip's
123
00:05:17,199 --> 00:05:21,280
law um which probably a lot of people
124
00:05:19,520 --> 00:05:23,360
have heard of it's also the source of
125
00:05:21,280 --> 00:05:26,919
your zip
126
00:05:23,360 --> 00:05:30,160
file um which is using Zip's law to
127
00:05:26,919 --> 00:05:32,400
compress uh compress output by making
128
00:05:30,160 --> 00:05:34,880
the uh more frequent words have shorter
129
00:05:32,400 --> 00:05:37,520
bite strings and less frequent words
130
00:05:34,880 --> 00:05:38,800
have uh you know less frequent bite
131
00:05:37,520 --> 00:05:43,120
strings but basically like we're going
132
00:05:38,800 --> 00:05:45,120
to have an infinite number of words or
133
00:05:43,120 --> 00:05:46,360
at least strings that are separated by
134
00:05:45,120 --> 00:05:49,280
white space so we need to handle this
135
00:05:46,360 --> 00:05:53,199
somehow and that's what subword units
136
00:05:49,280 --> 00:05:54,560
do so um 60,000 was a good guess for the
137
00:05:53,199 --> 00:05:57,160
number of subword units you might use in
138
00:05:54,560 --> 00:06:00,759
a model and so uh by using subw units we
139
00:05:57,160 --> 00:06:04,840
can limit to about that much
140
00:06:00,759 --> 00:06:08,160
so there's a couple of common uh ways to
141
00:06:04,840 --> 00:06:10,440
create these subword units and basically
142
00:06:08,160 --> 00:06:14,560
all of them rely on the fact that you
143
00:06:10,440 --> 00:06:16,039
want more common strings to become
144
00:06:14,560 --> 00:06:19,599
subword
145
00:06:16,039 --> 00:06:22,199
units um or actually sorry I realize
146
00:06:19,599 --> 00:06:24,280
maybe before doing that I could explain
147
00:06:22,199 --> 00:06:26,360
an alternative to creating subword units
148
00:06:24,280 --> 00:06:29,639
so the alternative to creating subword
149
00:06:26,360 --> 00:06:33,560
units is to treat every character or
150
00:06:29,639 --> 00:06:36,919
maybe every bite in a string as a single
151
00:06:33,560 --> 00:06:38,560
thing that you encode in forent so in
152
00:06:36,919 --> 00:06:42,520
other words instead of trying to model
153
00:06:38,560 --> 00:06:47,919
the companies are expanding we Model T h
154
00:06:42,520 --> 00:06:50,199
e space c o m uh etc etc can anyone
155
00:06:47,919 --> 00:06:53,199
think of any downsides of
156
00:06:50,199 --> 00:06:53,199
this
157
00:06:57,039 --> 00:07:01,879
yeah yeah the set of these will be very
158
00:07:00,080 --> 00:07:05,000
will be very small but that's not
159
00:07:01,879 --> 00:07:05,000
necessarily a problem
160
00:07:08,560 --> 00:07:15,599
right yeah um and any other
161
00:07:12,599 --> 00:07:15,599
ideas
162
00:07:19,520 --> 00:07:24,360
yeah yeah the resulting sequences will
163
00:07:22,080 --> 00:07:25,520
be very long um and when you say
164
00:07:24,360 --> 00:07:27,160
difficult to use it could be difficult
165
00:07:25,520 --> 00:07:29,560
to use for a couple of reasons there's
166
00:07:27,160 --> 00:07:31,840
mainly two reasons actually any any IDE
167
00:07:29,560 --> 00:07:31,840
about
168
00:07:33,479 --> 00:07:37,800
this any
169
00:07:46,280 --> 00:07:50,599
yeah yeah that's a little bit of a
170
00:07:49,000 --> 00:07:52,319
separate problem than the character
171
00:07:50,599 --> 00:07:53,919
based model so let me get back to that
172
00:07:52,319 --> 00:07:56,400
but uh let let's finish the discussion
173
00:07:53,919 --> 00:07:58,360
of the character based models so if it's
174
00:07:56,400 --> 00:08:00,120
really if it's really long maybe a
175
00:07:58,360 --> 00:08:01,879
simple thing like uh let's say you have
176
00:08:00,120 --> 00:08:06,560
a big neural network and it's processing
177
00:08:01,879 --> 00:08:06,560
a really long sequence any ideas what
178
00:08:06,919 --> 00:08:10,879
happens basically you run out of memory
179
00:08:09,280 --> 00:08:13,440
or it takes a really long time right so
180
00:08:10,879 --> 00:08:16,840
you have computational problems another
181
00:08:13,440 --> 00:08:18,479
reason why is um think of what a bag of
182
00:08:16,840 --> 00:08:21,400
words model would look like if it was a
183
00:08:18,479 --> 00:08:21,400
bag of characters
184
00:08:21,800 --> 00:08:25,919
model it wouldn't be very informative
185
00:08:24,199 --> 00:08:27,599
about whether like a sentence is
186
00:08:25,919 --> 00:08:30,919
positive sentiment or negative sentiment
187
00:08:27,599 --> 00:08:32,959
right because instead of having uh go o
188
00:08:30,919 --> 00:08:35,039
you would have uh instead of having good
189
00:08:32,959 --> 00:08:36,360
you would have go o and that doesn't
190
00:08:35,039 --> 00:08:38,560
really directly tell you whether it's
191
00:08:36,360 --> 00:08:41,719
positive sentiment or not so those are
192
00:08:38,560 --> 00:08:43,680
basically the two problems um compute
193
00:08:41,719 --> 00:08:45,320
and lack of expressiveness in the
194
00:08:43,680 --> 00:08:50,720
underlying representations so you need
195
00:08:45,320 --> 00:08:52,080
to handle both of those yes so if we uh
196
00:08:50,720 --> 00:08:54,480
move from
197
00:08:52,080 --> 00:08:56,440
character better expressiveness and we
198
00:08:54,480 --> 00:08:58,920
assume that if we just get the bigger
199
00:08:56,440 --> 00:09:00,120
and bigger paragraphs we'll get even
200
00:08:58,920 --> 00:09:02,760
better
201
00:09:00,120 --> 00:09:05,120
yeah so a very good question I'll repeat
202
00:09:02,760 --> 00:09:06,560
it um and actually this also goes back
203
00:09:05,120 --> 00:09:08,040
to the other question you asked about
204
00:09:06,560 --> 00:09:09,519
words that look the same but are
205
00:09:08,040 --> 00:09:12,160
pronounced differently or have different
206
00:09:09,519 --> 00:09:14,360
meanings and so like let's say we just
207
00:09:12,160 --> 00:09:15,920
remembered this whole sentence right the
208
00:09:14,360 --> 00:09:18,279
companies are
209
00:09:15,920 --> 00:09:21,600
expanding um and that was like a single
210
00:09:18,279 --> 00:09:22,680
embedding and we somehow embedded it the
211
00:09:21,600 --> 00:09:25,720
problem would be we're never going to
212
00:09:22,680 --> 00:09:27,120
see that sentence again um or if we go
213
00:09:25,720 --> 00:09:29,480
to longer sentences we're never going to
214
00:09:27,120 --> 00:09:31,839
see the longer sentences again so it
215
00:09:29,480 --> 00:09:34,320
becomes too sparse so there's kind of a
216
00:09:31,839 --> 00:09:37,240
sweet spot between
217
00:09:34,320 --> 00:09:40,279
like long enough to be expressive and
218
00:09:37,240 --> 00:09:42,480
short enough to occur many times so that
219
00:09:40,279 --> 00:09:43,959
you can learn appropriately and that's
220
00:09:42,480 --> 00:09:47,120
kind of what subword models are aiming
221
00:09:43,959 --> 00:09:48,360
for and if you get longer subwords then
222
00:09:47,120 --> 00:09:50,200
you'll get things that are more
223
00:09:48,360 --> 00:09:52,959
expressive but more sparse in shorter
224
00:09:50,200 --> 00:09:55,440
subwords you'll get things that are like
225
00:09:52,959 --> 00:09:57,279
uh less expressive but less spice so you
226
00:09:55,440 --> 00:09:59,120
need to balance between them and then
227
00:09:57,279 --> 00:10:00,600
once we get into sequence modeling they
228
00:09:59,120 --> 00:10:02,600
start being able to model like which
229
00:10:00,600 --> 00:10:04,120
words are next to each other uh which
230
00:10:02,600 --> 00:10:06,040
tokens are next to each other and stuff
231
00:10:04,120 --> 00:10:07,800
like that so even if they are less
232
00:10:06,040 --> 00:10:11,279
expressive the combination between them
233
00:10:07,800 --> 00:10:12,600
can be expressive so um yeah that's kind
234
00:10:11,279 --> 00:10:13,440
of a preview of what we're going to be
235
00:10:12,600 --> 00:10:17,320
doing
236
00:10:13,440 --> 00:10:19,279
next okay so um let's assume that we
237
00:10:17,320 --> 00:10:21,320
want to have some subwords that are
238
00:10:19,279 --> 00:10:23,000
longer than characters but shorter than
239
00:10:21,320 --> 00:10:26,240
tokens how do we make these in a
240
00:10:23,000 --> 00:10:28,680
consistent way there's two major ways of
241
00:10:26,240 --> 00:10:31,480
doing this uh the first one is bite pair
242
00:10:28,680 --> 00:10:32,839
encoding and this is uh very very simple
243
00:10:31,480 --> 00:10:35,839
in fact it's so
244
00:10:32,839 --> 00:10:35,839
simple
245
00:10:36,600 --> 00:10:40,839
that we can implement
246
00:10:41,839 --> 00:10:47,240
it in this notebook here which you can
247
00:10:44,600 --> 00:10:51,720
click through to on the
248
00:10:47,240 --> 00:10:55,440
slides and it's uh
249
00:10:51,720 --> 00:10:58,040
about 10 lines of code um and so
250
00:10:55,440 --> 00:11:01,040
basically what B pair encoding
251
00:10:58,040 --> 00:11:01,040
does
252
00:11:04,600 --> 00:11:09,560
is that you start out with um all of the
253
00:11:07,000 --> 00:11:14,360
vocabulary that you want to process
254
00:11:09,560 --> 00:11:17,560
where each vocabulary item is split into
255
00:11:14,360 --> 00:11:21,240
uh the characters and an end of word
256
00:11:17,560 --> 00:11:23,360
symbol and you have a corresponding
257
00:11:21,240 --> 00:11:27,519
frequency of
258
00:11:23,360 --> 00:11:31,120
this you then uh get statistics about
259
00:11:27,519 --> 00:11:33,279
the most common pairs of tokens that
260
00:11:31,120 --> 00:11:34,880
occur next to each other and so here the
261
00:11:33,279 --> 00:11:38,240
most common pairs of tokens that occur
262
00:11:34,880 --> 00:11:41,920
next to each other are e s because it
263
00:11:38,240 --> 00:11:46,560
occurs nine times because it occurs in
264
00:11:41,920 --> 00:11:48,279
newest and wildest also s and t w
265
00:11:46,560 --> 00:11:51,440
because those occur there too and then
266
00:11:48,279 --> 00:11:53,519
you have we and other things like that
267
00:11:51,440 --> 00:11:56,000
so out of all the most frequent ones you
268
00:11:53,519 --> 00:11:59,920
just merge them together and that gives
269
00:11:56,000 --> 00:12:02,720
you uh new s new
270
00:11:59,920 --> 00:12:05,200
EST and wide
271
00:12:02,720 --> 00:12:09,360
EST and then you do the same thing this
272
00:12:05,200 --> 00:12:12,519
time now you get EST so now you get this
273
00:12:09,360 --> 00:12:14,279
uh suffix EST and that looks pretty
274
00:12:12,519 --> 00:12:16,399
reasonable for English right you know
275
00:12:14,279 --> 00:12:19,040
EST is a common suffix that we use it
276
00:12:16,399 --> 00:12:22,399
seems like it should be a single token
277
00:12:19,040 --> 00:12:25,880
and um so you just do this over and over
278
00:12:22,399 --> 00:12:29,279
again if you want a vocabulary of 60,000
279
00:12:25,880 --> 00:12:31,120
for example you would do um 60,000 minus
280
00:12:29,279 --> 00:12:33,079
number of characters merge operations
281
00:12:31,120 --> 00:12:37,160
and eventually you would get a B of
282
00:12:33,079 --> 00:12:41,920
60,000 um and yeah very very simple
283
00:12:37,160 --> 00:12:41,920
method to do this um any questions about
284
00:12:43,160 --> 00:12:46,160
that
285
00:12:57,839 --> 00:13:00,839
yeah
286
00:13:15,600 --> 00:13:20,959
yeah so uh just to repeat the the
287
00:13:18,040 --> 00:13:23,560
comment uh this seems like a greedy
288
00:13:20,959 --> 00:13:25,320
version of Huffman encoding which is a
289
00:13:23,560 --> 00:13:28,839
you know similar to what you're using in
290
00:13:25,320 --> 00:13:32,000
your zip file a way to shorten things by
291
00:13:28,839 --> 00:13:36,560
getting longer uh more frequent things
292
00:13:32,000 --> 00:13:39,120
being inced as a single token um I think
293
00:13:36,560 --> 00:13:40,760
B pair encoding did originally start
294
00:13:39,120 --> 00:13:43,720
like that that's part of the reason why
295
00:13:40,760 --> 00:13:45,760
the encoding uh thing is here I think it
296
00:13:43,720 --> 00:13:47,360
originally started there I haven't read
297
00:13:45,760 --> 00:13:49,360
really deeply into this but I can talk
298
00:13:47,360 --> 00:13:53,240
more about how the next one corresponds
299
00:13:49,360 --> 00:13:54,440
to information Theory and Tuesday I'm
300
00:13:53,240 --> 00:13:55,720
going to talk even more about how
301
00:13:54,440 --> 00:13:57,720
language models correspond to
302
00:13:55,720 --> 00:14:00,040
information theories so we can uh we can
303
00:13:57,720 --> 00:14:04,519
discuss maybe in more detail
304
00:14:00,040 --> 00:14:07,639
to um so the the alternative option is
305
00:14:04,519 --> 00:14:10,000
to use unigram models and unigram models
306
00:14:07,639 --> 00:14:12,240
are the simplest type of language model
307
00:14:10,000 --> 00:14:15,079
I'm going to talk more in detail about
308
00:14:12,240 --> 00:14:18,279
them next time but basically uh the way
309
00:14:15,079 --> 00:14:20,759
it works is you create a model that
310
00:14:18,279 --> 00:14:23,600
generates all word uh words in the
311
00:14:20,759 --> 00:14:26,199
sequence independently sorry I thought I
312
00:14:23,600 --> 00:14:26,199
had a
313
00:14:26,320 --> 00:14:31,800
um I thought I had an equation but
314
00:14:28,800 --> 00:14:31,800
basically the
315
00:14:32,240 --> 00:14:35,759
equation looks
316
00:14:38,079 --> 00:14:41,079
like
317
00:14:47,720 --> 00:14:52,120
this so you say the probability of the
318
00:14:50,360 --> 00:14:53,440
sequence is the product of the
319
00:14:52,120 --> 00:14:54,279
probabilities of each of the words in
320
00:14:53,440 --> 00:14:55,959
the
321
00:14:54,279 --> 00:15:00,079
sequence
322
00:14:55,959 --> 00:15:04,079
and uh then you try to pick a vocabulary
323
00:15:00,079 --> 00:15:06,839
that maximizes the probability of the
324
00:15:04,079 --> 00:15:09,320
Corpus given a fixed vocabulary size so
325
00:15:06,839 --> 00:15:10,320
you try to say okay you get a vocabulary
326
00:15:09,320 --> 00:15:14,440
size of
327
00:15:10,320 --> 00:15:16,920
60,000 how do you um how do you pick the
328
00:15:14,440 --> 00:15:19,680
best 60,000 vocabulary to maximize the
329
00:15:16,920 --> 00:15:22,440
probability of the the Corpus and that
330
00:15:19,680 --> 00:15:25,959
will result in something very similar uh
331
00:15:22,440 --> 00:15:27,920
it will also try to give longer uh
332
00:15:25,959 --> 00:15:29,880
vocabulary uh sorry more common
333
00:15:27,920 --> 00:15:32,240
vocabulary long sequences because that
334
00:15:29,880 --> 00:15:35,560
allows you to to maximize this
335
00:15:32,240 --> 00:15:36,959
objective um the optimization for this
336
00:15:35,560 --> 00:15:40,040
is performed using something called the
337
00:15:36,959 --> 00:15:44,440
EM algorithm where basically you uh
338
00:15:40,040 --> 00:15:48,560
predict the uh the probability of each
339
00:15:44,440 --> 00:15:51,600
token showing up and uh then select the
340
00:15:48,560 --> 00:15:53,279
most common tokens and then trim off the
341
00:15:51,600 --> 00:15:54,759
ones that are less common and then just
342
00:15:53,279 --> 00:15:58,120
do this over and over again until you
343
00:15:54,759 --> 00:15:59,839
drop down to the 60,000 token lat so the
344
00:15:58,120 --> 00:16:02,040
details for this are not important for
345
00:15:59,839 --> 00:16:04,160
most people in this class uh because
346
00:16:02,040 --> 00:16:07,480
you're going to just be using a toolkit
347
00:16:04,160 --> 00:16:08,880
that implements this for you um but if
348
00:16:07,480 --> 00:16:10,759
you're interested in this I'm happy to
349
00:16:08,880 --> 00:16:14,199
talk to you about it
350
00:16:10,759 --> 00:16:14,199
yeah is there
351
00:16:14,680 --> 00:16:18,959
problem Oh in unigram models there's a
352
00:16:17,199 --> 00:16:20,959
huge problem with assuming Independence
353
00:16:18,959 --> 00:16:22,720
in language models because then you
354
00:16:20,959 --> 00:16:25,120
could rearrange the order of words in
355
00:16:22,720 --> 00:16:26,600
sentences um that that's something we're
356
00:16:25,120 --> 00:16:27,519
going to talk about in language model
357
00:16:26,600 --> 00:16:30,560
next
358
00:16:27,519 --> 00:16:32,839
time but the the good thing about this
359
00:16:30,560 --> 00:16:34,519
is the EM algorithm requires dynamic
360
00:16:32,839 --> 00:16:36,079
programming in this case and you can't
361
00:16:34,519 --> 00:16:37,800
easily do dynamic programming if you
362
00:16:36,079 --> 00:16:40,160
don't make that
363
00:16:37,800 --> 00:16:41,880
assumptions um and then finally after
364
00:16:40,160 --> 00:16:43,560
you've picked your vocabulary and you've
365
00:16:41,880 --> 00:16:45,720
assigned a probability to each word in
366
00:16:43,560 --> 00:16:47,800
the vocabulary you then find a
367
00:16:45,720 --> 00:16:49,639
segmentation of the input that maximizes
368
00:16:47,800 --> 00:16:52,600
the unigram
369
00:16:49,639 --> 00:16:54,880
probabilities um so this is basically
370
00:16:52,600 --> 00:16:56,519
the idea of what's going on here um I'm
371
00:16:54,880 --> 00:16:58,120
not going to go into a lot of detail
372
00:16:56,519 --> 00:17:00,560
about this because most people are just
373
00:16:58,120 --> 00:17:02,279
going to be users of this algorithm so
374
00:17:00,560 --> 00:17:06,240
it's not super super
375
00:17:02,279 --> 00:17:09,400
important um the one important thing
376
00:17:06,240 --> 00:17:11,240
about this is that there's a library
377
00:17:09,400 --> 00:17:15,520
called sentence piece that's used very
378
00:17:11,240 --> 00:17:19,199
widely in order to build these um in
379
00:17:15,520 --> 00:17:22,000
order to build these subword units and
380
00:17:19,199 --> 00:17:23,720
uh basically what you do is you run the
381
00:17:22,000 --> 00:17:27,600
sentence piece
382
00:17:23,720 --> 00:17:30,200
train uh model or sorry uh program and
383
00:17:27,600 --> 00:17:32,640
that gives you uh you select your vocab
384
00:17:30,200 --> 00:17:34,240
size uh this also this character
385
00:17:32,640 --> 00:17:36,120
coverage is basically how well do you
386
00:17:34,240 --> 00:17:39,760
need to cover all of the characters in
387
00:17:36,120 --> 00:17:41,840
your vocabulary or in your input text um
388
00:17:39,760 --> 00:17:45,240
what model type do you use and then you
389
00:17:41,840 --> 00:17:48,640
run this uh sentence piece en code file
390
00:17:45,240 --> 00:17:51,039
uh to uh encode the output and split the
391
00:17:48,640 --> 00:17:54,799
output and there's also python bindings
392
00:17:51,039 --> 00:17:56,240
available for this and by the one thing
393
00:17:54,799 --> 00:17:57,919
that you should know is by default it
394
00:17:56,240 --> 00:18:00,600
uses the unigram model but it also
395
00:17:57,919 --> 00:18:01,960
supports EP in my experience it doesn't
396
00:18:00,600 --> 00:18:05,159
make a huge difference about which one
397
00:18:01,960 --> 00:18:07,640
you use the bigger thing is how um how
398
00:18:05,159 --> 00:18:10,159
big is your vocabulary size and if your
399
00:18:07,640 --> 00:18:11,880
vocabulary size is smaller then things
400
00:18:10,159 --> 00:18:13,760
will be more efficient but less
401
00:18:11,880 --> 00:18:17,480
expressive if your vocabulary size is
402
00:18:13,760 --> 00:18:21,280
bigger things will be um will
403
00:18:17,480 --> 00:18:23,240
be more expressive but less efficient
404
00:18:21,280 --> 00:18:25,360
and A good rule of thumb is like
405
00:18:23,240 --> 00:18:26,960
something like 60,000 to 80,000 is
406
00:18:25,360 --> 00:18:29,120
pretty reasonable if you're only doing
407
00:18:26,960 --> 00:18:31,320
English if you're spreading out to
408
00:18:29,120 --> 00:18:32,600
things that do other languages um which
409
00:18:31,320 --> 00:18:35,960
I'll talk about in a second then you
410
00:18:32,600 --> 00:18:38,720
need a much bigger B regular
411
00:18:35,960 --> 00:18:40,559
say so there's two considerations here
412
00:18:38,720 --> 00:18:42,440
two important considerations when using
413
00:18:40,559 --> 00:18:46,320
these models uh the first is
414
00:18:42,440 --> 00:18:48,760
multilinguality as I said so when you're
415
00:18:46,320 --> 00:18:50,760
using um subword
416
00:18:48,760 --> 00:18:54,710
models they're hard to use
417
00:18:50,760 --> 00:18:55,840
multilingually because as I said before
418
00:18:54,710 --> 00:18:59,799
[Music]
419
00:18:55,840 --> 00:19:03,799
they give longer strings to more
420
00:18:59,799 --> 00:19:06,520
frequent strings basically so then
421
00:19:03,799 --> 00:19:09,559
imagine what happens if 50% of your
422
00:19:06,520 --> 00:19:11,919
Corpus is English another 30% of your
423
00:19:09,559 --> 00:19:15,400
Corpus is
424
00:19:11,919 --> 00:19:17,200
other languages written in Latin script
425
00:19:15,400 --> 00:19:21,720
10% is
426
00:19:17,200 --> 00:19:25,480
Chinese uh 5% is cerlic script languages
427
00:19:21,720 --> 00:19:27,240
four 4% is 3% is Japanese and then you
428
00:19:25,480 --> 00:19:31,080
have like
429
00:19:27,240 --> 00:19:33,320
0.01% written in like burmes or
430
00:19:31,080 --> 00:19:35,520
something like that suddenly burmes just
431
00:19:33,320 --> 00:19:37,400
gets chunked up really really tiny
432
00:19:35,520 --> 00:19:38,360
really long sequences and it doesn't
433
00:19:37,400 --> 00:19:45,559
work as
434
00:19:38,360 --> 00:19:45,559
well um so one way that people fix this
435
00:19:45,919 --> 00:19:50,520
um and actually there's a really nice uh
436
00:19:48,760 --> 00:19:52,600
blog post about this called exploring
437
00:19:50,520 --> 00:19:53,760
B's vocabulary which I referenced here
438
00:19:52,600 --> 00:19:58,039
if you're interested in learning more
439
00:19:53,760 --> 00:20:02,960
about that um but one way that people
440
00:19:58,039 --> 00:20:05,240
were around this is if your
441
00:20:02,960 --> 00:20:07,960
actual uh data
442
00:20:05,240 --> 00:20:11,559
distribution looks like this like
443
00:20:07,960 --> 00:20:11,559
English uh
444
00:20:17,039 --> 00:20:23,159
Ty we actually sorry I took out the
445
00:20:19,280 --> 00:20:23,159
Indian languages in my example
446
00:20:24,960 --> 00:20:30,159
apologies
447
00:20:27,159 --> 00:20:30,159
so
448
00:20:30,400 --> 00:20:35,919
um what you do is you essentially create
449
00:20:33,640 --> 00:20:40,000
a different distribution that like
450
00:20:35,919 --> 00:20:43,559
downweights English a little bit and up
451
00:20:40,000 --> 00:20:47,000
weights up weights all of the other
452
00:20:43,559 --> 00:20:49,480
languages um so that you get more of
453
00:20:47,000 --> 00:20:53,159
other languages when creating so this is
454
00:20:49,480 --> 00:20:53,159
a common work around that you can do for
455
00:20:54,200 --> 00:20:59,960
this um the
456
00:20:56,799 --> 00:21:03,000
second problem with these is
457
00:20:59,960 --> 00:21:08,000
arbitrariness so as you saw in my
458
00:21:03,000 --> 00:21:11,240
example with bpe e s s and t and of
459
00:21:08,000 --> 00:21:13,520
board symbol all have the same probabil
460
00:21:11,240 --> 00:21:16,960
or have the same frequency right so if
461
00:21:13,520 --> 00:21:21,520
we get to that point do we segment es or
462
00:21:16,960 --> 00:21:25,039
do we seg uh EST or do we segment e
463
00:21:21,520 --> 00:21:26,559
s and so this is also a problem and it
464
00:21:25,039 --> 00:21:29,000
actually can affect your results
465
00:21:26,559 --> 00:21:30,480
especially if you like don't have a
466
00:21:29,000 --> 00:21:31,760
really strong vocabulary for the
467
00:21:30,480 --> 00:21:33,279
language you're working in or you're
468
00:21:31,760 --> 00:21:37,200
working in a new
469
00:21:33,279 --> 00:21:40,159
domain and so there's a few workarounds
470
00:21:37,200 --> 00:21:41,520
for this uh one workaround for this is
471
00:21:40,159 --> 00:21:44,000
uh called subword
472
00:21:41,520 --> 00:21:46,279
regularization and the way it works is
473
00:21:44,000 --> 00:21:49,400
instead
474
00:21:46,279 --> 00:21:51,640
of just having a single segmentation and
475
00:21:49,400 --> 00:21:54,679
getting the kind of
476
00:21:51,640 --> 00:21:56,200
maximally probable segmentation or the
477
00:21:54,679 --> 00:21:58,480
one the greedy one that you get out of
478
00:21:56,200 --> 00:22:01,360
BP instead you sample different
479
00:21:58,480 --> 00:22:03,000
segmentations in training time and use
480
00:22:01,360 --> 00:22:05,720
the different segmentations and that
481
00:22:03,000 --> 00:22:09,200
makes your model more robust to this
482
00:22:05,720 --> 00:22:10,840
kind of variation and that's also
483
00:22:09,200 --> 00:22:15,679
actually the reason why sentence piece
484
00:22:10,840 --> 00:22:17,919
was released was through this um subword
485
00:22:15,679 --> 00:22:19,559
regularization paper so that's also
486
00:22:17,919 --> 00:22:22,720
implemented in sentence piece if that's
487
00:22:19,559 --> 00:22:22,720
something you're interested in
488
00:22:24,919 --> 00:22:32,520
trying cool um are there any questions
489
00:22:28,480 --> 00:22:32,520
or discussions about this
490
00:22:53,279 --> 00:22:56,279
yeah
491
00:22:56,960 --> 00:22:59,960
already
492
00:23:06,799 --> 00:23:11,080
yeah so this is a good question um just
493
00:23:08,960 --> 00:23:12,760
to repeat the question it was like let's
494
00:23:11,080 --> 00:23:16,080
say we have a big
495
00:23:12,760 --> 00:23:19,640
multilingual um subword
496
00:23:16,080 --> 00:23:23,440
model and we want to add a new language
497
00:23:19,640 --> 00:23:26,240
in some way uh how can we reuse the
498
00:23:23,440 --> 00:23:28,880
existing model but add a new
499
00:23:26,240 --> 00:23:31,080
language it's a good question if you're
500
00:23:28,880 --> 00:23:33,679
only using it for subord
501
00:23:31,080 --> 00:23:36,320
segmentation um one one nice thing about
502
00:23:33,679 --> 00:23:36,320
the unigram
503
00:23:36,400 --> 00:23:41,799
model here is this is kind of a
504
00:23:38,880 --> 00:23:43,679
probabilistic model so it's very easy to
505
00:23:41,799 --> 00:23:46,360
do the kind of standard things that we
506
00:23:43,679 --> 00:23:48,240
do with probabilistic models which is
507
00:23:46,360 --> 00:23:50,559
like let's say we had an
508
00:23:48,240 --> 00:23:53,919
old uh an
509
00:23:50,559 --> 00:23:56,880
old vocabulary for
510
00:23:53,919 --> 00:23:59,880
this um we could just
511
00:23:56,880 --> 00:23:59,880
interpolate
512
00:24:07,159 --> 00:24:12,320
um we could interpolate like this and
513
00:24:09,559 --> 00:24:13,840
just you know uh combine the
514
00:24:12,320 --> 00:24:17,080
probabilities of the two and then use
515
00:24:13,840 --> 00:24:19,520
that combine probability in order to
516
00:24:17,080 --> 00:24:21,320
segment the new language um things like
517
00:24:19,520 --> 00:24:24,159
this have been uh done before but I
518
00:24:21,320 --> 00:24:26,159
don't remember the exact preferences uh
519
00:24:24,159 --> 00:24:30,440
for them but that that's what I would do
520
00:24:26,159 --> 00:24:31,960
here another interesting thing is um
521
00:24:30,440 --> 00:24:35,399
this might be getting a little ahead of
522
00:24:31,960 --> 00:24:35,399
myself but there's
523
00:24:48,559 --> 00:24:58,279
a there's a paper that talks about um
524
00:24:55,360 --> 00:25:00,159
how you can take things that or trained
525
00:24:58,279 --> 00:25:03,360
with another
526
00:25:00,159 --> 00:25:05,480
vocabulary and basically the idea is um
527
00:25:03,360 --> 00:25:09,320
you pre-train on whatever languages you
528
00:25:05,480 --> 00:25:10,679
have and then uh you learn embeddings in
529
00:25:09,320 --> 00:25:11,880
the new language you freeze the body of
530
00:25:10,679 --> 00:25:14,360
the model and learn embeddings in the
531
00:25:11,880 --> 00:25:15,880
new language so that's another uh method
532
00:25:14,360 --> 00:25:19,080
that's used it's called on the cross
533
00:25:15,880 --> 00:25:19,080
lingual printability
534
00:25:21,840 --> 00:25:26,159
representations and I'll probably talk
535
00:25:23,840 --> 00:25:28,480
about that in the last class of this uh
536
00:25:26,159 --> 00:25:30,720
thing so you can remember that
537
00:25:28,480 --> 00:25:33,720
then cool any other
538
00:25:30,720 --> 00:25:33,720
questions
539
00:25:38,480 --> 00:25:42,640
yeah is bag of words a first step to
540
00:25:41,039 --> 00:25:46,640
process your data if you want to do
541
00:25:42,640 --> 00:25:49,919
Generation Um do you mean like
542
00:25:46,640 --> 00:25:52,440
uh a word based model or a subword based
543
00:25:49,919 --> 00:25:52,440
model
544
00:25:56,679 --> 00:26:00,480
or like is
545
00:26:02,360 --> 00:26:08,000
this so the subword segmentation is the
546
00:26:05,919 --> 00:26:10,640
first step of creating just about any
547
00:26:08,000 --> 00:26:13,080
model nowadays like every model every
548
00:26:10,640 --> 00:26:16,600
model uses this and they usually use
549
00:26:13,080 --> 00:26:21,520
this either to segment characters or
550
00:26:16,600 --> 00:26:23,559
byes um characters are like Unicode code
551
00:26:21,520 --> 00:26:25,799
points so they actually correspond to an
552
00:26:23,559 --> 00:26:28,279
actual visual character and then bites
553
00:26:25,799 --> 00:26:31,120
are many unicode characters are like
554
00:26:28,279 --> 00:26:35,000
three by like a Chinese character is
555
00:26:31,120 --> 00:26:37,159
three byes if I remember correctly so um
556
00:26:35,000 --> 00:26:38,640
the bbased segmentation is nice because
557
00:26:37,159 --> 00:26:41,240
you don't even need to worry about unic
558
00:26:38,640 --> 00:26:43,880
code you can just do the like you can
559
00:26:41,240 --> 00:26:45,640
just segment the pile like literally as
560
00:26:43,880 --> 00:26:49,440
is and so a lot of people do it that way
561
00:26:45,640 --> 00:26:53,279
too uh llama as far as I know is
562
00:26:49,440 --> 00:26:55,720
bites I believe GPT is also bites um but
563
00:26:53,279 --> 00:26:58,799
pre previous to like three or four years
564
00:26:55,720 --> 00:27:02,799
ago people used SCS I
565
00:26:58,799 --> 00:27:05,000
cool um okay so this is really really
566
00:27:02,799 --> 00:27:05,919
important it's not like super complex
567
00:27:05,000 --> 00:27:09,760
and
568
00:27:05,919 --> 00:27:13,039
practically uh you will just maybe maybe
569
00:27:09,760 --> 00:27:15,840
train or maybe just use a tokenizer um
570
00:27:13,039 --> 00:27:18,559
but uh that that's an important thing to
571
00:27:15,840 --> 00:27:20,760
me cool uh next I'd like to move on to
572
00:27:18,559 --> 00:27:24,399
continuous word eddings
573
00:27:20,760 --> 00:27:26,720
so the basic idea is that previously we
574
00:27:24,399 --> 00:27:28,240
represented words with a sparse Vector
575
00:27:26,720 --> 00:27:30,120
uh with a single one
576
00:27:28,240 --> 00:27:31,960
also known as one poot Vector so it
577
00:27:30,120 --> 00:27:35,720
looked a little bit like
578
00:27:31,960 --> 00:27:37,640
this and instead what continuous word
579
00:27:35,720 --> 00:27:39,640
embeddings do is they look up a dense
580
00:27:37,640 --> 00:27:42,320
vector and so you get a dense
581
00:27:39,640 --> 00:27:45,760
representation where the entire Vector
582
00:27:42,320 --> 00:27:45,760
has continuous values in
583
00:27:46,000 --> 00:27:51,919
it and I talked about a bag of words
584
00:27:49,200 --> 00:27:54,320
model but we could also create a
585
00:27:51,919 --> 00:27:58,360
continuous bag of words model and the
586
00:27:54,320 --> 00:28:01,159
way this works is you look up the
587
00:27:58,360 --> 00:28:03,720
values of each Vector the embeddings of
588
00:28:01,159 --> 00:28:06,320
each Vector this gives you an embedding
589
00:28:03,720 --> 00:28:08,440
Vector for the entire sequence and then
590
00:28:06,320 --> 00:28:15,120
you multiply this by a weight
591
00:28:08,440 --> 00:28:17,559
Matrix uh where the so this is column so
592
00:28:15,120 --> 00:28:19,960
the rows of the weight Matrix uh
593
00:28:17,559 --> 00:28:22,919
correspond to to the size of this
594
00:28:19,960 --> 00:28:24,760
continuous embedding and The Columns of
595
00:28:22,919 --> 00:28:28,320
the weight Matrix would correspond to
596
00:28:24,760 --> 00:28:30,919
the uh overall um
597
00:28:28,320 --> 00:28:32,559
to the overall uh number of labels that
598
00:28:30,919 --> 00:28:36,919
you would have here and then that would
599
00:28:32,559 --> 00:28:40,120
give you sces and so this uh basically
600
00:28:36,919 --> 00:28:41,679
what this is saying is each Vector now
601
00:28:40,120 --> 00:28:43,440
instead of having a single thing that
602
00:28:41,679 --> 00:28:46,799
represents which vocabulary item you're
603
00:28:43,440 --> 00:28:48,679
looking at uh you would kind of hope
604
00:28:46,799 --> 00:28:52,120
that you would get vectors where words
605
00:28:48,679 --> 00:28:54,919
that are similar uh by some mention of
606
00:28:52,120 --> 00:28:57,760
by some concept of similar like syntatic
607
00:28:54,919 --> 00:28:59,679
uh syntax semantics whether they're in
608
00:28:57,760 --> 00:29:03,120
the same language or not are close in
609
00:28:59,679 --> 00:29:06,679
the vector space and each Vector element
610
00:29:03,120 --> 00:29:09,399
is a feature uh so for example each
611
00:29:06,679 --> 00:29:11,519
Vector element corresponds to is this an
612
00:29:09,399 --> 00:29:14,960
animate object or is this a positive
613
00:29:11,519 --> 00:29:17,399
word or other Vector other things like
614
00:29:14,960 --> 00:29:19,399
that so just to give an example here
615
00:29:17,399 --> 00:29:21,760
this is totally made up I just made it
616
00:29:19,399 --> 00:29:24,360
in keynote so it's not natural Vector
617
00:29:21,760 --> 00:29:26,279
space but to Ill illustrate the concept
618
00:29:24,360 --> 00:29:27,960
I showed here what if we had a
619
00:29:26,279 --> 00:29:30,240
two-dimensional vector
620
00:29:27,960 --> 00:29:33,399
space where the two-dimensional Vector
621
00:29:30,240 --> 00:29:36,240
space the xais here is corresponding to
622
00:29:33,399 --> 00:29:38,679
whether it's animate or not and the the
623
00:29:36,240 --> 00:29:41,480
Y AIS here is corresponding to whether
624
00:29:38,679 --> 00:29:44,080
it's like positive sentiment or not and
625
00:29:41,480 --> 00:29:46,399
so this is kind of like our ideal uh
626
00:29:44,080 --> 00:29:49,799
goal
627
00:29:46,399 --> 00:29:52,279
here um so why would we want to do this
628
00:29:49,799 --> 00:29:52,279
yeah sorry
629
00:29:56,320 --> 00:30:03,399
guys what do the like in the one it's
630
00:30:00,919 --> 00:30:06,399
one
631
00:30:03,399 --> 00:30:06,399
yep
632
00:30:07,200 --> 00:30:12,519
like so what would the four entries do
633
00:30:09,880 --> 00:30:14,799
here the four entries here are learned
634
00:30:12,519 --> 00:30:17,039
so they are um they're learned just
635
00:30:14,799 --> 00:30:18,519
together with the model um and I'm going
636
00:30:17,039 --> 00:30:22,120
to talk about exactly how we learn them
637
00:30:18,519 --> 00:30:24,000
soon but the the final goal is that
638
00:30:22,120 --> 00:30:25,399
after learning has happened they look
639
00:30:24,000 --> 00:30:26,799
they have these two properties like
640
00:30:25,399 --> 00:30:28,600
similar words are close together in the
641
00:30:26,799 --> 00:30:30,080
vectorace
642
00:30:28,600 --> 00:30:32,640
and
643
00:30:30,080 --> 00:30:35,679
um that's like number one that's the
644
00:30:32,640 --> 00:30:37,600
most important and then number two is
645
00:30:35,679 --> 00:30:39,279
ideally these uh features would have
646
00:30:37,600 --> 00:30:41,200
some meaning uh maybe human
647
00:30:39,279 --> 00:30:44,720
interpretable meaning maybe not human
648
00:30:41,200 --> 00:30:47,880
interpretable meaning but
649
00:30:44,720 --> 00:30:50,880
yeah so um one thing that I should
650
00:30:47,880 --> 00:30:53,159
mention is I I showed a contrast between
651
00:30:50,880 --> 00:30:55,159
the bag of words uh the one hot
652
00:30:53,159 --> 00:30:57,000
representations here and the dense
653
00:30:55,159 --> 00:31:00,880
representations here and I used this
654
00:30:57,000 --> 00:31:03,880
look look up operation for both of them
655
00:31:00,880 --> 00:31:07,399
and this this lookup
656
00:31:03,880 --> 00:31:09,559
operation actually um can be viewed as
657
00:31:07,399 --> 00:31:11,799
grabbing a single Vector from a big
658
00:31:09,559 --> 00:31:14,919
Matrix of word
659
00:31:11,799 --> 00:31:17,760
embeddings and
660
00:31:14,919 --> 00:31:19,760
so the way it can work is like we have
661
00:31:17,760 --> 00:31:22,919
this big vector and then we look up word
662
00:31:19,760 --> 00:31:25,919
number two in a zero index Matrix and it
663
00:31:22,919 --> 00:31:27,799
would just grab this out of that Matrix
664
00:31:25,919 --> 00:31:29,880
and that's practically what most like
665
00:31:27,799 --> 00:31:32,240
deep learning libraries or or whatever
666
00:31:29,880 --> 00:31:35,840
Library you use are going to be
667
00:31:32,240 --> 00:31:38,000
doing but another uh way you can view it
668
00:31:35,840 --> 00:31:40,880
is you can view it as multiplying by a
669
00:31:38,000 --> 00:31:43,880
one hot vector and so you have this
670
00:31:40,880 --> 00:31:48,679
Vector uh exactly the same Matrix uh but
671
00:31:43,880 --> 00:31:50,799
you just multiply by a vector uh 0 1 z z
672
00:31:48,679 --> 00:31:55,720
and that gives you exactly the same
673
00:31:50,799 --> 00:31:58,200
things um so the Practical imple
674
00:31:55,720 --> 00:31:59,720
implementations of this uh uh tend to be
675
00:31:58,200 --> 00:32:01,279
the first one because the first one's a
676
00:31:59,720 --> 00:32:04,679
lot faster to implement you don't need
677
00:32:01,279 --> 00:32:06,760
to multiply like this big thing by a
678
00:32:04,679 --> 00:32:11,000
huge Vector but there
679
00:32:06,760 --> 00:32:13,880
are advantages of knowing the second one
680
00:32:11,000 --> 00:32:15,519
uh just to give an example what if you
681
00:32:13,880 --> 00:32:19,600
for whatever reason you came up with
682
00:32:15,519 --> 00:32:21,440
like an a crazy model that predicts a
683
00:32:19,600 --> 00:32:24,120
probability distribution over words
684
00:32:21,440 --> 00:32:25,720
instead of just words maybe it's a
685
00:32:24,120 --> 00:32:27,679
language model that has an idea of what
686
00:32:25,720 --> 00:32:30,200
the next word is going to look like
687
00:32:27,679 --> 00:32:32,159
and maybe your um maybe your model
688
00:32:30,200 --> 00:32:35,279
thinks the next word has a 50%
689
00:32:32,159 --> 00:32:36,600
probability of being capped 30%
690
00:32:35,279 --> 00:32:42,279
probability of being
691
00:32:36,600 --> 00:32:44,960
dog and uh 2% probability uh sorry uh
692
00:32:42,279 --> 00:32:47,200
20% probability being
693
00:32:44,960 --> 00:32:50,000
bir you can take this vector and
694
00:32:47,200 --> 00:32:51,480
multiply it by The Matrix and get like a
695
00:32:50,000 --> 00:32:53,639
word embedding that's kind of a mix of
696
00:32:51,480 --> 00:32:55,639
all of those word which might be
697
00:32:53,639 --> 00:32:57,960
interesting and let you do creative
698
00:32:55,639 --> 00:33:02,120
things so um knowing that these two
699
00:32:57,960 --> 00:33:05,360
things are the same are the same is kind
700
00:33:02,120 --> 00:33:05,360
of useful for that kind of
701
00:33:05,919 --> 00:33:11,480
thing um any any questions about this
702
00:33:09,120 --> 00:33:13,919
I'm G to talk about how we train next so
703
00:33:11,480 --> 00:33:18,159
maybe maybe I can goow into
704
00:33:13,919 --> 00:33:23,159
that okay cool so how do we get the
705
00:33:18,159 --> 00:33:25,840
vectors uh like the question uh so up
706
00:33:23,159 --> 00:33:27,519
until now we trained a bag of words
707
00:33:25,840 --> 00:33:29,080
model and the way we trained a bag of
708
00:33:27,519 --> 00:33:31,159
words model was using the structured
709
00:33:29,080 --> 00:33:35,440
perceptron algorithm where if the model
710
00:33:31,159 --> 00:33:39,639
got the answer wrong we would either
711
00:33:35,440 --> 00:33:42,799
increment or decrement the embeddings
712
00:33:39,639 --> 00:33:45,080
based on whether uh whether the label
713
00:33:42,799 --> 00:33:46,559
was positive or negative right so I
714
00:33:45,080 --> 00:33:48,919
showed an example of this very simple
715
00:33:46,559 --> 00:33:51,039
algorithm you don't even uh need to
716
00:33:48,919 --> 00:33:52,480
write any like numpy or anything like
717
00:33:51,039 --> 00:33:55,919
that to implement that
718
00:33:52,480 --> 00:33:59,559
algorithm uh so here here it is so we
719
00:33:55,919 --> 00:34:02,320
have like 4X why in uh data we extract
720
00:33:59,559 --> 00:34:04,639
the features we run the classifier uh we
721
00:34:02,320 --> 00:34:07,440
have the predicted why and then we
722
00:34:04,639 --> 00:34:09,480
increment or decrement
723
00:34:07,440 --> 00:34:12,679
features but how do we train more
724
00:34:09,480 --> 00:34:15,599
complex models so I think most people
725
00:34:12,679 --> 00:34:17,079
here have taken a uh machine learning
726
00:34:15,599 --> 00:34:19,159
class of some kind so this will be
727
00:34:17,079 --> 00:34:21,079
reviewed for a lot of people uh but
728
00:34:19,159 --> 00:34:22,280
basically we do this uh by doing
729
00:34:21,079 --> 00:34:24,839
gradient
730
00:34:22,280 --> 00:34:27,240
descent and in order to do so we write
731
00:34:24,839 --> 00:34:29,919
down a loss function calculate the
732
00:34:27,240 --> 00:34:30,919
derivatives of the L function with
733
00:34:29,919 --> 00:34:35,079
respect to the
734
00:34:30,919 --> 00:34:37,320
parameters and move uh the parameters in
735
00:34:35,079 --> 00:34:40,839
the direction that reduces the loss
736
00:34:37,320 --> 00:34:42,720
mtion and so specifically for this bag
737
00:34:40,839 --> 00:34:45,560
of words or continuous bag of words
738
00:34:42,720 --> 00:34:48,240
model um we want this loss of function
739
00:34:45,560 --> 00:34:50,839
to be a loss function that gets lower as
740
00:34:48,240 --> 00:34:52,240
the model gets better and I'm going to
741
00:34:50,839 --> 00:34:54,000
give two examples from binary
742
00:34:52,240 --> 00:34:57,400
classification both of these are used in
743
00:34:54,000 --> 00:34:58,839
NLP models uh reasonably frequently
744
00:34:57,400 --> 00:35:01,440
uh there's a bunch of other loss
745
00:34:58,839 --> 00:35:02,800
functions but these are kind of the two
746
00:35:01,440 --> 00:35:05,480
major
747
00:35:02,800 --> 00:35:08,160
ones so the first one um which is
748
00:35:05,480 --> 00:35:10,160
actually less frequent is the hinge loss
749
00:35:08,160 --> 00:35:13,400
and then the second one is taking a
750
00:35:10,160 --> 00:35:15,800
sigmoid and then doing negative log
751
00:35:13,400 --> 00:35:19,760
likelyhood so the hinge loss basically
752
00:35:15,800 --> 00:35:22,760
what we do is we uh take the max of the
753
00:35:19,760 --> 00:35:26,119
label times the score that is output by
754
00:35:22,760 --> 00:35:29,200
the model and zero and what this looks
755
00:35:26,119 --> 00:35:33,480
like is we have a hinged loss uh where
756
00:35:29,200 --> 00:35:36,880
if Y is equal to one the loss if Y is
757
00:35:33,480 --> 00:35:39,520
greater than zero is zero so as long as
758
00:35:36,880 --> 00:35:42,680
we get basically as long as we get the
759
00:35:39,520 --> 00:35:45,079
answer right there's no loss um as the
760
00:35:42,680 --> 00:35:47,400
answer gets more wrong the loss gets
761
00:35:45,079 --> 00:35:49,880
worse like this and then similarly if
762
00:35:47,400 --> 00:35:53,160
the label is negative if we get a
763
00:35:49,880 --> 00:35:54,839
negative score uh then we get zero loss
764
00:35:53,160 --> 00:35:55,800
and the loss increases if we have a
765
00:35:54,839 --> 00:35:58,800
positive
766
00:35:55,800 --> 00:36:00,800
score so the sigmoid plus negative log
767
00:35:58,800 --> 00:36:05,440
likelihood the way this works is you
768
00:36:00,800 --> 00:36:07,400
multiply y * the score here and um then
769
00:36:05,440 --> 00:36:09,960
we have the sigmoid function which is
770
00:36:07,400 --> 00:36:14,079
just kind of a nice function that looks
771
00:36:09,960 --> 00:36:15,440
like this with zero and one centered
772
00:36:14,079 --> 00:36:19,480
around
773
00:36:15,440 --> 00:36:21,240
zero and then we take the negative log
774
00:36:19,480 --> 00:36:22,319
of this sigmoid function or the negative
775
00:36:21,240 --> 00:36:27,160
log
776
00:36:22,319 --> 00:36:28,520
likelihood and that gives us a uh L that
777
00:36:27,160 --> 00:36:30,440
looks a little bit like this so
778
00:36:28,520 --> 00:36:32,640
basically you can see that these look
779
00:36:30,440 --> 00:36:36,040
very similar right the difference being
780
00:36:32,640 --> 00:36:37,760
that the hinge loss is uh sharp and we
781
00:36:36,040 --> 00:36:41,119
get exactly a zero loss if we get the
782
00:36:37,760 --> 00:36:44,319
answer right and the sigmoid is smooth
783
00:36:41,119 --> 00:36:48,440
uh and we never get a zero
784
00:36:44,319 --> 00:36:50,680
loss um so does anyone have an idea of
785
00:36:48,440 --> 00:36:53,119
the benefits and disadvantages of
786
00:36:50,680 --> 00:36:55,680
these I kind of flashed one on the
787
00:36:53,119 --> 00:36:57,599
screen already
788
00:36:55,680 --> 00:36:59,400
but
789
00:36:57,599 --> 00:37:01,359
so I flash that on the screen so I'll
790
00:36:59,400 --> 00:37:03,680
give this one and then I can have a quiz
791
00:37:01,359 --> 00:37:06,319
about the sign but the the hinge glass
792
00:37:03,680 --> 00:37:07,720
is more closely linked to accuracy and
793
00:37:06,319 --> 00:37:10,400
the reason why it's more closely linked
794
00:37:07,720 --> 00:37:13,640
to accuracy is because basically we will
795
00:37:10,400 --> 00:37:16,079
get a zero loss if the model gets the
796
00:37:13,640 --> 00:37:18,319
answer right so when the model gets all
797
00:37:16,079 --> 00:37:20,240
of the answers right we will just stop
798
00:37:18,319 --> 00:37:22,760
updating our model whatsoever because we
799
00:37:20,240 --> 00:37:25,440
never we don't have any loss whatsoever
800
00:37:22,760 --> 00:37:27,720
and the gradient of the loss is zero um
801
00:37:25,440 --> 00:37:29,960
what about the sigmoid uh a negative log
802
00:37:27,720 --> 00:37:33,160
likelihood uh there there's kind of two
803
00:37:29,960 --> 00:37:36,160
major advantages of this anyone want to
804
00:37:33,160 --> 00:37:36,160
review their machine learning
805
00:37:38,240 --> 00:37:41,800
test sorry what was
806
00:37:43,800 --> 00:37:49,960
that for for R uh yeah maybe there's a
807
00:37:48,200 --> 00:37:51,319
more direct I think I know what you're
808
00:37:49,960 --> 00:37:54,560
saying but maybe there's a more direct
809
00:37:51,319 --> 00:37:54,560
way to say that um
810
00:37:54,839 --> 00:38:00,760
yeah yeah so the gradient is nonzero
811
00:37:57,560 --> 00:38:04,240
everywhere and uh the gradient also kind
812
00:38:00,760 --> 00:38:05,839
of increases as your score gets worse so
813
00:38:04,240 --> 00:38:08,440
those are that's one advantage it makes
814
00:38:05,839 --> 00:38:11,240
it easier to optimize models um another
815
00:38:08,440 --> 00:38:13,839
one linked to the ROC score but maybe we
816
00:38:11,240 --> 00:38:13,839
could say it more
817
00:38:16,119 --> 00:38:19,400
directly any
818
00:38:20,040 --> 00:38:26,920
ideas okay um basically the sigmoid can
819
00:38:23,240 --> 00:38:30,160
be interpreted as a probability so um if
820
00:38:26,920 --> 00:38:32,839
the the sigmoid is between Zer and one
821
00:38:30,160 --> 00:38:34,640
uh and because it's between zero and one
822
00:38:32,839 --> 00:38:36,720
we can say the sigmoid is a
823
00:38:34,640 --> 00:38:38,640
probability um and that can be useful
824
00:38:36,720 --> 00:38:40,119
for various things like if we want a
825
00:38:38,640 --> 00:38:41,960
downstream model or if we want a
826
00:38:40,119 --> 00:38:45,480
confidence prediction out of the model
827
00:38:41,960 --> 00:38:48,200
so those are two uh advantages of using
828
00:38:45,480 --> 00:38:49,920
a s plus negative log likelihood there's
829
00:38:48,200 --> 00:38:53,160
no probabilistic interpretation to
830
00:38:49,920 --> 00:38:56,560
something transing theas
831
00:38:53,160 --> 00:38:59,200
basically cool um so the next thing that
832
00:38:56,560 --> 00:39:01,240
that we do is we calculate derivatives
833
00:38:59,200 --> 00:39:04,040
and we calculate the derivative of the
834
00:39:01,240 --> 00:39:05,920
parameter given the loss function um to
835
00:39:04,040 --> 00:39:09,839
give an example of the bag of words
836
00:39:05,920 --> 00:39:13,480
model and the hinge loss um the hinge
837
00:39:09,839 --> 00:39:16,480
loss as I said is the max of the score
838
00:39:13,480 --> 00:39:19,359
and times y in the bag of words model
839
00:39:16,480 --> 00:39:22,640
the score was the frequency of that
840
00:39:19,359 --> 00:39:25,880
vocabulary item in the input multiplied
841
00:39:22,640 --> 00:39:27,680
by the weight here and so if we this is
842
00:39:25,880 --> 00:39:29,520
a simple a function that I can just do
843
00:39:27,680 --> 00:39:34,440
the derivative by hand and if I do the
844
00:39:29,520 --> 00:39:36,920
deriva by hand what comes out is if y *
845
00:39:34,440 --> 00:39:39,319
this value is greater than zero so in
846
00:39:36,920 --> 00:39:44,640
other words if this Max uh picks this
847
00:39:39,319 --> 00:39:48,319
instead of this then the derivative is y
848
00:39:44,640 --> 00:39:52,359
* stre and otherwise uh it
849
00:39:48,319 --> 00:39:52,359
is in the opposite
850
00:39:55,400 --> 00:40:00,160
direction
851
00:39:56,920 --> 00:40:02,839
then uh optimizing gradients uh we do
852
00:40:00,160 --> 00:40:06,200
standard uh in standard stochastic
853
00:40:02,839 --> 00:40:07,839
gradient descent uh which is the most
854
00:40:06,200 --> 00:40:10,920
standard optimization algorithm for
855
00:40:07,839 --> 00:40:14,440
these models uh we basically have a
856
00:40:10,920 --> 00:40:17,440
gradient over uh you take the gradient
857
00:40:14,440 --> 00:40:20,040
over the parameter of the loss function
858
00:40:17,440 --> 00:40:22,480
and we call it GT so here um sorry I
859
00:40:20,040 --> 00:40:25,599
switched my terminology between W and
860
00:40:22,480 --> 00:40:28,280
Theta so this could be W uh the previous
861
00:40:25,599 --> 00:40:31,000
value of w
862
00:40:28,280 --> 00:40:35,440
um and this is the gradient of the loss
863
00:40:31,000 --> 00:40:37,040
and then uh we take the previous value
864
00:40:35,440 --> 00:40:39,680
and then we subtract out the learning
865
00:40:37,040 --> 00:40:39,680
rate times the
866
00:40:40,680 --> 00:40:45,720
gradient and uh there are many many
867
00:40:43,200 --> 00:40:47,280
other optimization options uh I'll cover
868
00:40:45,720 --> 00:40:50,960
the more frequent one called Adam at the
869
00:40:47,280 --> 00:40:54,319
end of this uh this lecture but um this
870
00:40:50,960 --> 00:40:57,160
is the basic way of optimizing the
871
00:40:54,319 --> 00:41:00,599
model so
872
00:40:57,160 --> 00:41:03,359
then my question now is what is this
873
00:41:00,599 --> 00:41:07,000
algorithm with respect
874
00:41:03,359 --> 00:41:10,119
to this is an algorithm that is
875
00:41:07,000 --> 00:41:12,280
taking that has a loss function it's
876
00:41:10,119 --> 00:41:14,079
calculating derivatives and it's
877
00:41:12,280 --> 00:41:17,240
optimizing gradients using stochastic
878
00:41:14,079 --> 00:41:18,839
gradient descent so does anyone have a
879
00:41:17,240 --> 00:41:20,960
guess about what the loss function is
880
00:41:18,839 --> 00:41:23,520
here and maybe what is the learning rate
881
00:41:20,960 --> 00:41:23,520
of stas
882
00:41:24,319 --> 00:41:29,480
gradient I kind of gave you a hint about
883
00:41:26,599 --> 00:41:29,480
the L one
884
00:41:31,640 --> 00:41:37,839
actually and just to recap what this is
885
00:41:34,440 --> 00:41:41,440
doing here it's um if predicted Y is
886
00:41:37,839 --> 00:41:44,560
equal to Y then it is moving the uh the
887
00:41:41,440 --> 00:41:48,240
future weights in the direction of Y
888
00:41:44,560 --> 00:41:48,240
times the frequency
889
00:41:52,599 --> 00:41:56,960
Vector
890
00:41:55,240 --> 00:41:59,079
yeah
891
00:41:56,960 --> 00:42:01,640
yeah exactly so the loss function is
892
00:41:59,079 --> 00:42:05,800
hinge loss and the learning rate is one
893
00:42:01,640 --> 00:42:07,880
um and just to show how that you know
894
00:42:05,800 --> 00:42:12,359
corresponds we have this if statement
895
00:42:07,880 --> 00:42:12,359
here and we have the increment of the
896
00:42:12,960 --> 00:42:20,240
features and this is what the um what
897
00:42:16,920 --> 00:42:21,599
the L sorry the derivative looked like
898
00:42:20,240 --> 00:42:24,240
so we have
899
00:42:21,599 --> 00:42:26,920
if this is moving in the right direction
900
00:42:24,240 --> 00:42:29,520
for the label uh then we increment
901
00:42:26,920 --> 00:42:31,599
otherwise we do nothing so
902
00:42:29,520 --> 00:42:33,559
basically you can see that even this
903
00:42:31,599 --> 00:42:35,200
really simple algorithm that I you know
904
00:42:33,559 --> 00:42:37,480
implemented with a few lines of python
905
00:42:35,200 --> 00:42:38,839
is essentially equivalent to this uh
906
00:42:37,480 --> 00:42:40,760
stochastic gradient descent that we
907
00:42:38,839 --> 00:42:44,559
doing
908
00:42:40,760 --> 00:42:46,359
models so the good news about this is
909
00:42:44,559 --> 00:42:48,359
you know this this is really simple but
910
00:42:46,359 --> 00:42:50,599
it only really works forit like a bag of
911
00:42:48,359 --> 00:42:55,400
words model or a simple feature based
912
00:42:50,599 --> 00:42:57,200
model uh but it opens up a lot of uh new
913
00:42:55,400 --> 00:43:00,440
possibilities for how we can optimize
914
00:42:57,200 --> 00:43:01,599
models and in particular I mentioned uh
915
00:43:00,440 --> 00:43:04,839
that there was a problem with
916
00:43:01,599 --> 00:43:08,200
combination features last class like
917
00:43:04,839 --> 00:43:11,200
don't hate and don't love are not just
918
00:43:08,200 --> 00:43:12,760
you know hate plus don't and love plus
919
00:43:11,200 --> 00:43:14,119
don't it's actually the combination of
920
00:43:12,760 --> 00:43:17,680
the two is really
921
00:43:14,119 --> 00:43:20,160
important and so um yeah just to give an
922
00:43:17,680 --> 00:43:23,440
example we have don't love is maybe bad
923
00:43:20,160 --> 00:43:26,960
uh nothing I don't love is very
924
00:43:23,440 --> 00:43:30,960
good and so in order
925
00:43:26,960 --> 00:43:34,040
to solve this problem we turn to neural
926
00:43:30,960 --> 00:43:37,160
networks and the way we do this is we
927
00:43:34,040 --> 00:43:39,119
have a lookup of dense embeddings sorry
928
00:43:37,160 --> 00:43:41,839
I actually I just realized my coloring
929
00:43:39,119 --> 00:43:44,119
is off I was using red to indicate dense
930
00:43:41,839 --> 00:43:46,480
embeddings so this should be maybe red
931
00:43:44,119 --> 00:43:49,319
instead of blue but um we take these
932
00:43:46,480 --> 00:43:51,200
stents embeddings and then we create
933
00:43:49,319 --> 00:43:53,720
some complicated function to extract
934
00:43:51,200 --> 00:43:55,079
combination features um and then use
935
00:43:53,720 --> 00:43:57,359
those to calculate
936
00:43:55,079 --> 00:44:02,200
scores
937
00:43:57,359 --> 00:44:04,480
um and so we calculate these combination
938
00:44:02,200 --> 00:44:08,240
features and what we want to do is we
939
00:44:04,480 --> 00:44:12,880
want to extract vectors from the input
940
00:44:08,240 --> 00:44:12,880
where each Vector has features
941
00:44:15,839 --> 00:44:21,040
um sorry this is in the wrong order so
942
00:44:18,240 --> 00:44:22,559
I'll I'll get back to this um so this
943
00:44:21,040 --> 00:44:25,319
this was talking about the The
944
00:44:22,559 --> 00:44:27,200
Continuous bag of words features so the
945
00:44:25,319 --> 00:44:30,960
problem with the continuous bag of words
946
00:44:27,200 --> 00:44:30,960
features was we were extracting
947
00:44:31,359 --> 00:44:36,359
features
948
00:44:33,079 --> 00:44:36,359
um like
949
00:44:36,839 --> 00:44:41,400
this but then we were directly using the
950
00:44:39,760 --> 00:44:43,359
the feature the dense features that we
951
00:44:41,400 --> 00:44:45,559
extracted to make predictions without
952
00:44:43,359 --> 00:44:48,839
actually allowing for any interactions
953
00:44:45,559 --> 00:44:51,839
between the features um and
954
00:44:48,839 --> 00:44:55,160
so uh neural networks the way we fix
955
00:44:51,839 --> 00:44:57,079
this is we first extract these features
956
00:44:55,160 --> 00:44:59,440
uh we take these these features of each
957
00:44:57,079 --> 00:45:04,000
word embedding and then we run them
958
00:44:59,440 --> 00:45:07,240
through uh kind of linear transforms in
959
00:45:04,000 --> 00:45:09,880
nonlinear uh like linear multiplications
960
00:45:07,240 --> 00:45:10,880
and then nonlinear transforms to extract
961
00:45:09,880 --> 00:45:13,920
additional
962
00:45:10,880 --> 00:45:15,839
features and uh finally run this through
963
00:45:13,920 --> 00:45:18,640
several layers and then use the
964
00:45:15,839 --> 00:45:21,119
resulting features to make our
965
00:45:18,640 --> 00:45:23,200
predictions and when we do this this
966
00:45:21,119 --> 00:45:25,319
allows us to do more uh interesting
967
00:45:23,200 --> 00:45:28,319
things so like for example we could
968
00:45:25,319 --> 00:45:30,000
learn feature combination a node in the
969
00:45:28,319 --> 00:45:32,599
second layer might be feature one and
970
00:45:30,000 --> 00:45:35,240
feature five are active so that could be
971
00:45:32,599 --> 00:45:38,680
like feature one corresponds to negative
972
00:45:35,240 --> 00:45:43,640
sentiment words like hate
973
00:45:38,680 --> 00:45:45,839
despise um and other things like that so
974
00:45:43,640 --> 00:45:50,079
for hate and despise feature one would
975
00:45:45,839 --> 00:45:53,119
have a high value like 8.0 and then
976
00:45:50,079 --> 00:45:55,480
7.2 and then we also have negation words
977
00:45:53,119 --> 00:45:57,040
like don't or not or something like that
978
00:45:55,480 --> 00:46:00,040
and those would
979
00:45:57,040 --> 00:46:00,040
have
980
00:46:03,720 --> 00:46:08,640
don't would have a high value for like 2
981
00:46:11,880 --> 00:46:15,839
five and so these would be the word
982
00:46:14,200 --> 00:46:18,040
embeddings where each word embedding
983
00:46:15,839 --> 00:46:20,599
corresponded to you know features of the
984
00:46:18,040 --> 00:46:23,480
words and
985
00:46:20,599 --> 00:46:25,480
then um after that we would extract
986
00:46:23,480 --> 00:46:29,319
feature combinations in this second
987
00:46:25,480 --> 00:46:32,079
layer that say oh we see at least one
988
00:46:29,319 --> 00:46:33,760
word where the first feature is active
989
00:46:32,079 --> 00:46:36,359
and we see at least one word where the
990
00:46:33,760 --> 00:46:37,920
fifth feature is active so now that
991
00:46:36,359 --> 00:46:40,640
allows us to capture the fact that we
992
00:46:37,920 --> 00:46:42,319
saw like don't hate or don't despise or
993
00:46:40,640 --> 00:46:44,559
not hate or not despise or something
994
00:46:42,319 --> 00:46:44,559
like
995
00:46:45,079 --> 00:46:51,760
that so this is the way uh kind of this
996
00:46:49,680 --> 00:46:54,839
is a deep uh continuous bag of words
997
00:46:51,760 --> 00:46:56,839
model um this actually was proposed in
998
00:46:54,839 --> 00:46:58,119
205 15 I don't think I have the
999
00:46:56,839 --> 00:47:02,599
reference on the slide but I think it's
1000
00:46:58,119 --> 00:47:05,040
in the notes um on the website and
1001
00:47:02,599 --> 00:47:07,200
actually at that point in time they
1002
00:47:05,040 --> 00:47:09,200
demon there were several interesting
1003
00:47:07,200 --> 00:47:11,960
results that showed that even this like
1004
00:47:09,200 --> 00:47:13,960
really simple model did really well uh
1005
00:47:11,960 --> 00:47:16,319
at text classification and other simple
1006
00:47:13,960 --> 00:47:18,640
tasks like that because it was able to
1007
00:47:16,319 --> 00:47:21,720
you know share features of the words and
1008
00:47:18,640 --> 00:47:23,800
then extract combinations to the
1009
00:47:21,720 --> 00:47:28,200
features
1010
00:47:23,800 --> 00:47:29,760
so um in order order to learn these we
1011
00:47:28,200 --> 00:47:30,920
need to start turning to neural networks
1012
00:47:29,760 --> 00:47:34,400
and the reason why we need to start
1013
00:47:30,920 --> 00:47:38,040
turning to neural networks is
1014
00:47:34,400 --> 00:47:41,920
because while I can calculate the loss
1015
00:47:38,040 --> 00:47:43,280
function of the while I can calculate
1016
00:47:41,920 --> 00:47:44,839
the loss function of the hinged loss for
1017
00:47:43,280 --> 00:47:47,720
a bag of words model by hand I
1018
00:47:44,839 --> 00:47:49,359
definitely don't I probably could but
1019
00:47:47,720 --> 00:47:51,240
don't want to do it for a model that
1020
00:47:49,359 --> 00:47:53,200
starts become as complicated as this
1021
00:47:51,240 --> 00:47:57,440
with multiple Matrix multiplications
1022
00:47:53,200 --> 00:48:00,520
Andes and stuff like that so the way we
1023
00:47:57,440 --> 00:48:05,000
do this just a very brief uh coverage of
1024
00:48:00,520 --> 00:48:06,200
this uh for because um I think probably
1025
00:48:05,000 --> 00:48:08,400
a lot of people have dealt with neural
1026
00:48:06,200 --> 00:48:10,200
networks before um the original
1027
00:48:08,400 --> 00:48:12,880
motivation was that we had neurons in
1028
00:48:10,200 --> 00:48:16,160
the brain uh where
1029
00:48:12,880 --> 00:48:18,839
the each of the neuron synapses took in
1030
00:48:16,160 --> 00:48:21,480
an electrical signal and once they got
1031
00:48:18,839 --> 00:48:24,079
enough electrical signal they would fire
1032
00:48:21,480 --> 00:48:25,960
um but now the current conception of
1033
00:48:24,079 --> 00:48:28,160
neural networks or deep learning models
1034
00:48:25,960 --> 00:48:30,440
is basically computation
1035
00:48:28,160 --> 00:48:32,400
graphs and the way a computation graph
1036
00:48:30,440 --> 00:48:34,760
Works um and I'm especially going to
1037
00:48:32,400 --> 00:48:36,240
talk about the way it works in natural
1038
00:48:34,760 --> 00:48:38,119
language processing which might be a
1039
00:48:36,240 --> 00:48:42,319
contrast to the way it works in computer
1040
00:48:38,119 --> 00:48:43,960
vision is um we have an expression uh
1041
00:48:42,319 --> 00:48:46,480
that looks like this and maybe maybe
1042
00:48:43,960 --> 00:48:47,640
it's the expression X corresponding to
1043
00:48:46,480 --> 00:48:51,880
uh a
1044
00:48:47,640 --> 00:48:53,400
scal um and each node corresponds to
1045
00:48:51,880 --> 00:48:55,599
something like a tensor a matrix a
1046
00:48:53,400 --> 00:48:57,599
vector a scalar so scaler is uh kind
1047
00:48:55,599 --> 00:49:00,480
kind of Zero Dimensional it's a single
1048
00:48:57,599 --> 00:49:01,720
value one dimensional two dimensional or
1049
00:49:00,480 --> 00:49:04,200
arbitrary
1050
00:49:01,720 --> 00:49:06,040
dimensional um and then we also have
1051
00:49:04,200 --> 00:49:08,000
nodes that correspond to the result of
1052
00:49:06,040 --> 00:49:11,480
function applications so if we have X be
1053
00:49:08,000 --> 00:49:14,079
a vector uh we take the vector transpose
1054
00:49:11,480 --> 00:49:18,160
and so each Edge represents a function
1055
00:49:14,079 --> 00:49:20,559
argument and also a data
1056
00:49:18,160 --> 00:49:23,960
dependency and a node with an incoming
1057
00:49:20,559 --> 00:49:27,000
Edge is a function of that Edge's tail
1058
00:49:23,960 --> 00:49:29,040
node and importantly each node knows how
1059
00:49:27,000 --> 00:49:30,640
to compute its value and the value of
1060
00:49:29,040 --> 00:49:32,640
its derivative with respect to each
1061
00:49:30,640 --> 00:49:34,440
argument times the derivative of an
1062
00:49:32,640 --> 00:49:37,920
arbitrary
1063
00:49:34,440 --> 00:49:41,000
input and functions could be basically
1064
00:49:37,920 --> 00:49:45,400
arbitrary functions it can be unary Nary
1065
00:49:41,000 --> 00:49:49,440
unary binary Nary often unary or binary
1066
00:49:45,400 --> 00:49:52,400
and computation graphs are directed in
1067
00:49:49,440 --> 00:49:57,040
cyclic and um one important thing to
1068
00:49:52,400 --> 00:50:00,640
note is that you can um have multiple
1069
00:49:57,040 --> 00:50:02,559
ways of expressing the same function so
1070
00:50:00,640 --> 00:50:04,839
this is actually really important as you
1071
00:50:02,559 --> 00:50:06,920
start implementing things and the reason
1072
00:50:04,839 --> 00:50:09,359
why is the left graph and the right
1073
00:50:06,920 --> 00:50:12,960
graph both express the same thing the
1074
00:50:09,359 --> 00:50:18,640
left graph expresses X
1075
00:50:12,960 --> 00:50:22,559
transpose time A Time X where is whereas
1076
00:50:18,640 --> 00:50:27,160
this one has x a and then it puts it
1077
00:50:22,559 --> 00:50:28,760
into a node that is X transpose a x
1078
00:50:27,160 --> 00:50:30,319
and so these Express exactly the same
1079
00:50:28,760 --> 00:50:32,319
thing but the graph on the left is
1080
00:50:30,319 --> 00:50:33,760
larger and the reason why this is
1081
00:50:32,319 --> 00:50:38,920
important is for practical
1082
00:50:33,760 --> 00:50:40,359
implementation of neural networks um you
1083
00:50:38,920 --> 00:50:43,200
the larger graphs are going to take more
1084
00:50:40,359 --> 00:50:46,799
memory and going to be slower usually
1085
00:50:43,200 --> 00:50:48,200
and so often um in a neural network we
1086
00:50:46,799 --> 00:50:49,559
look at like pipe part which we're going
1087
00:50:48,200 --> 00:50:52,160
to look at in a
1088
00:50:49,559 --> 00:50:55,520
second
1089
00:50:52,160 --> 00:50:57,920
um you will have something you will be
1090
00:50:55,520 --> 00:50:57,920
able to
1091
00:50:58,680 --> 00:51:01,680
do
1092
00:51:03,079 --> 00:51:07,880
this or you'll be able to do
1093
00:51:18,760 --> 00:51:22,880
like
1094
00:51:20,359 --> 00:51:24,839
this so these are two different options
1095
00:51:22,880 --> 00:51:26,920
this one is using more operations and
1096
00:51:24,839 --> 00:51:29,559
this one is using using less operations
1097
00:51:26,920 --> 00:51:31,000
and this is going to be faster because
1098
00:51:29,559 --> 00:51:33,119
basically the implementation within
1099
00:51:31,000 --> 00:51:34,799
Pythor will have been optimized for you
1100
00:51:33,119 --> 00:51:36,799
it will only require one graph node
1101
00:51:34,799 --> 00:51:37,880
instead of multiple graph nodes and
1102
00:51:36,799 --> 00:51:39,799
that's even more important when you
1103
00:51:37,880 --> 00:51:41,040
start talking about like attention or
1104
00:51:39,799 --> 00:51:43,920
something like that which we're going to
1105
00:51:41,040 --> 00:51:46,079
be covering very soon um attention is a
1106
00:51:43,920 --> 00:51:47,359
very multi-head attention or something
1107
00:51:46,079 --> 00:51:49,839
like that is a very complicated
1108
00:51:47,359 --> 00:51:52,079
operation so you want to make sure that
1109
00:51:49,839 --> 00:51:54,359
you're using the operators that are
1110
00:51:52,079 --> 00:51:57,359
available to you to make this more
1111
00:51:54,359 --> 00:51:57,359
efficient
1112
00:51:57,440 --> 00:52:00,760
um and then finally we could like add
1113
00:51:59,280 --> 00:52:01,920
all of these together at the end we
1114
00:52:00,760 --> 00:52:04,000
could add a
1115
00:52:01,920 --> 00:52:05,880
constant um and then we get this
1116
00:52:04,000 --> 00:52:09,520
expression here which gives us kind of a
1117
00:52:05,880 --> 00:52:09,520
polinomial polom
1118
00:52:09,680 --> 00:52:15,760
expression um also another thing to note
1119
00:52:13,480 --> 00:52:17,599
is within a neural network computation
1120
00:52:15,760 --> 00:52:21,920
graph variable names are just labelings
1121
00:52:17,599 --> 00:52:25,359
of nodes and so if you're using a a
1122
00:52:21,920 --> 00:52:27,680
computation graph like this you might
1123
00:52:25,359 --> 00:52:29,240
only be declaring one variable here but
1124
00:52:27,680 --> 00:52:30,839
actually there's a whole bunch of stuff
1125
00:52:29,240 --> 00:52:32,359
going on behind the scenes and all of
1126
00:52:30,839 --> 00:52:34,240
that will take memory and computation
1127
00:52:32,359 --> 00:52:35,440
time and stuff like that so it's
1128
00:52:34,240 --> 00:52:37,119
important to be aware of that if you
1129
00:52:35,440 --> 00:52:40,400
want to make your implementations more
1130
00:52:37,119 --> 00:52:40,400
efficient than other other
1131
00:52:41,119 --> 00:52:46,680
things so we have several algorithms
1132
00:52:44,480 --> 00:52:49,079
that go into implementing neural nuts um
1133
00:52:46,680 --> 00:52:50,760
the first one is graph construction uh
1134
00:52:49,079 --> 00:52:53,480
the second one is forward
1135
00:52:50,760 --> 00:52:54,839
propagation uh and graph construction is
1136
00:52:53,480 --> 00:52:56,359
basically constructing the graph
1137
00:52:54,839 --> 00:52:58,680
declaring ing all the variables stuff
1138
00:52:56,359 --> 00:53:01,520
like this the second one is forward
1139
00:52:58,680 --> 00:53:03,880
propagation and um the way you do this
1140
00:53:01,520 --> 00:53:06,480
is in topological order uh you compute
1141
00:53:03,880 --> 00:53:08,280
the value of a node given its inputs and
1142
00:53:06,480 --> 00:53:11,000
so basically you start out with all of
1143
00:53:08,280 --> 00:53:12,680
the nodes that you give is input and
1144
00:53:11,000 --> 00:53:16,040
then you find any node in the graph
1145
00:53:12,680 --> 00:53:17,799
where all of its uh all of its tail
1146
00:53:16,040 --> 00:53:20,280
nodes or all of its children have been
1147
00:53:17,799 --> 00:53:22,119
calculated so in this case that would be
1148
00:53:20,280 --> 00:53:24,640
these two nodes and then in arbitrary
1149
00:53:22,119 --> 00:53:27,000
order or even in parallel you calculate
1150
00:53:24,640 --> 00:53:28,280
the value of all of the satisfied nodes
1151
00:53:27,000 --> 00:53:31,799
until you get to the
1152
00:53:28,280 --> 00:53:34,280
end and then uh the remaining algorithms
1153
00:53:31,799 --> 00:53:36,200
are back propagation and parameter
1154
00:53:34,280 --> 00:53:38,240
update I already talked about parameter
1155
00:53:36,200 --> 00:53:40,799
update uh using stochastic gradient
1156
00:53:38,240 --> 00:53:42,760
descent but for back propagation we then
1157
00:53:40,799 --> 00:53:45,400
process examples in Reverse topological
1158
00:53:42,760 --> 00:53:47,640
order uh calculate derivatives of
1159
00:53:45,400 --> 00:53:50,400
parameters with respect to final
1160
00:53:47,640 --> 00:53:52,319
value and so we start out with the very
1161
00:53:50,400 --> 00:53:54,200
final value usually this is your loss
1162
00:53:52,319 --> 00:53:56,200
function and then you just step
1163
00:53:54,200 --> 00:54:00,440
backwards in top ological order to
1164
00:53:56,200 --> 00:54:04,160
calculate the derivatives of all these
1165
00:54:00,440 --> 00:54:05,920
so um this is pretty simple I think a
1166
00:54:04,160 --> 00:54:08,040
lot of people may have seen this already
1167
00:54:05,920 --> 00:54:09,920
but keeping this in mind as you're
1168
00:54:08,040 --> 00:54:12,480
implementing NLP models especially
1169
00:54:09,920 --> 00:54:14,240
models that are really memory intensive
1170
00:54:12,480 --> 00:54:16,559
or things like that is pretty important
1171
00:54:14,240 --> 00:54:19,040
because if you accidentally like for
1172
00:54:16,559 --> 00:54:21,799
example calculate the same thing twice
1173
00:54:19,040 --> 00:54:23,559
or accidentally create a graph that is
1174
00:54:21,799 --> 00:54:25,720
manipulating very large tensors and
1175
00:54:23,559 --> 00:54:27,319
creating very large intermediate States
1176
00:54:25,720 --> 00:54:29,720
that can kill your memory and and cause
1177
00:54:27,319 --> 00:54:31,839
big problems so it's an important thing
1178
00:54:29,720 --> 00:54:31,839
to
1179
00:54:34,359 --> 00:54:38,880
be um cool any any questions about
1180
00:54:39,040 --> 00:54:44,440
this okay if not I will go on to the
1181
00:54:41,680 --> 00:54:45,680
next one so neural network Frameworks
1182
00:54:44,440 --> 00:54:48,920
there's several neural network
1183
00:54:45,680 --> 00:54:52,880
Frameworks but in NLP nowadays I really
1184
00:54:48,920 --> 00:54:55,079
only see two and mostly only see one um
1185
00:54:52,880 --> 00:54:57,960
so that one that almost everybody us
1186
00:54:55,079 --> 00:55:01,240
uses is pie torch um and I would
1187
00:54:57,960 --> 00:55:04,559
recommend using it unless you uh you
1188
00:55:01,240 --> 00:55:07,480
know if you're a fan of like rust or you
1189
00:55:04,559 --> 00:55:09,200
know esoteric uh not esoteric but like
1190
00:55:07,480 --> 00:55:11,960
unusual programming languages and you
1191
00:55:09,200 --> 00:55:14,720
like Beauty and things like this another
1192
00:55:11,960 --> 00:55:15,799
option might be Jacks uh so I'll explain
1193
00:55:14,720 --> 00:55:18,440
a little bit about the difference
1194
00:55:15,799 --> 00:55:19,960
between them uh and you can pick
1195
00:55:18,440 --> 00:55:23,559
accordingly
1196
00:55:19,960 --> 00:55:25,359
um first uh both of these Frameworks uh
1197
00:55:23,559 --> 00:55:26,839
are developed by big companies and they
1198
00:55:25,359 --> 00:55:28,520
have a lot of engineering support behind
1199
00:55:26,839 --> 00:55:29,720
them that's kind of an important thing
1200
00:55:28,520 --> 00:55:31,280
to think about when you're deciding
1201
00:55:29,720 --> 00:55:32,599
which framework to use because you know
1202
00:55:31,280 --> 00:55:36,000
it'll be well
1203
00:55:32,599 --> 00:55:38,039
supported um pytorch is definitely most
1204
00:55:36,000 --> 00:55:40,400
widely used in NLP especially NLP
1205
00:55:38,039 --> 00:55:44,240
research um and it's used in some NLP
1206
00:55:40,400 --> 00:55:47,359
project J is used in some NLP
1207
00:55:44,240 --> 00:55:49,960
projects um pytorch favors Dynamic
1208
00:55:47,359 --> 00:55:53,760
execution so what dynamic execution
1209
00:55:49,960 --> 00:55:55,880
means is um you basically create a
1210
00:55:53,760 --> 00:55:59,760
computation graph and and then execute
1211
00:55:55,880 --> 00:56:02,760
it uh every time you process an input uh
1212
00:55:59,760 --> 00:56:04,680
in contrast there's also you define the
1213
00:56:02,760 --> 00:56:07,200
computation graph first and then execute
1214
00:56:04,680 --> 00:56:09,280
it over and over again so in other words
1215
00:56:07,200 --> 00:56:10,680
the graph construction step only happens
1216
00:56:09,280 --> 00:56:13,119
once kind of at the beginning of
1217
00:56:10,680 --> 00:56:16,799
computation and then you compile it
1218
00:56:13,119 --> 00:56:20,039
afterwards and it's actually pytorch
1219
00:56:16,799 --> 00:56:23,359
supports kind of defining and compiling
1220
00:56:20,039 --> 00:56:27,480
and Jax supports more Dynamic things but
1221
00:56:23,359 --> 00:56:30,160
the way they were designed is uh is kind
1222
00:56:27,480 --> 00:56:32,960
of favoring Dynamic execution or
1223
00:56:30,160 --> 00:56:37,079
favoring definition in population
1224
00:56:32,960 --> 00:56:39,200
and the difference between these two is
1225
00:56:37,079 --> 00:56:41,760
this one gives you more flexibility this
1226
00:56:39,200 --> 00:56:45,440
one gives you better optimization in wor
1227
00:56:41,760 --> 00:56:49,760
speed if you want to if you want to do
1228
00:56:45,440 --> 00:56:52,400
that um another thing about Jax is um
1229
00:56:49,760 --> 00:56:55,200
it's kind of very close to numpy in a
1230
00:56:52,400 --> 00:56:57,440
way like it uses a very num something
1231
00:56:55,200 --> 00:56:59,960
that's kind of close to numpy it's very
1232
00:56:57,440 --> 00:57:02,359
heavily based on tensors and so because
1233
00:56:59,960 --> 00:57:04,640
of this you can kind of easily do some
1234
00:57:02,359 --> 00:57:06,640
interesting things like okay I want to
1235
00:57:04,640 --> 00:57:11,319
take this tensor and I want to split it
1236
00:57:06,640 --> 00:57:14,000
over two gpus um and this is good if
1237
00:57:11,319 --> 00:57:17,119
you're training like a very large model
1238
00:57:14,000 --> 00:57:20,920
and you want to put kind
1239
00:57:17,119 --> 00:57:20,920
of this part of the
1240
00:57:22,119 --> 00:57:26,520
model uh you want to put this part of
1241
00:57:24,119 --> 00:57:30,079
the model on GP 1 this on gpu2 this on
1242
00:57:26,520 --> 00:57:31,599
GPU 3 this on GPU it's slightly simpler
1243
00:57:30,079 --> 00:57:34,400
conceptually to do in Jacks but it's
1244
00:57:31,599 --> 00:57:37,160
also possible to do in
1245
00:57:34,400 --> 00:57:39,119
p and pytorch by far has the most
1246
00:57:37,160 --> 00:57:41,640
vibrant ecosystem so like as I said
1247
00:57:39,119 --> 00:57:44,200
pytorch is a good default choice but you
1248
00:57:41,640 --> 00:57:47,480
can consider using Jack if you uh if you
1249
00:57:44,200 --> 00:57:47,480
like new
1250
00:57:48,079 --> 00:57:55,480
things cool um yeah actually I already
1251
00:57:51,599 --> 00:57:58,079
talked about that so in the interest of
1252
00:57:55,480 --> 00:58:02,119
time I may not go into these very deeply
1253
00:57:58,079 --> 00:58:05,799
but it's important to note that we have
1254
00:58:02,119 --> 00:58:05,799
examples of all of
1255
00:58:06,920 --> 00:58:12,520
the models that I talked about in the
1256
00:58:09,359 --> 00:58:16,720
class today these are created for
1257
00:58:12,520 --> 00:58:17,520
Simplicity not for Speed or efficiency
1258
00:58:16,720 --> 00:58:20,480
of
1259
00:58:17,520 --> 00:58:24,920
implementation um so these are kind of
1260
00:58:20,480 --> 00:58:27,760
torch P torch based uh examples uh where
1261
00:58:24,920 --> 00:58:31,599
you can create the bag of words
1262
00:58:27,760 --> 00:58:36,440
Model A continuous bag of words
1263
00:58:31,599 --> 00:58:39,640
model um and
1264
00:58:36,440 --> 00:58:41,640
a deep continuous bag of wordss
1265
00:58:39,640 --> 00:58:44,359
model
1266
00:58:41,640 --> 00:58:46,039
and all of these I believe are
1267
00:58:44,359 --> 00:58:48,760
implemented in
1268
00:58:46,039 --> 00:58:51,960
model.py and the most important thing is
1269
00:58:48,760 --> 00:58:54,960
where you define the forward pass and
1270
00:58:51,960 --> 00:58:57,319
maybe I can just give a a simple example
1271
00:58:54,960 --> 00:58:58,200
this but here this is where you do the
1272
00:58:57,319 --> 00:59:01,839
word
1273
00:58:58,200 --> 00:59:04,400
embedding this is where you sum up all
1274
00:59:01,839 --> 00:59:08,119
of the embeddings and add a
1275
00:59:04,400 --> 00:59:10,200
bias um and then this is uh where you
1276
00:59:08,119 --> 00:59:13,960
return the the
1277
00:59:10,200 --> 00:59:13,960
score and then oh
1278
00:59:14,799 --> 00:59:19,119
sorry the continuous bag of words model
1279
00:59:17,520 --> 00:59:22,160
sums up some
1280
00:59:19,119 --> 00:59:23,640
embeddings uh or gets the embeddings
1281
00:59:22,160 --> 00:59:25,799
sums up some
1282
00:59:23,640 --> 00:59:28,079
embeddings
1283
00:59:25,799 --> 00:59:30,599
uh gets the score here and then runs it
1284
00:59:28,079 --> 00:59:33,200
through a linear or changes the view
1285
00:59:30,599 --> 00:59:35,119
runs it through a linear layer and then
1286
00:59:33,200 --> 00:59:38,319
the Deep continuous bag of words model
1287
00:59:35,119 --> 00:59:41,160
also adds a few layers of uh like linear
1288
00:59:38,319 --> 00:59:43,119
transformations in Dage so you should be
1289
00:59:41,160 --> 00:59:44,640
able to see that these correspond pretty
1290
00:59:43,119 --> 00:59:47,440
closely to the things that I had on the
1291
00:59:44,640 --> 00:59:49,280
slides so um hopefully that's a good
1292
00:59:47,440 --> 00:59:51,839
start if you're not very familiar with
1293
00:59:49,280 --> 00:59:51,839
implementing
1294
00:59:53,119 --> 00:59:58,440
model oh and yes the recitation uh will
1295
00:59:56,599 --> 00:59:59,799
be about playing around with sentence
1296
00:59:58,440 --> 01:00:01,200
piece and playing around with these so
1297
00:59:59,799 --> 01:00:02,839
if you have any look at them have any
1298
01:00:01,200 --> 01:00:05,000
questions you're welcome to show up
1299
01:00:02,839 --> 01:00:09,880
where I walk
1300
01:00:05,000 --> 01:00:09,880
through cool um any any questions about
1301
01:00:12,839 --> 01:00:19,720
these okay so a few more final important
1302
01:00:16,720 --> 01:00:21,720
Concepts um another concept that you
1303
01:00:19,720 --> 01:00:25,440
should definitely be aware of is the
1304
01:00:21,720 --> 01:00:27,280
atom Optimizer uh so there's lots of uh
1305
01:00:25,440 --> 01:00:30,559
optimizers that you could be using but
1306
01:00:27,280 --> 01:00:32,200
almost all research in NLP uses some uh
1307
01:00:30,559 --> 01:00:38,440
variety of the atom
1308
01:00:32,200 --> 01:00:40,839
Optimizer and the U the way this works
1309
01:00:38,440 --> 01:00:42,559
is it
1310
01:00:40,839 --> 01:00:45,640
optimizes
1311
01:00:42,559 --> 01:00:48,480
the um it optimizes model considering
1312
01:00:45,640 --> 01:00:49,359
the rolling average of the gradient and
1313
01:00:48,480 --> 01:00:53,160
uh
1314
01:00:49,359 --> 01:00:55,920
momentum and the way it works is here we
1315
01:00:53,160 --> 01:00:58,839
have a gradient here we have
1316
01:00:55,920 --> 01:01:04,000
momentum and what you can see is
1317
01:00:58,839 --> 01:01:06,680
happening here is we add a little bit of
1318
01:01:04,000 --> 01:01:09,200
the gradient in uh how much you add in
1319
01:01:06,680 --> 01:01:12,720
is with respect to the size of this beta
1320
01:01:09,200 --> 01:01:16,000
1 parameter and you add it into uh the
1321
01:01:12,720 --> 01:01:18,640
momentum term so this momentum term like
1322
01:01:16,000 --> 01:01:20,440
gradually increases and decreases so in
1323
01:01:18,640 --> 01:01:23,440
contrast to standard gradient percent
1324
01:01:20,440 --> 01:01:25,839
which could be
1325
01:01:23,440 --> 01:01:28,440
updating
1326
01:01:25,839 --> 01:01:31,440
uh each parameter kind of like very
1327
01:01:28,440 --> 01:01:33,359
differently on each time step this will
1328
01:01:31,440 --> 01:01:35,680
make the momentum kind of transition
1329
01:01:33,359 --> 01:01:37,240
more smoothly by taking the rolling
1330
01:01:35,680 --> 01:01:39,880
average of the
1331
01:01:37,240 --> 01:01:43,400
gradient and then the the second thing
1332
01:01:39,880 --> 01:01:47,640
is um by taking the momentum this is the
1333
01:01:43,400 --> 01:01:51,000
rolling average of the I guess gradient
1334
01:01:47,640 --> 01:01:54,440
uh variance sorry I this should be
1335
01:01:51,000 --> 01:01:58,079
variance and the reason why you need
1336
01:01:54,440 --> 01:02:01,319
need to keep track of the variance is
1337
01:01:58,079 --> 01:02:03,319
some uh some parameters will have very
1338
01:02:01,319 --> 01:02:06,559
large variance in their gradients and
1339
01:02:03,319 --> 01:02:11,480
might fluctuate very uh strongly and
1340
01:02:06,559 --> 01:02:13,039
others might have a smaller uh chain
1341
01:02:11,480 --> 01:02:15,240
variant in their gradients and not
1342
01:02:13,039 --> 01:02:18,240
fluctuate very much but we want to make
1343
01:02:15,240 --> 01:02:20,200
sure that we update the ones we still
1344
01:02:18,240 --> 01:02:22,240
update the ones that have a very small
1345
01:02:20,200 --> 01:02:25,760
uh change of their variance and the
1346
01:02:22,240 --> 01:02:27,440
reason why is kind of let's say you have
1347
01:02:25,760 --> 01:02:30,440
a
1348
01:02:27,440 --> 01:02:30,440
multi-layer
1349
01:02:32,480 --> 01:02:38,720
network
1350
01:02:34,480 --> 01:02:41,240
um or actually sorry a better
1351
01:02:38,720 --> 01:02:44,319
um a better example is like let's say we
1352
01:02:41,240 --> 01:02:47,559
have a big word embedding Matrix and
1353
01:02:44,319 --> 01:02:53,359
over here we have like really frequent
1354
01:02:47,559 --> 01:02:56,279
words and then over here we have uh
1355
01:02:53,359 --> 01:02:59,319
gradi
1356
01:02:56,279 --> 01:03:00,880
no we have like less frequent words we
1357
01:02:59,319 --> 01:03:02,799
want to make sure that all of these get
1358
01:03:00,880 --> 01:03:06,160
updated appropriately all of these get
1359
01:03:02,799 --> 01:03:08,640
like enough updates and so over here
1360
01:03:06,160 --> 01:03:10,760
this one will have lots of updates and
1361
01:03:08,640 --> 01:03:13,680
so uh kind of
1362
01:03:10,760 --> 01:03:16,599
the amount that we
1363
01:03:13,680 --> 01:03:20,039
update or the the amount that we update
1364
01:03:16,599 --> 01:03:21,799
the uh this will be relatively large
1365
01:03:20,039 --> 01:03:23,119
whereas over here this will not have
1366
01:03:21,799 --> 01:03:24,880
very many updates we'll have lots of
1367
01:03:23,119 --> 01:03:26,480
zero updates also
1368
01:03:24,880 --> 01:03:29,160
and so the amount that we update this
1369
01:03:26,480 --> 01:03:32,520
will be relatively small and so this
1370
01:03:29,160 --> 01:03:36,119
kind of squared to gradient here will uh
1371
01:03:32,520 --> 01:03:38,400
be smaller for the values over here and
1372
01:03:36,119 --> 01:03:41,359
what that allows us to do is it allows
1373
01:03:38,400 --> 01:03:44,200
us to maybe I can just go to the bottom
1374
01:03:41,359 --> 01:03:46,039
we end up uh dividing by the square root
1375
01:03:44,200 --> 01:03:47,599
of this and because we divide by the
1376
01:03:46,039 --> 01:03:51,000
square root of this if this is really
1377
01:03:47,599 --> 01:03:55,680
large like 50 and 70 and then this over
1378
01:03:51,000 --> 01:03:59,480
here is like one 0.5
1379
01:03:55,680 --> 01:04:01,920
uh or something we will be upgrading the
1380
01:03:59,480 --> 01:04:03,920
ones that have like less Square
1381
01:04:01,920 --> 01:04:06,880
gradients so it will it allows you to
1382
01:04:03,920 --> 01:04:08,760
upweight the less common gradients more
1383
01:04:06,880 --> 01:04:10,440
frequently and then there's also some
1384
01:04:08,760 --> 01:04:13,400
terms for correcting bias early in
1385
01:04:10,440 --> 01:04:16,440
training because these momentum in uh in
1386
01:04:13,400 --> 01:04:19,559
variance or momentum in squared gradient
1387
01:04:16,440 --> 01:04:23,119
terms are not going to be like well
1388
01:04:19,559 --> 01:04:24,839
calibrated yet so it prevents them from
1389
01:04:23,119 --> 01:04:28,880
going very three wire beginning of
1390
01:04:24,839 --> 01:04:30,839
training so this is uh the details of
1391
01:04:28,880 --> 01:04:33,640
this again are not like super super
1392
01:04:30,839 --> 01:04:37,359
important um another thing that I didn't
1393
01:04:33,640 --> 01:04:40,200
write on the slides is uh now in
1394
01:04:37,359 --> 01:04:43,920
Transformers it's also super common to
1395
01:04:40,200 --> 01:04:47,400
have an overall learning rate schle so
1396
01:04:43,920 --> 01:04:50,520
even um Even Adam has this uh Ada
1397
01:04:47,400 --> 01:04:53,440
learning rate parameter here and we what
1398
01:04:50,520 --> 01:04:55,240
we often do is we adjust this so we
1399
01:04:53,440 --> 01:04:57,839
start at low
1400
01:04:55,240 --> 01:04:59,640
we raise it up and then we have a Decay
1401
01:04:57,839 --> 01:05:03,039
uh at the end and exactly how much you
1402
01:04:59,640 --> 01:05:04,440
do this kind of depends on um you know
1403
01:05:03,039 --> 01:05:06,160
how big your model is how much data
1404
01:05:04,440 --> 01:05:09,160
you're tring on eventually and the
1405
01:05:06,160 --> 01:05:12,440
reason why we do this is transformers
1406
01:05:09,160 --> 01:05:13,839
are unfortunately super sensitive to
1407
01:05:12,440 --> 01:05:15,359
having a high learning rate right at the
1408
01:05:13,839 --> 01:05:16,559
very beginning so if you update them
1409
01:05:15,359 --> 01:05:17,920
with a high learning rate right at the
1410
01:05:16,559 --> 01:05:22,920
very beginning they go haywire and you
1411
01:05:17,920 --> 01:05:24,400
get a really weird model um and but you
1412
01:05:22,920 --> 01:05:26,760
want to raise it eventually so your
1413
01:05:24,400 --> 01:05:28,920
model is learning appropriately and then
1414
01:05:26,760 --> 01:05:30,400
in all stochastic gradient descent no
1415
01:05:28,920 --> 01:05:31,680
matter whether you're using atom or
1416
01:05:30,400 --> 01:05:33,400
anything else it's a good idea to
1417
01:05:31,680 --> 01:05:36,200
gradually decrease the learning rate at
1418
01:05:33,400 --> 01:05:38,119
the end to prevent the model from
1419
01:05:36,200 --> 01:05:40,480
continuing to fluctuate and getting it
1420
01:05:38,119 --> 01:05:42,760
to a stable point that gives you good
1421
01:05:40,480 --> 01:05:45,559
accuracy over a large part of data so
1422
01:05:42,760 --> 01:05:47,480
this is often included like if you look
1423
01:05:45,559 --> 01:05:51,000
at any standard Transformer training
1424
01:05:47,480 --> 01:05:53,079
recipe it will have that this so that's
1425
01:05:51,000 --> 01:05:54,799
kind of the the go-to
1426
01:05:53,079 --> 01:05:58,960
optimizer
1427
01:05:54,799 --> 01:06:01,039
um are there any questions or
1428
01:05:58,960 --> 01:06:02,599
discussion there's also tricky things
1429
01:06:01,039 --> 01:06:04,000
like cyclic learning rates where you
1430
01:06:02,599 --> 01:06:06,599
decrease the learning rate increase it
1431
01:06:04,000 --> 01:06:08,559
and stuff like that but I won't go into
1432
01:06:06,599 --> 01:06:11,000
that and don't actually use it that
1433
01:06:08,559 --> 01:06:12,760
much second thing is visualization of
1434
01:06:11,000 --> 01:06:15,400
embeddings so normally when we have word
1435
01:06:12,760 --> 01:06:19,760
embeddings usually they're kind of large
1436
01:06:15,400 --> 01:06:21,559
um and they can be like 512 or 1024
1437
01:06:19,760 --> 01:06:25,079
dimensions
1438
01:06:21,559 --> 01:06:28,720
and so one thing that we can do is we
1439
01:06:25,079 --> 01:06:31,079
can down weight them or sorry down uh
1440
01:06:28,720 --> 01:06:34,400
like reduce the dimensions or perform
1441
01:06:31,079 --> 01:06:35,880
dimensionality reduction and put them in
1442
01:06:34,400 --> 01:06:37,680
like two or three dimensions which are
1443
01:06:35,880 --> 01:06:40,200
easy for humans to
1444
01:06:37,680 --> 01:06:42,000
visualize this is an example using
1445
01:06:40,200 --> 01:06:44,839
principal component analysis which is a
1446
01:06:42,000 --> 01:06:48,279
linear Dimension reduction technique and
1447
01:06:44,839 --> 01:06:50,680
this is uh an example from 10 years ago
1448
01:06:48,279 --> 01:06:52,359
now uh one of the first major word
1449
01:06:50,680 --> 01:06:55,240
embedding papers where they demonstrated
1450
01:06:52,359 --> 01:06:57,720
that if you do this sort of linear
1451
01:06:55,240 --> 01:06:59,440
Dimension reduction uh you get actually
1452
01:06:57,720 --> 01:07:01,279
some interesting things where you can
1453
01:06:59,440 --> 01:07:03,240
draw a vector that's almost the same
1454
01:07:01,279 --> 01:07:06,400
direction between like countries and
1455
01:07:03,240 --> 01:07:09,319
their uh countries and their capitals
1456
01:07:06,400 --> 01:07:13,720
for example so this is a good thing to
1457
01:07:09,319 --> 01:07:16,559
do but actually PCA uh doesn't give
1458
01:07:13,720 --> 01:07:20,760
you in some cases PCA doesn't give you
1459
01:07:16,559 --> 01:07:22,920
super great uh visualizations sorry yeah
1460
01:07:20,760 --> 01:07:25,920
well for like if it's
1461
01:07:22,920 --> 01:07:25,920
like
1462
01:07:29,880 --> 01:07:35,039
um for things like this I think you
1463
01:07:33,119 --> 01:07:37,359
probably would still see vectors in the
1464
01:07:35,039 --> 01:07:38,760
same direction but I don't think it like
1465
01:07:37,359 --> 01:07:40,920
there's a reason why I'm introducing
1466
01:07:38,760 --> 01:07:44,279
nonlinear projections next because the
1467
01:07:40,920 --> 01:07:46,799
more standard way to do this is uh
1468
01:07:44,279 --> 01:07:50,640
nonlinear projections in in particular a
1469
01:07:46,799 --> 01:07:54,880
method called tisne and the way um they
1470
01:07:50,640 --> 01:07:56,880
do this is they try to group
1471
01:07:54,880 --> 01:07:59,000
things that are close together in high
1472
01:07:56,880 --> 01:08:01,240
dimensional space so that they're also
1473
01:07:59,000 --> 01:08:04,440
close together in low dimensional space
1474
01:08:01,240 --> 01:08:08,520
but they remove the Restriction that
1475
01:08:04,440 --> 01:08:10,799
this is uh that this is linear so this
1476
01:08:08,520 --> 01:08:15,480
is an example of just grouping together
1477
01:08:10,799 --> 01:08:18,040
some digits uh from the memus data
1478
01:08:15,480 --> 01:08:20,279
set or sorry reducing the dimension of
1479
01:08:18,040 --> 01:08:23,640
digits from the mest data
1480
01:08:20,279 --> 01:08:25,640
set according to PCA and you can see it
1481
01:08:23,640 --> 01:08:28,000
gives these kind of blobs that overlap
1482
01:08:25,640 --> 01:08:29,799
with each other and stuff like this but
1483
01:08:28,000 --> 01:08:31,679
if you do it with tney this is
1484
01:08:29,799 --> 01:08:34,799
completely unsupervised actually it's
1485
01:08:31,679 --> 01:08:37,080
not training any model for labeling the
1486
01:08:34,799 --> 01:08:39,239
labels are just used to draw the colors
1487
01:08:37,080 --> 01:08:42,520
and you can see that it gets pretty
1488
01:08:39,239 --> 01:08:44,520
coherent um clusters that correspond to
1489
01:08:42,520 --> 01:08:48,120
like what the actual digits
1490
01:08:44,520 --> 01:08:50,120
are um however uh one problem with
1491
01:08:48,120 --> 01:08:53,159
titney I I still think it's better than
1492
01:08:50,120 --> 01:08:55,000
PCA for a large number of uh
1493
01:08:53,159 --> 01:08:59,199
applications
1494
01:08:55,000 --> 01:09:01,040
but settings of tisy matter and tisy has
1495
01:08:59,199 --> 01:09:02,920
a few settings kind of the most
1496
01:09:01,040 --> 01:09:04,120
important ones are the overall
1497
01:09:02,920 --> 01:09:06,560
perplexity
1498
01:09:04,120 --> 01:09:09,040
hyperparameter and uh the number of
1499
01:09:06,560 --> 01:09:12,319
steps that you perform and there's a
1500
01:09:09,040 --> 01:09:14,920
nice example uh of a paper or kind of
1501
01:09:12,319 --> 01:09:16,359
like online post uh that demonstrates
1502
01:09:14,920 --> 01:09:18,560
how if you change these parameters you
1503
01:09:16,359 --> 01:09:22,279
can get very different things so if this
1504
01:09:18,560 --> 01:09:24,080
is the original data you run tisy and it
1505
01:09:22,279 --> 01:09:26,640
gives you very different things based on
1506
01:09:24,080 --> 01:09:29,279
the hyper parameters that you change um
1507
01:09:26,640 --> 01:09:32,880
and here's another example uh you have
1508
01:09:29,279 --> 01:09:36,960
two linear uh things like this and so
1509
01:09:32,880 --> 01:09:40,839
PCA no matter how you ran PCA you would
1510
01:09:36,960 --> 01:09:44,080
still get a linear output from this so
1511
01:09:40,839 --> 01:09:45,960
normally uh you know it might change the
1512
01:09:44,080 --> 01:09:49,239
order it might squash it a little bit or
1513
01:09:45,960 --> 01:09:51,239
something like this but um if you run
1514
01:09:49,239 --> 01:09:53,400
tisy it gives you crazy things it even
1515
01:09:51,239 --> 01:09:56,040
gives you like DNA and other stuff like
1516
01:09:53,400 --> 01:09:58,040
that so so um you do need to be a little
1517
01:09:56,040 --> 01:10:00,600
bit careful that uh this is not
1518
01:09:58,040 --> 01:10:02,320
necessarily going to tell you nice
1519
01:10:00,600 --> 01:10:04,400
linear correlations like this so like
1520
01:10:02,320 --> 01:10:06,159
let's say this correlation existed if
1521
01:10:04,400 --> 01:10:09,199
you use tisy it might not necessarily
1522
01:10:06,159 --> 01:10:09,199
come out to
1523
01:10:09,320 --> 01:10:14,880
TIY
1524
01:10:11,800 --> 01:10:16,920
cool yep uh that that's my final thing
1525
01:10:14,880 --> 01:10:18,520
actually I talked said sequence models
1526
01:10:16,920 --> 01:10:19,679
in the next class but it's in the class
1527
01:10:18,520 --> 01:10:21,440
after this I'm going to be talking about
1528
01:10:19,679 --> 01:10:24,199
language
1529
01:10:21,440 --> 01:10:27,159
modeling uh cool any any questions
1530
01:10:24,199 --> 01:10:27,159
or |