{"id":397,"date":"2025-10-01T23:26:38","date_gmt":"2025-10-02T03:26:38","guid":{"rendered":"http:\/\/stephendavies.org\/nlp\/?p=397"},"modified":"2025-10-01T23:26:38","modified_gmt":"2025-10-02T03:26:38","slug":"visualizing-embeddings","status":"publish","type":"post","link":"http:\/\/stephendavies.org\/nlp\/index.php\/2025\/10\/01\/visualizing-embeddings\/","title":{"rendered":"Visualizing embeddings"},"content":{"rendered":"<p>I&#8217;ve pushed several files to the class repo, including two programs to help you visualize the embeddings in your corpus: <tt>interact_cooccur.py<\/tt>, which we played with in class on Tuesday, and <tt>visualize_cooccur.py<\/tt>, which can produce 2-d (and even 3-d) plots like this showing the embeddings in a reduced-dimensional space:<\/p>\n<p><center><br \/>\n<a href=\"bible_embeddings.png\"><br \/>\n<img decoding=\"async\" src=\"bible_embeddings.png\" style=\"width:400px;\" \/><br \/>\n<\/a><br \/>\n<\/center><\/p>\n<p>The next homework assignment (coming soon) will have you running and configuring these programs to help you analyze your own corpus&#8217;s embeddings. Stay tuned for that.<\/p>\n<p>Also, I have posted the code we used to play around with standard pre-trained embedding collections (like word2vec and GloVe): you&#8217;ll need to first run the <tt>download_embeddings.py<\/tt> file (while connected to a good network) and then run either <tt>sim_emb_play.py<\/tt> or <tt>closest_emb_play.py<\/tt> to find the similarity of pairs of words, or the top-10 closest embeddings to a given word, respectively.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve pushed several files to the class repo, including two programs to help you visualize the embeddings in your corpus: interact_cooccur.py, which we played with in class on Tuesday, and visualize_cooccur.py, which can produce 2-d (and even 3-d) plots like this showing the embeddings in a reduced-dimensional space: The next homework assignment (coming soon) will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-397","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/posts\/397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/comments?post=397"}],"version-history":[{"count":2,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/posts\/397\/revisions"}],"predecessor-version":[{"id":399,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/posts\/397\/revisions\/399"}],"wp:attachment":[{"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/media?parent=397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/categories?post=397"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/stephendavies.org\/nlp\/index.php\/wp-json\/wp\/v2\/tags?post=397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}