{"id":326,"date":"2022-02-12T13:07:28","date_gmt":"2022-02-12T05:07:28","guid":{"rendered":"https:\/\/www.wennroy.com\/?p=326"},"modified":"2022-02-12T13:38:13","modified_gmt":"2022-02-12T05:38:13","slug":"meaning-of-a-word","status":"publish","type":"post","link":"https:\/\/wennroy.com\/index.php\/2022\/02\/12\/meaning-of-a-word\/","title":{"rendered":"Meaning of a word"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Lexical Semantics \u8bcd\u6c47\u8bed\u4e49<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What should we represent meaning of the word?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Words, lemmas, senses, definition<\/li><li>Relationships between words or senses<\/li><li>Taxonomy: abstract -&gt; concrete<\/li><li>Semantic frames and roles<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Discrete Representations<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982One-hot \u7f16\u7801\u7b49\u4e00\u7cfb\u5217\u79bb\u6563\u578b\u7f16\u7801\uff0c\u5bb9\u6613\u51fa\u73b0\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u8fc7\u4e8e\u4e3b\u89c2 Subjective<\/li><li>\u8fc7\u4e8e\u7a00\u758f Sparse<\/li><li>\u7a7a\u95f4\u6d88\u8017\u8fc7\u5927\uff0c\u5411\u91cf\u957f\u5ea6$V$\u53d6\u51b3\u4e8e\u8bcd\u6c47\u8868\u5927\u5c0f Expensive<\/li><li>\u96be\u4ee5\u89e3\u91ca\u8bcd\u4e0e\u8bcd\u4e4b\u95f4\u7684\u5173\u7cfb Hard to compute word relationships<\/li><li>Too coarse: eg: Expert &#8211; Skillful<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Distributional Hypothesis<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p>\u201cThe meaning of a word is its use in the language\u201d<\/p><cite>Wittgenstein 1943<\/cite><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><br>\u201cYou shall know a word by the company it keeps\u201d<\/p><cite>Firth 1957<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e5f\u53eb <strong>Distributional Representations<\/strong> <strong>\u5206\u5e03\u5f0f\u8868\u793a<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bcd\u5411\u91cf<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Each word = a vector<\/li><li>Similar words are &#8220;nearby in space&#8221;<\/li><li>The standard way to represent meaning in NLP<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Approaches for encoding words as vectors<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Counting-based methods (e.g., Tf-idf)<\/li><li>Matrix factorization (e.g., topic modeling)<\/li><li>Brown clusters<\/li><li>Word2Vec<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Count matrix\u53ef\u4ee5\u53d6\u5f88\u591a\u79cd\u53d6\u503c\uff0c\u4f8b\u5982tf-idf PMI(Point Mutual Information)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u524d\u4e09\u79cd\u60c5\u51b5\u89c1\u8bfe\u4ef6\uff0c\u4e0d\u4e3b\u8981\u4ecb\u7ecd\uff0c\u4e3b\u8981\u4ecb\u7ecd\u6700\u540e\u4e00\u79cd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Distributed Word Embeddings<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">CBOW (Continuous Bag of Words)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">$p(v|c)$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Similar to feedforward neural LM w\/o the feedforward layers in Lecture 3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728 <span style=\"font-size: revert;\">Mikolov<\/span>[1] \u8bba\u6587\u91cc\u63d0\u5230\u4e00\u822c\u6765\u8bf4Skip-gram\u6a21\u578b\u6548\u679c\u6bd4CBOW\u597d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Skip-gram<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">$p(c|v)$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u7684\u76ee\u6807\u51fd\u6570\u662f\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$$J(\\Theta) = -\\frac{1}{T} \\sum_{t=1}^T\\sum_{-m\\leq j\\leq m, j\\not= 0}\\log p(w_{t+j}|w_t;\\Theta)$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6982\u7387\u5bc6\u5ea6\u5229\u7528softmax\u51fd\u6570\uff0c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$$p(o|c) = \\frac{\\exp(u_0^Tv_c)}{\\sum_{i=1}^V \\exp(u_i^Tv_c) }$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Notation:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$o$ = index of outside (context) word<br>$c$ = index of center word ($w_t$)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u9636\u6bb5\u6709\u4e2a\u7f3a\u70b9\uff0c$V$\u4e3a\u8bad\u7ec3\u6837\u672c\u4e2d\u7684\u6240\u6709\u8bcd\u6c47\u7684\u6570\u91cf(vocab size, can be 50K-30M)\uff0c\u6211\u4eec\u5206\u6bcd\u7684\u70b9\u79ef\u7684\u8ba1\u7b97\u91cf\u53d8\u5f97\u7279\u522b\u7684\u5927\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/Emb1tVQ.png\" alt=\"\" width=\"531\" height=\"278\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f18\u5316\u7684\u65f6\u5019\u540e\u9762\u8fd9\u9879\u4e5f\u5f88\u96be\u8ba1\u7b97\u3002\u56e0\u6b64\u6211\u4eec\u5f15\u8fdb\u4e86\u65b0\u7684\u65b9\u6cd5\u662fNegative Sampling (\u8d1f\u91c7\u6837)\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/3QjVPM8.png\" alt=\"\" width=\"637\" height=\"380\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Goal: <\/strong>\u7528\u4e00\u4e2a\u8bcd\u9644\u8fd1\u7684\u8bcd\u6765\u63cf\u8ff0\u8be5\u8bcd\u3002\u5229\u7528\u4e2d\u5fc3\u8bcd\u6765\u627e\u5468\u56f4\u8bcd\uff0c<strong>\u4f46\u6700\u7ec8\u76ee\u6807\u662f\u5bfb\u627e\u4e00\u4e2a\u8bcd\u5411\u91cf<\/strong>\uff0c\u53ef\u80fd\u5728\u522b\u7684\u4efb\u52a1\u4e0a\u6bd4\u8f83\u597d\u7528\u3002\u4f8b\u5982\u8bcd\u5d4c\u5165(Embedding)\u53ef\u89c6\u5316\u3002\u6211\u4eec\u5f97\u5230\u7684\u5411\u91cf\u5e94\u8be5\u6ee1\u8db3\u5dee\u4e0d\u591a\u7684\u5173\u7cfb\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/x0mC2qY.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd8\u6709\u8bcd\u76f8\u4f3c\u5ea6\u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u822c\u5c06\u8bcd\u5411\u91cf\u4f5c\u4e3a\u7b2c\u4e00\u5c42\uff0c\u7136\u540e\u540e\u9762\u5c31\u53ef\u4ee5\u63a5\u5176\u4ed6\u7684\u795e\u7ecf\u7f51\u7edc\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Skip-gram with Negative Sampling<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Convert the task to binary classification rather than multiclass:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$$\\mathbb{P}(o|c) = \\frac{\\exp(u_o^Tv_c}{\\sum_{i=1}^V\\exp(u_i^Tv_c)}\\rightarrow  \\mathbb{P} (o|c) = \\frac{1}{1+\\exp(-u_o^Tv_c)} = \\sigma(u^T_ov_c)$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The new Objective function:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$$\\log \\mathbb{P}(o_+|c) + \\sum_{i=1}^k\\log(1-\\mathbb{P}(o_i|c))$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u524d\u9762\u7684\u9879\u662f\u4e00\u4e2a\u6b63\u6837\u672c\uff0c\u914d\u5957$k$\u4e2a\u8d1f\u6837\u672c\u6765\u4f18\u5316Objective Function\u3002\u8d1f\u6837\u672c\u662f\u968f\u673a\u4ece\u8bcd\u5178\u4e2d\u91c7\u6837\u5f97\u6765\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Pick negative samples according to unigram frequency<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">More common to choose according to:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$$\\mathbb P_\\alpha(w) = \\frac{count(w)^\\alpha}{\\sum_wcount(w)^\\alpha}$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$\\alpha = 0.75$ works well empirically.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/BcjS4Gf.png\" alt=\"\" width=\"765\" height=\"245\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Evaluating word vectors<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Intrinsic Evaluation:<\/strong> test whether the representations align with our intuitions about word meaning.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Extrinsic Evaluation:<\/strong> test whether the representations are useful for downtream tasks, such as tagging, parsing, QA, \u2026<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Mikolov, T. a. S., Ilya and Chen, Kai and Corrado, Greg S and Dean, Jeff (2013). Distributed Representations of Words and Phrases and their Compositionality, Curran Associates, Inc.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lexical Semantics \u8bcd\u6c47\u8bed\u4e49 Wh &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[42,43],"tags":[44],"class_list":["post-326","post","type-post","status-publish","format-standard","hentry","category-deeplearning","category-nlp","tag-nlp"],"_links":{"self":[{"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":13,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/posts\/326\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wennroy.com\/index.php\/wp-json\/wp\/v2\/tags?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}