{"id":446,"date":"2020-09-24T13:28:19","date_gmt":"2020-09-24T17:28:19","guid":{"rendered":"https:\/\/www.macloo.com\/ai\/?p=446"},"modified":"2020-09-24T13:28:19","modified_gmt":"2020-09-24T17:28:19","slug":"imagining-words-as-numbers-in-n-dimensional-space","status":"publish","type":"post","link":"https:\/\/www.macloo.com\/ai\/2020\/09\/24\/imagining-words-as-numbers-in-n-dimensional-space\/","title":{"rendered":"Imagining words as numbers in n-dimensional space"},"content":{"rendered":"\n<p>The <strong>vocabulary<\/strong> of a neural network is represented as <strong>vectors<\/strong> \u2014 which I <a href=\"https:\/\/www.macloo.com\/ai\/2020\/09\/23\/how-does-machine-learning-understand-sentiment\/\">wrote about yesterday<\/a>. This enables many related words to be &#8220;close to&#8221; one another, which is how the network perceives similarity and difference. This is as near as a computer comes to understanding <em>meaning<\/em> \u2014 which is not very near at all, but <em>good enough<\/em> for a lot of practical applications of natural language processing.<\/p>\n\n\n\n<p>A previous way of representing vocabulary for a neural network was to assign just one number to each word. If the neural net had a vocabulary of 20,000 words, that meant it had 20,000 separate inputs in the first layer \u2014 the input layer. (I discussed neural nets <a href=\"https:\/\/www.macloo.com\/ai\/2020\/09\/10\/what-is-a-neural-network-and-how-does-it-work\/\">in an earlier post here<\/a>.) For each word, only one input was activated. This is called &#8220;one-hot encoding.&#8221;<\/p>\n\n\n\n<p>Representing words as vectors (instead of with a single number) means that each number in the array for one word is an input for the neural net. Among the many possible inputs, <em>several<\/em> or <em>many<\/em> are &#8220;hot,&#8221; not just one.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/www.macloo.com\/ai\/wp-content\/uploads\/2020\/09\/vectors.jpg\" alt=\"\" class=\"wp-image-450\" srcset=\"https:\/\/www.macloo.com\/ai\/wp-content\/uploads\/2020\/09\/vectors.jpg 1024w, https:\/\/www.macloo.com\/ai\/wp-content\/uploads\/2020\/09\/vectors-300x225.jpg 300w, https:\/\/www.macloo.com\/ai\/wp-content\/uploads\/2020\/09\/vectors-768x576.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><em>Photo by <a href=\"https:\/\/unsplash.com\/@newmanphotog?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noreferrer noopener\">Timothy Newman<\/a> on <a href=\"https:\/\/unsplash.com\/s\/photos\/smoke-trails?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noreferrer noopener\">Unsplash<\/a><\/em><\/figcaption><\/figure>\n\n\n\n<p>As I was sorting this in my mind today, reading and thinking, I had to think about how to convey to my students (who might have no computer science background at all) this idea of words. The word itself doesn&#8217;t exist. The word is <em>represented<\/em> in the system as a list of numbers. The numbers have meaning; they locate the the word-object in a mathematical space, for which computers are ideally suited. But there is no word.<\/p>\n\n\n\n<p>Long ago in school I learned about the <em>signifier<\/em> and the <em>signified<\/em>. Together, they create a <em>sign<\/em>. Language is our way of representing the world in speech and in writing. The word is not the thing itself; the map is not the territory. And here we are, building a representation of human language in code, where a vocabulary of tens of thousands of human words exists in an imaginary space consisting of numbers \u2014 because numbers are the only things a computer can use.<\/p>\n\n\n\n<p>I had a much easier time understanding the concepts of image recognition than I am having with NLP.<\/p>\n\n\n\n<p><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/4.0\/\"><img decoding=\"async\" alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https:\/\/i.creativecommons.org\/l\/by-nc-nd\/4.0\/88x31.png\"><\/a><br>\n<small><span xmlns:dct=\"http:\/\/purl.org\/dc\/terms\/\" property=\"dct:title\"><strong>AI in Media and Society<\/strong><\/span> by <span xmlns:cc=\"http:\/\/creativecommons.org\/ns#\" property=\"cc:attributionName\">Mindy McAdams<\/span> is licensed under a <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/4.0\/\">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License<\/a>.<br>\nInclude the author&#8217;s name (Mindy McAdams) and a link to the original post in any reuse of this content.<\/small><\/p>\n\n\n\n<p>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The vocabulary of a neural network is represented as vectors \u2014 which I wrote about yesterday. This enables many related words to be &#8220;close to&#8221; one another, which is how the network perceives similarity and difference. This is as near as a computer comes to understanding meaning \u2014 which is not very near at all,&hellip; <a class=\"more-link\" href=\"https:\/\/www.macloo.com\/ai\/2020\/09\/24\/imagining-words-as-numbers-in-n-dimensional-space\/\">Continue reading <span class=\"screen-reader-text\">Imagining words as numbers in n-dimensional space<\/span> <span class=\"meta-nav\" aria-hidden=\"true\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[93,91],"class_list":["post-446","post","type-post","status-publish","format-standard","hentry","category-nlp","tag-vectors","tag-words"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/posts\/446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/comments?post=446"}],"version-history":[{"count":6,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/posts\/446\/revisions"}],"predecessor-version":[{"id":453,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/posts\/446\/revisions\/453"}],"wp:attachment":[{"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/media?parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/categories?post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.macloo.com\/ai\/wp-json\/wp\/v2\/tags?post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}