{"id":345,"date":"2019-01-29T06:59:55","date_gmt":"2019-01-29T06:59:55","guid":{"rendered":"http:\/\/miriamposner.com\/classes\/dh201w23\/?page_id=345"},"modified":"2019-10-23T18:06:22","modified_gmt":"2019-10-23T18:06:22","slug":"visualize-your-topic-model","status":"publish","type":"page","link":"https:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/text-analysis\/visualize-your-topic-model\/","title":{"rendered":"Visualize your topic model"},"content":{"rendered":"\n<p>In&nbsp;<a href=\"http:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/text-analysis\/messing-around-with-the-topic-modeling-tool\/\">the first part of this tutorial<\/a>, we learned how to run the Topic Modeling Tool, and we began to interpret the results. In this second part of the tutorial, we&#8217;ll learn how to visualize results so they&#8217;re a little easier to understand. While we used the HTML files in the first part, we&#8217;ll turn this time to our CSVs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#open-your-tmt-results-folder\"><\/a>Open your TMT results folder<\/h2>\n\n\n\n<p>Find your&nbsp;<strong>tmt_output<\/strong>&nbsp;folder and open it. As you&#8217;ll recall, the output is presented as both CSVs and as HTML. This time, we&#8217;ll be working with the CSV files. Open the different CSVs to get a sense of the contents. You&#8217;ll notice that these documents contain the same information as the HTML files, but presented differently.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/open-your-tmt-results-folder.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/open-your-tmt-results-folder.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#open-tableau\"><\/a>Open Tableau<\/h2>\n\n\n\n<p>We&#8217;ll be working with Tableau, just as we did last week. Double-click the Tableau icon to open the program.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/open-tableau.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/open-tableau.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#load-the-topics-metadata-file-into-tableau\"><\/a>Load the topics-metadata file into Tableau<\/h2>\n\n\n\n<p>You should remember how to do this from last week: Click on&nbsp;<strong>Text file<\/strong>&nbsp;under the&nbsp;<strong>Connect<\/strong>&nbsp;heading and find the&nbsp;<strong>topics-metadata.csv<\/strong>&nbsp;file that is within your&nbsp;<strong>output_csv<\/strong>&nbsp;folder.<\/p>\n\n\n\n<p>Click on&nbsp;<strong>Sheet 1<\/strong>&nbsp;to go to the visualization canvas.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/load-the-topics-metadata-file-into-tableau.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/load-the-topics-metadata-file-into-tableau.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#make-a-stacked-bar-chart\"><\/a>Make a stacked bar chart<\/h2>\n\n\n\n<p>Each document in our folder contains multiple topics in different proportions. To get a sense of how those proportions vary across documents, we&#8217;ll make a stacked bar chart.<\/p>\n\n\n\n<p>To get there, do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Drag the dimension&nbsp;<strong>Filename<\/strong>&nbsp;into the&nbsp;<strong>Columns<\/strong>&nbsp;shelf.<\/li><li>Drag the measure&nbsp;<strong>Measure Values<\/strong>&nbsp;into the&nbsp;<strong>Rows<\/strong>&nbsp;shelf.<\/li><li>Drag the&nbsp;<strong>Measure Names<\/strong>&nbsp;dimension to the&nbsp;<strong>Color<\/strong>&nbsp;button, within the&nbsp;<strong>Marks<\/strong>&nbsp;pane, and drop it there.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/make-a-stacked-bar-chart.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/make-a-stacked-bar-chart.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#filter-out-the-document-names-from-your-bars\"><\/a>Filter out the document names from your bars<\/h2>\n\n\n\n<p>You&#8217;re almost there! But if you examine your bar chart closely, you&#8217;ll notice that half of each bar is composed of the name of the corresponding document. We don&#8217;t want that in our bars, so let&#8217;s filter those document names out.<\/p>\n\n\n\n<p>Find the&nbsp;<strong>Filters<\/strong>&nbsp;window, above the&nbsp;<strong>Marks<\/strong>&nbsp;pane. If you hover over the&nbsp;<strong>Measure Names<\/strong>&nbsp;within the Filter pane, you&#8217;ll see that you can click the down arrow to reveal a number of options for working with that dimension. From this menu, select&nbsp;<strong>Edit filter..<\/strong>.<\/p>\n\n\n\n<p>In the ensuing dialogue box, you&#8217;ll find a list of measure names, each with a checkbox beside it. Scroll until you find&nbsp;<strong>Number of Records<\/strong>, and then uncheck the box and press&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<p>Your bars should now be free of those document names.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/filter-out-the-document-names-from-your-bars.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/filter-out-the-document-names-from-your-bars.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/visualize-your-topic-model.md#examine-your-bar-chart\"><\/a>Examine your bar chart<\/h2>\n\n\n\n<p>Spend some time investigating your visualization. Which topics rise in prominence over time? Which fade? Can you correlate the presence or absence of topics with historical events?<\/p>\n\n\n\n<p>Does the rise and fall of these topics ring true to you? Where would you investigate futher, if you could? What would you do to confirm the conclusions your visualization suggests?<\/p>\n\n\n\n<p>You can also investigate each topic in isolation by using the&nbsp;<strong>Edit Filter&#8230;<\/strong>&nbsp;option within the&nbsp;<strong>Measure Names<\/strong>&nbsp;context menu and checking only that topic.<\/p>\n\n\n\n<p>Once you get here, perhaps you&#8217;d like to spend some time looking at a <a href=\"http:\/\/textvis.lnu.se\/\">bunch of ways to visualize texts<\/a>!<\/p>\n\n\n\n<p>Bonus round: Can you figure out how to make an area chart&nbsp;<a href=\"https:\/\/public.tableau.com\/views\/inaugural_speeches_area_graph\/Sheet1?:embed=y&amp;:display_count=yes&amp;publish=yes\">like this one<\/a>? Hint 1: You&#8217;ll need to edit the CSV file so that the file names are years.&nbsp;<a href=\"https:\/\/onlinehelp.tableau.com\/current\/pro\/desktop\/en-us\/qs_area_charts.htm\">Hint 2<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/blob\/master\/images\/visualize-your-topic-model\/examine-your-bar-chart.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/tmt_get_started\/raw\/master\/images\/visualize-your-topic-model\/examine-your-bar-chart.png\" alt=\"\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In&nbsp;the first part of this tutorial, we learned how to run the Topic Modeling Tool, and we began to interpret the results. In this second part of the tutorial, we&#8217;ll&hellip; <a class=\"more-link\" href=\"https:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/text-analysis\/visualize-your-topic-model\/\">Continue reading <span class=\"screen-reader-text\">Visualize your topic model<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":338,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","footnotes":""},"class_list":["post-345","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/comments?post=345"}],"version-history":[{"count":0,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/345\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/338"}],"wp:attachment":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/media?parent=345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}