<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[FILWD: Vis for ML]]></title><description><![CDATA[A series on Data Visualization for Machine Learning]]></description><link>https://filwd.substack.com/s/vis-for-ml</link><image><url>https://substackcdn.com/image/fetch/$s_!d6yB!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fffb9a4cf-c54f-4c34-b318-28f5a385efe2_273x273.png</url><title>FILWD: Vis for ML</title><link>https://filwd.substack.com/s/vis-for-ml</link></image><generator>Substack</generator><lastBuildDate>Sat, 25 Jul 2026 05:59:15 GMT</lastBuildDate><atom:link href="https://filwd.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Enrico Bertini]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[filwd@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[filwd@substack.com]]></itunes:email><itunes:name><![CDATA[Enrico Bertini]]></itunes:name></itunes:owner><itunes:author><![CDATA[Enrico Bertini]]></itunes:author><googleplay:owner><![CDATA[filwd@substack.com]]></googleplay:owner><googleplay:email><![CDATA[filwd@substack.com]]></googleplay:email><googleplay:author><![CDATA[Enrico Bertini]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[VisML #5: Beyond Input and Output: Introducing Model Explanations]]></title><description><![CDATA[Short overview of some basic methods to understand how machine learning models do what they do]]></description><link>https://filwd.substack.com/p/visml-5-beyond-input-and-output-introducing</link><guid isPermaLink="false">https://filwd.substack.com/p/visml-5-beyond-input-and-output-introducing</guid><dc:creator><![CDATA[Enrico Bertini]]></dc:creator><pubDate>Mon, 24 Jun 2024 03:27:56 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!nhwa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this section of the <a href="https://filwd.substack.com/s/vis-for-ml">series on Visualization for Machine Learning</a>, we focus on model explanations. Model explanations are a class of ML methods that extract information from models to derive information about the logic they use to produce their predictions. For example, many explanation methods produce &#8220;feature weights,&#8221; numbered scores associated with the features that provide information about how relevant a feature is for a given decision and how it relates to the output (i.e., if its influence on the output leads to higher or lower values). While the approaches we covered earlier based on data provide information about &#8220;what&#8221; the model does, explanations aim to provide information about &#8220;how&#8221; models make their decisions.</p><p>Let&#8217;s explore a specific example to clarify this idea. Below, you can see an explanation taken from the SHAP library, one of the most popular explanation methods. The model tries to predict median house value for California districts based on a number of features describing the district, such as median income, location (longitude and latitude), average number of rooms, etc.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nhwa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nhwa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 424w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 848w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 1272w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nhwa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png" width="416" height="286" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:800,&quot;resizeWidth&quot;:416,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nhwa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 424w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 848w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 1272w, https://substackcdn.com/image/fetch/$s_!nhwa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bf58fca-9be8-43fc-8bbf-5425efdf73e2_800x550.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For an individual district like the one depicted above, the explanation returns a ranked list of features with attached values that &#8220;explain&#8221; the effect they have on the output. A positive effect means the feature &#8220;pushes&#8221; the output towards higher values. Conversely, a negative effect pushes the output towards a lower value. </p><p>Explanations come in many shapes and forms and are constantly being developed. This area of research has been so active in recent years that it&#8217;s hard to organize the existing techniques into a coherent framework. Since research is so active, it&#8217;s entirely possible that new approaches will be developed sometime soon.</p><p>In this introductory post, I focus on providing a big picture of some of the most common techniques without delving too deep into the data visualization problems. In future posts, I will explore the visualization part more fully.</p><p>When we talk about explanations, we need to consider two separate aspects: the explanation&nbsp;<strong>type</strong>&nbsp;and the&nbsp;<strong>scope</strong>. Type pertains to the information extracted from the model and its form. Scope pertains to whether the explanations refer to individual decisions, subgroups, or the whole model.</p><h2><strong>Explanation Types</strong></h2><p>I like to group explanations into three broad types:&nbsp;<strong>feature weights</strong>,&nbsp;<strong>counterfactuals</strong>, and&nbsp;<strong>rules and trees</strong>. This categorization does not cover all possible methods, but it covers the most common ones.</p><h3>Feature Weights</h3><p>Features weights are numeric scores associated with each feature the model uses from the input to make a decision. The weights can be positive or negative, and their absolute value represents how much influence a feature has on the output. The image above, which I&#8217;ve described before, is an example of this type of explanation.</p><p>One way to think about weights is that they push the output in a given direction (positive or negative) with respect to the average output of the model and with a strength proportional to their amount. So, when we see a big positive weight and a high output value, we can attribute that value to that weight. This is a sort of simplistic mental model, but it&#8217;s good enough as a first approximation. As I mentioned in previous posts, features can be quantities or categories in a table but also individual pixels in an image or words in a text, and for these situations, the mental model breaks down a little. Another way to think about feature weights is as a kind of &#8220;emphasis.&#8221; If you want to understand the output, look at those features.</p><p>A special case of feature weights is a &#8220;saliency map.&#8221; Saliency maps are used with images to highlight regions of an image that are discriminative for the model to make decisions. Technically, they are often just the same feature weight mechanisms used for other data types (e.g., you can use general-purpose methods like SHAP or LIME to create saliency maps), but there are also some specialized ones designed specifically for image data.</p><p>The image below shows an example, once again, based on the same SHAP method I mentioned above.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tDK0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tDK0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 424w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 848w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 1272w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tDK0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png" width="314" height="303.77198697068405" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:594,&quot;width&quot;:614,&quot;resizeWidth&quot;:314,&quot;bytes&quot;:453036,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tDK0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 424w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 848w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 1272w, https://substackcdn.com/image/fetch/$s_!tDK0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe955317-32a8-4873-bce3-2bdc27b1b43e_614x594.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here, the features are individual pixels, and the red areas make the probability of the image being the animal on the left more likely. Similarly, the blue areas make that output less likely.</p><h3>Counterfactuals</h3><p>Another explanation method commonly used is counterfactual explanations. A counterfactual explanation of a single instance is the minimal set of changes one has to apply in order to change the output of the model. For example, imagine a bank's model to decide whether a customer should be given a loan. If the model predicts that the customer should not be given a loan, a counterfactual explanation provides information about what kind of changes would change the prediction from denied to accepted (there are a lot of ethical issues with this kind of decision that I am not going to discuss here). The image below shows an example (taken from a <a href="https://arxiv.org/abs/2003.02428">paper</a> we published a while back).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4i8i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4i8i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 424w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 848w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 1272w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4i8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png" width="646" height="280.8695652173913" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1380,&quot;resizeWidth&quot;:646,&quot;bytes&quot;:570165,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4i8i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 424w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 848w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 1272w, https://substackcdn.com/image/fetch/$s_!4i8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2a51f3a-5500-47ac-a538-6588c29083f0_1380x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The green arrows represent the changes necessary to flip the outcome from the current prediction to a different one.</p><p>While feature weights give information about which features drive the decisions, counterfactual explanations give information about what (minimal set of) changes produce a different outcome.</p><h3>Rules and Trees</h3><p>Rules and trees provide explanations in the form of logical structures such as &#8220;IF X is true and Y is true, THEN the predicted outcome is A.&#8221; The biggest advantage of this form of explanation is its highly interpretable format. Their meaning is self-explanatory: when the logical predicates of the antecedent part of the rule (X and Y) are true, then the consequent part is true (with a given probability and amount of confidence - two quantities that are often associated with rules). Trees are very similar except that they organize the predicates into branches of a tree. The figure below makes the concept easier to grasp.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aYFp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aYFp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 424w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 848w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 1272w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aYFp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png" width="450" height="290.75342465753425" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:566,&quot;width&quot;:876,&quot;resizeWidth&quot;:450,&quot;bytes&quot;:172170,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aYFp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 424w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 848w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 1272w, https://substackcdn.com/image/fetch/$s_!aYFp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91eac00b-125c-4cf9-a55e-3219791f2268_876x566.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each node is a logical predicate, and each path from the root to a leaf node represents a rule. A rule is made of the predicates crossed in the path as antecedents and the outcomes of the leaves as consequents.</p><p>These logic structures work much better to describe the behavior of the entire model or parts of its input space rather than individual instances, although a rule can be used to explain a single instance by picking the rule (or multiple rules) that cover that instance.</p><h2><strong>Explanation Scope (Global, Local, or Subgroups)</strong></h2><p>One relevant aspect of explanations is at what level of granularity they operate. Some types of explanations are designed to provide information about individual instances, whereas others are designed to provide information about the whole model. For example, SHAP produces information at the level of individual instances, whereas surrogate rules and trees normally describe subsets of the input space or even the whole model.</p><p>This is particularly relevant for our purposes because different visualization approaches are necessary for entities representing individual instances versus whole models. As a general rule, any method focusing on individual instances will need a way to navigate the space of instances to decide which one to inspect. Common interaction and visualization strategies here include (visual) query languages (e.g., dynamic filters), visualization techniques to explore large sets of instances, and ways to aggregate the data to generate higher-level patterns. This is all a bit vague at this stage, but I will clarify it in future posts. For now, take this as a preview of what is possible to do in this space.</p><p>For methods that capture information about subsets or even the whole model, the data visualization challenge is typically more about visualizing the structures generated by the methods (e.g., how to visualize rules and decision trees) and navigating these data structures when they become large and complex. This is also a preview of something I will describe in more detail in a future post. For now, it suffices to know what kind of visualization challenges exist in this space.</p><h2><strong>Analytical Questions</strong></h2><p>When considering these classes of methods, it&#8217;s important to keep in mind that they tend to help answer different types of questions and are often complementary. I insist on knowing what type of questions one can answer because this aspect is often overlooked, and I think it&#8217;s crucial when deciding what method to use. The methods I outlined above answer these main questions.</p><ul><li><p><strong>Feature weights:</strong>&nbsp;&#8220;What features drive this specific decision? Does this feature make this outcome more or less likely?&#8221;</p></li><li><p><strong>Counterfactual:</strong>&nbsp;&#8220;How can I change the values of this instance to obtain a different outcome?&#8221;</p></li><li><p><strong>Rules and tree:</strong>&nbsp;&#8220;What is the overall logic of the model? What features and values lead to specific types of outcomes?&#8221;</p></li></ul><p>In reality, these methods can answer more questions. For example, when one aggregates feature weights from individual instances, it is possible to infer something about the whole model or parts of it. With rules and trees, it is also possible to focus on error analysis and look for specific subsets where the error rate is higher than expected.</p><h2><strong>Limitations and Misinterpretations</strong></h2><p>I want to conclude this post with a warning. Model explanations are models of models, and as such, they are not perfect! There are many ways in which model explanations can lead people to make incorrect inferences; therefore, it is very important to 1) understand what one can and cannot infer from the output of these methods and 2) remain vigilant and always verify the correctness of the information extracted.</p><p>A group of Microsoft Research researchers ran a very relevant study in 2020 to study how data scientists use some of these methods, and their findings are quite alarming.&nbsp;</p><p>Kaur, Harmanpreet, et al. "<a href="https://www.jennwv.com/papers/interp-ds.pdf">Interpreting interpretability: understanding data scientists' use of interpretability tools for machine learning.</a>" <em>Proceedings of the 2020 CHI conference on human factors in computing systems</em>. 2020.</p><p>Despite the fact that they analyzed results from people who are experienced with machine learning, they found that these methods are often misused. This means that when using these methods, it is important to be extra careful in deriving correct interpretations of their results, especially when visualization is involved.</p>]]></content:encoded></item><item><title><![CDATA[VisML #4: Visualizing Input-Output ML Data]]></title><description><![CDATA[We look at ML models as black-boxes and explore what we can learn by visualizing their input and output data.]]></description><link>https://filwd.substack.com/p/visml-4-visualizing-input-output</link><guid isPermaLink="false">https://filwd.substack.com/p/visml-4-visualizing-input-output</guid><dc:creator><![CDATA[Enrico Bertini]]></dc:creator><pubDate>Sat, 11 May 2024 13:08:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>This is Post #4 of my series on Visualization for Machine Learning. You can find the other articles in the <a href="https://filwd.substack.com/s/vis-for-ml">Vis for ML section</a> (now we have a whole section for the series!). In this post, we focus on how to visualize model behavior by looking at the data it receives as an input and produces as an output, that is, by treating the model as a &#8220;black box.&#8221; As always, your comments are very welcome. I am eager to learn how this can be improved and whether you find it useful. If you like what I am writing subscribe to the newsletter and let other people know!</em></p><div><hr></div><p>In my previous post of the series, I provided a broad-brush description of what kind of data is available in ML and how visualization can help extract useful information from it. In this post, I will focus on the first class of data sources I mentioned in the post, which is input-output data. In exploring visualization solutions in this area, I will mostly first focus on tabular data, that is, classic data sets with instances in rows and attributes in columns. Narrowing down the focus to this type of data will make it easier to describe the methods and the variations around the methods. At the end of this post, I will discuss ways in which the techniques I describe may extend or be adapted to other data types and highlight possible challenges we will need to overcome in the future to achieve that goal. The post is organized as follows: First, we cover what type of data we have with ML models. Second, we cover data visualization techniques for different data configurations.  Third, we clarify what type of questions one may or may not be able to answer with these methods. Fourth, in the final part, we cover open issues and challenges. Enjoy the reading!</p><h2>Model Data</h2><p>When we observe models from the perspective of input and output we can identify the following primary sources of information:</p><ul><li><p><strong>Data features and values.</strong>&nbsp;This is just the data used to train and test the model and the data that the model will eventually receive when used to make the actual prediction in production. If we focus exclusively on tabular data, the features are just nominal, ordinal, or quantitative variables with their associated value domains. For example, a customer data set may have demographic and behavioral data like age, region of residence, years the person has been a customer, visit frequency, etc.</p></li><li><p><strong>Model output (classes, scores, quantities).</strong>&nbsp;This is the output generated by the model when receiving a specific input (often called a &#8220;prediction&#8221; even if it does not have to be about predicting a future event). There are many possible types of outputs; here we will first focus on two basic types, classes and quantities. Classes (nominal or ordinal values) are the output of classifiers, and quantities are the output of regressors. One additional element to consider is the model scores many classifiers use to produce a specific class as an output. Many classifiers do not directly provide a specific predicted class as an output but a set of scores for each class that determine the predicted likelihood of a class. This is important because many data visualizations use these scores directly rather than the predicted class.</p></li><li><p><strong>Ground truth (and errors).</strong>&nbsp;Most machine learning models are trained using data that record past outputs so that the model can learn to mimic predictions in the future. For this reason, in ML, we often have data sets with &#8220;ground truth,&#8221; that is, the prediction the model should be able to mimic if it has learned to make predictions correctly. As you can imagine this piece of information is essential because it&#8217;s the one that allows us to discriminate between correct and incorrect predictions. In practice, this means that for each element in the data table (when we use training or test data), we have two fundamental values, the model prediction and the correct actual value. The difference between these two is essential to understanding where and when the model makes mistakes.</p></li></ul><p>In addition to these primary sources, we have to also consider what kind of data we can&nbsp;<strong>derive</strong>&nbsp;from these sources. In other words, how can we transform these primary sources to generate useful information that derives from them? We will consider two main types of transformations: transformations of data features and values and transformations of model output. As we will see later on, transformations of the data input are essential to focus on specific aspects of the data and the model. In particular, the data input can be processed to derive the following structures:</p><ul><li><p><strong>Data cubes:</strong>&nbsp;Groups of data formed by segmenting the data according to the values of one or more attributes.</p></li><li><p><strong>Data clusters:</strong>&nbsp;Groups of data formed by using a clustering algorithm that groups data items according to a similarity function.</p></li><li><p><strong>Data embeddings:</strong>&nbsp;Projection of the data into a low-dimensional space characterized by (typically) 2 or 3 axes that capture the main structure and variation of the data.</p></li></ul><p>One final characterization we need is to distinguish between training, test, and production data and also between (output) data coming from different models. These distinctions are important because visualization tools can support the comparison of these different data sources.</p><h2><strong>Visualization Techniques</strong></h2><p>When we look at these characteristics we can start reasoning about what kind of visualizations one could build and for what purpose. We have two main classes of visualizations.</p><h3>Visualizations that focus on model output (error analysis)</h3><p>These visualizations focus exclusively on model output and the errors the model generates. Before focusing on visual representations, it&#8217;s important to characterize even further what kind of output and errors are possible because these affect what kind of visualization techniques are available for error analysis.</p><p>One way to look at this is to identify what kind of information we can gather from the output generated by individual instances. We have three possible cases according to what is predicted and what is the ground truth:</p><ul><li><p>Predicted&nbsp;<em>class</em>&nbsp;+ ground truth&nbsp;<em>class</em></p></li><li><p>Predicted&nbsp;<em>score(s)</em>&nbsp;+ ground truth&nbsp;<em>class</em></p></li><li><p>Predicted&nbsp;<em>quantity</em>&nbsp;+ ground truth&nbsp;<em>quantity</em></p></li></ul><h4>Data and error distributions</h4><p>The simplest analysis is to look at how output and errors are distributed. How many data points are there in each class/value? How many errors are there in each one?</p><p>When the output is a single class or value, bar charts and histograms (or density plots) are the best representations for these simple cases. A bar chart can show the number of data points in each class and the number of errors (a stacked bar chart can do that). A histogram or density plot can do the same when the output of a model is a quantity. If one wants to look at specific instances rather than aggregate values, the strategy used in Model Tracker is a possible solution. The data items are arranged along the horizontal axis according to their model score. If the model output is discrete, a dot plot or any of the many variants of strip plots can be used for the same purpose.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ndpr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ndpr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 424w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 848w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 1272w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ndpr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png" width="1456" height="376" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:376,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ndpr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 424w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 848w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 1272w, https://substackcdn.com/image/fetch/$s_!Ndpr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b13926b-cb07-4961-b949-0a770d441ae5_2008x518.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Visualization technique used in Model Tracker, a data visualization tool developed by researchers at Microsoft Research.</figcaption></figure></div><p>One trickier case is when we want to visualize the quantitative scores generated by a classifier to decide which class is the most probable. In this case, the output is not just one single value but a multidimensional value. For this situation, multidimensional visualization techniques such as <em>parallel coordinates</em>, <em>scatter plot matrices</em>, and <em>multidimensional glyphs</em> can be used to visualize model output. The image below shows the Squares tool, which employs a bespoke version of parallel coordinates that enables the analysis of model output for this specific case.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ciNC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ciNC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 424w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 848w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 1272w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ciNC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png" width="1456" height="380" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:380,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ciNC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 424w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 848w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 1272w, https://substackcdn.com/image/fetch/$s_!ciNC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805eb51a-0c3a-4794-a65e-09dcdf655353_2048x535.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Visualization technique based on parallel coordinates and implemented in a tool called Squares. Squares was developed by researchers at Microsoft Research.</figcaption></figure></div><h4>Actual vs. predicted comparison</h4><p>Another type of analysis one can do is to look at how the actual and predicted outcomes compare. When the model is a classifier, the output is a matrix of values with actual values in rows and predicted values in columns (or vice-versa). This kind of matrix is commonly called a &#8220;confusion matrix&#8221; and can be easily visualized as a matrix visualization. When the model is a regressor, one can do the same type of analysis by either binning the values and using the confusion matrix strategy or simply using a scatter plot, with one axis for the actual and one for the predicted values. A useful variant for this last case is a residual plot where instead of visualizing the predicted values, one visualizes the distance between the predicted and actual values.</p><p>One complication for confusion matrices is the very high number of classes. In that case, the matrix may not scale very well, and additional strategies are needed to make it more effective. A good example is <a href="https://arxiv.org/pdf/1710.06501">Blocks</a>, a visualization system developed to address this specific case. In Blocks, the hierarchical nature of the classes is used to group rows and columns together. The tool also employs matrix sorting strategies to make it easier to detect trends in how the model confuses certain groups of classes with others.</p><h3>Visualizations that relate input and output (inferred logic and subset analysis)</h3><p>The analysis of model data can also focus on the relationship that exists between input and output data. Relating input to output permits us to learn more about how the model behaves in specific conditions other than what type of errors it makes. The existing methods can be grouped according to three types of data organizations.</p><h4>Feature-outcome plots</h4><p>The most basic relationship we can inspect is the one between feature values and model outcomes. Depending on what types of features and outcomes one inspects, we can have different types of data arrangements and associated visualizations. In general, we have all the possible combinations between nominal, ordinal, and quantitative features and outcomes, therefore a total of nine types of relationships. But if we collapse nominal and ordinal together (by just remembering to keep the order of categories intact) we have only four possible combinations by matching quantitative/categorical input and quantitative/categorical output. To visualize these data it is sufficient to use a set of standard plots (my favorites!):</p><ul><li><p>Quantitative input + quantitative output:  Scatter plots</p></li><li><p>Categorical input + quantitative output: Dot plots or bar charts (not scaling well)</p></li><li><p>Quantitative input + categorical output: Stacked area chart (or?)</p></li><li><p>Categorical input + categorical output: Stacked bar charts or heatmaps/matrices</p></li></ul><p>Visualizing these data, however, is more complex than it seems because there are several possible complications. The first one is that we often want to distinguish between <em>correct</em> and <em>incorrect</em> predictions, therefore all the plots above need to accommodate a comparison between these two sets. The second complication is that categorical inputs or outputs can have a high number of categories. When this happens some of the visualization techniques outlined above do not scale well. More specifically, bar charts, stacked area charts, stacked bar charts, and (to a lesser extent) heatmaps/matrices do not scale well when they have to accommodate a high number of categories. I will devote a separate post to this problem, but for now, it is important to be aware of the fact that this problem exists and is very concrete because many real-world data sets can have features and outcomes with a high number of categories.</p><p>A special case of input-output plots is PDP plots. These plots are built through a two-step procedure. In the first step, each data point is modified by changing the value of the feature being plotted (in a range between the domain&#8217;s minimum and maximum value) and the output of the model with the modified data point is recorded. In the second step, all the values are aggregated to generate a mean model response for a given value of the input feature. The result is one plot for each feature that depicts the relationship between input and output with a line chart. The image below shows an example with a tool called <a href="https://pdpilot.readthedocs.io/en/latest/">PDPilot</a> which we developed in our lab (this is also Daniel&#8217;s work).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G8_H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G8_H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 424w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 848w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 1272w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G8_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png" width="630" height="504.21319796954316" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:946,&quot;width&quot;:1182,&quot;resizeWidth&quot;:630,&quot;bytes&quot;:408492,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!G8_H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 424w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 848w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 1272w, https://substackcdn.com/image/fetch/$s_!G8_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff729a82-a246-416c-9aaf-8acc17c0eeb8_1182x946.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Visualization coming from PDPilot, a data visualization tool to explore model behavior through Partial Dependence and Individual Conditional Expectation plots. The tool was developed by Daniel Kerrigan in my lab.</figcaption></figure></div><p>Each plot in this grid represents one of the features in the data set, and the black lines show the relationship between input and output calculated with the partial dependence plot procedure (the green lines represent the individual data points with the extrapolation across the feature value range described above).</p><h4>Data cubes and clusters</h4><p>When you combine multiple features at once, you obtain what is called a &#8220;data cube&#8221; in databases. The idea is that the data space can be partitioned into a data cube if we split the space according to the values of three data attributes. Imagine a data set with demographic data. The data space can be partitioned into small cells if we use the combinations of values of age, gender, and state. The same idea can be extended to combinations of any number of data features. This is relevant in our context because analyzing the behavior of a model in data cubes can be insightful. Imagine, for instance, if our goal is to find data subsets where model performance degrades considerably. Imagine a situation with a customer data set where the model's overall accuracy is high but much lower with a specific subpopulation of interest. That&#8217;s certainly something that can be a reason for concern. This is exactly the problem addressed in a 2019 paper titled &#8220;<a href="https://www.researchgate.net/profile/Yeounoh-Chung/publication/326459300_Slice_Finder_Automated_Data_Sclicing_for_Model_Validation/links/5b8d9daa92851c6b7eba7bf6/Slice-Finder-Automated-Data-Sclicing-for-Model-Validation.pdf">Slice finder: Automated data slicing for model validation</a>,<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>&#8221; which introduces an algorithm to look for such subpopulations where performance degrades. A more visualization-oriented approach can address the same problem by creating visualizations that partition the data space according to selected data features. I can count at least three papers where this approach is used (SliceLens was developed in our lab by my student <a href="https://dankerrigan.me/">Daniel Kerrigan</a>):</p><ul><li><p><a href="https://minsuk.com/papers/kahng-mlcube-hilda16.pdf">Visual exploration of machine learning results using data cube analysis</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>.</p></li><li><p><a href="https://scholar.archive.org/work/33wka4pj2vbeldyl3sp3q62cze/access/wayback/https://ieeexplore.ieee.org/ielx7/2945/8911289/08807255.pdf">The what-if tool: Interactive probing of machine learning models</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>.</p></li><li><p><a href="https://github.com/nyuvis/SliceLens">SliceLens: Guided Exploration of Machine Learning Datasets</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a>.</p></li></ul><p>Here is an image from the What-If tool developed by Google, which includes visualization to carry out this type of analysis.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nKiL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nKiL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 424w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 848w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 1272w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nKiL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png" width="1456" height="875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:875,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1597838,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nKiL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 424w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 848w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 1272w, https://substackcdn.com/image/fetch/$s_!nKiL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5088a736-d7b2-40d7-afac-481c2f3dac16_1494x898.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This is an example of data cube/subset analysis implemented in the What-If tool, a data visualization system developed by Google researchers to explore and validate model data.</figcaption></figure></div><p>The data cubes approach is one of many ways to build subgroups from data. Another approach is to use clustering algorithms that group data according to a similarity function. These algorithms analyze the data and produce groups in which the data points tend to be similar according to the definition of similarity used in the similarity function. This is sometimes useful when we look for ways to group the data and want to use something other than a specific set of features to create data cubes. Once the clustering method returns the groups, one can perform the same type of analysis used for data cubes, which is mostly about inspecting and comparing model performance within and between groups.</p><h4>Embeddings</h4><p>One final option is to visualize data through &#8220;embeddings.&#8221; An embedding is obtained by transforming the input space into a new space that &#8220;describes&#8221; the data with a reduced number of synthetic features. Dimensionality reduction methods permit the creation of such embeddings. They they the original data set as an input and produce a user-defined set of new axes (features) one can use to project the data in 2D or 3D space. An example here will be more evocative than many words. In the image below you can see an example of embedding with the classic MNIST data set.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G8DF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G8DF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 424w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 848w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 1272w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G8DF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png" width="454" height="425.625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:768,&quot;resizeWidth&quot;:454,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;TensorBoard Embeddings, Visualization and Configuration&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="TensorBoard Embeddings, Visualization and Configuration" title="TensorBoard Embeddings, Visualization and Configuration" srcset="https://substackcdn.com/image/fetch/$s_!G8DF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 424w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 848w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 1272w, https://substackcdn.com/image/fetch/$s_!G8DF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ea62333-75d5-4244-a09b-78d8ce73699d_768x720.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Example of embedding visualization applied to machine learning data. Here the classic MNIST data set is projected using a projection method. As on can see the embedding preserves the data structure and also points to potentially confusing regions of the data space.</figcaption></figure></div><p>The method receives the pixel values of each image as an input and produces two or three axes to project the data in a point cloud visualization. As you can see the method preserves most of the structure. Interestingly, the visualization also helps detect potentially critical cases. Do you see the red squares in a cloud of green or cyan squares? This is where embeddings can be useful. They can help detect edge cases and areas of the input space where a model might have difficulties in making predictions. These methods can be used with the input data exclusively, even before the data are used to train a model, but they can also be used to see how the model makes decisions in this space and how errors are distributed. For example, a region where errors concentrate could be a hint that the model needs adjustments specific to the set of data points that lie in that region.</p><h2>What can we learn from these visualizations?</h2><p>Now that you have a full picture of what information and corresponding visualizations are available it is important to take a step back and reflect on what can and cannot be learned from analyzing models with these techniques.</p><p>Visualizations that focus exclusively on model output can answer questions regarding how (training, test, and production) data and errors are distributed across the output space. For example, these methods can help identify predictions that are particularly problematic, either because items of one class are often confused with others or because certain quantities are harder to estimate. In turn, this information can lead to different actions according to what the source of the problem is. In some cases, problems can stem from inaccurate labeling of the data or extreme outliers. In other cases, one may realize that the model does not have enough training data to learn to make a specific kind of prediction.</p><p>Visualizations that focus on input and output carry additional information that relates the input and the output space. For example, it is possible to learn that errors concentrate in a specific subpopulation of interest or that model output tends to have a specific relationship with model output. This is where ML visualizations can be helpful in testing the mental model of the user and identifying model behaviors that are counterintuitive or do not make sense. This is also where users can start drawing hypotheses about what cases are problematic for the model and produce additional testing (maybe with synthetic data) to see if the model makes systematic mistakes. </p><p>This second class of visualizations is characterized by the fact they help users draw inferences about model behavior and logic. What one needs to keep in mind, however, is that inferences made from data could always be inaccurate or even wrong, therefore further testing of the hypotheses and mental models generated from using these data visualizations is necessary.</p><h2>Open issues and challenges</h2><p>The techniques I described do not cover all possible situations, and they can easily break down when applied to more complex situations. One problem I already mentioned is <strong>scalability</strong>. When the number of classes or data items to show is too high, visualizations can easily reach a visual scalability limit.</p><p>Another big issue is how to analyze model data with other data types. In the beginning, I mentioned that all these methods apply to cases where the data handled by the model is tabular data, <strong>do these techniques work with other data types?</strong> It depends. The techniques that focus on model output can be applied to any other case where the output is a class or a quantity. However, some models have different or more complex types of outputs. For example, time series forecasting has a whole time series as an output. Machine learning methods that produce ranked lists have a whole ranking as an output. Some models also produce a probability and an associated level of uncertainty. All in all, we can&#8217;t assume that models produce only these simple outputs we covered and specific adaptations are needed to cover other cases.</p><p>The problem becomes even more complicated when we consider methods that associate the input and the output space. This is where the nature of the data can make a big difference because we can no longer treat data as a collection of features and associated values. Images, videos, text, time series, etc., all have completely different structures. Embedding can be used seamlessly if one has a way to calculate a distance function between the data objects but the analysis based on features does not apply easily. Similarly, the data cubes analysis may or may not apply depending on the nature of the data (image metadata can be used for data cubes for example).</p><p>Finally, I want to mention that more and more problems in ML are configured as an <strong>unbounded input and output space</strong>, and it is not at all evident how model data visualizations could be applied to these cases. Models that handle unbounded input and/or output spaces require a complete rethinking of the problem.</p><div><hr></div><p><em>Thanks for reading until the end! Please like the post and leave a comment. It&#8217;s very useful for me to learn about my readers&#8217; thoughts about the articles I post here.</em></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/p/visml-4-visualizing-input-output/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/p/visml-4-visualizing-input-output/comments"><span>Leave a comment</span></a></p><p><em>If you are not a subscriber, sign up to receive updates when I post new articles here. If you like what I am writing, please help me spread the word by letting your friends and colleagues know about this series and the newsletter.</em></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/p/visml-4-visualizing-input-output?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/p/visml-4-visualizing-input-output?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Chung, Yeounoh, et al. "Slice finder: Automated data slicing for model validation." 2019 IEEE 35th International Conference on Data Engineering (ICDE). IEEE, 2019.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Kahng, Minsuk, Dezhi Fang, and Duen Horng Chau. "Visual exploration of machine learning results using data cube analysis." Proceedings of the Workshop on Human-In-the-Loop Data Analytics. 2016.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Wexler, James, et al. "The what-if tool: Interactive probing of machine learning models." IEEE transactions on visualization and computer graphics 26.1 (2019): 56-65.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Kerrigan, Daniel, and Enrico Bertini. "SliceLens: Guided Exploration of Machine Learning Datasets." Proceedings of the Workshop on Human-In-the-Loop Data Analytics. 2023.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[VisML#3: What Type of Machine Learning Data Is There To Visualize?]]></title><description><![CDATA[Where I describe where ML data come from and how they play a role in visualization]]></description><link>https://filwd.substack.com/p/visml3-what-type-of-machine-learning</link><guid isPermaLink="false">https://filwd.substack.com/p/visml3-what-type-of-machine-learning</guid><dc:creator><![CDATA[Enrico Bertini]]></dc:creator><pubDate>Thu, 25 Apr 2024 19:26:52 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div><hr></div><p>This is Post #3 of my series on Visualization for Machine Learning. If you want to know more about the series, start from the introductory post, which also includes links to the posts published in the series so far (this one included). If you are new to this newsletter and want to receive future updates, subscribe now to receive the updates directly in your inbox.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><p>In my previous posts, I mentioned the idea of organizing the series around what data is available to visualize coming from ML models. In this post, I will provide a first overview of this organizing principle. My intent is to give you a better sense of what I have in mind without providing too many details yet. This little framework will help us place specific visualization ideas in a broader context. The framework includes three main sources of information derived from machine learning models.</p><ol><li><p><strong>Model input-output.</strong></p></li><li><p><strong>Model explanations.</strong></p></li><li><p><strong>Model components.</strong></p></li></ol><p>Let&#8217;s take a look at each one &#8230;</p><h4>Model Input-Output</h4><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bXkP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bXkP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 424w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 848w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 1272w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bXkP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png" width="534" height="131.29945054945054" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:1456,&quot;resizeWidth&quot;:534,&quot;bytes&quot;:54038,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bXkP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 424w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 848w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 1272w, https://substackcdn.com/image/fetch/$s_!bXkP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F601d5959-dfaa-4fa0-9b19-d2da89a9eefb_1612x396.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>Since models generate some output for any given input, visualization can be used to depict data generated from the model and any derivation of these data. Since input and output are logically connected, visualizations can focus on these data to describe model behavior and make inferences about its logic. One can, for example, visualize how different characteristics of the data correlate to specific outputs and the number of errors the model produces. A common example is <em>multidimensional projections</em>, which form a sort of &#8220;map&#8221; or &#8220;landscape&#8221; of the data space and can help generate glimpses of how the model behaves in different &#8220;regions&#8221; of the data space (we will explore these and other techniques in way more detail in a future post).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KVnn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KVnn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 424w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 848w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 1272w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KVnn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png" width="332" height="311.13142857142856" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:984,&quot;width&quot;:1050,&quot;resizeWidth&quot;:332,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Embedding projector - visualization of high-dimensional data&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Embedding projector - visualization of high-dimensional data" title="Embedding projector - visualization of high-dimensional data" srcset="https://substackcdn.com/image/fetch/$s_!KVnn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 424w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 848w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 1272w, https://substackcdn.com/image/fetch/$s_!KVnn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb07614b6-5a3a-47de-95a4-2398447ff723_1050x984.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The image above shows an example from the &#8220;<a href="https://projector.tensorflow.org/">embedding projector</a>&#8221; tool developed by Google and available within Tensorflow.</p><h4>Model explanations</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PUfv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PUfv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 424w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 848w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 1272w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PUfv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png" width="448" height="262.95652173913044" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:756,&quot;width&quot;:1288,&quot;resizeWidth&quot;:448,&quot;bytes&quot;:85744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PUfv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 424w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 848w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 1272w, https://substackcdn.com/image/fetch/$s_!PUfv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda043ea4-b34c-4adc-b8c4-927b7c621acd_1288x756.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Model explanations are ML methods that help people gain a better understanding of the model&#8217;s logic. I will explain these methods and their various intents and applications in more detail in a future post when we will cover data visualizations based on explanations. For now, one way to think about them is that they are a sort of &#8220;models of models&#8221; and that they help with extracting information from models that is hard to draw exclusively from looking at the input-output behavior. Very often these methods try to estimate the importance of different data attributes or features, but they are not limited to that goal. Visualization can be used to <em>explain</em> specific data instances or entire groups of data. A good example we will examine in more depth in future posts is the technique called <a href="https://shap.readthedocs.io/en/latest/">SHAP</a> and its associated visualizations, which provide information about the weight a model gives to the features it uses.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5yKM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5yKM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 424w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 848w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 1272w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5yKM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png" width="426" height="250.275" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4e229309-4516-4e5e-be10-86934d51077c_800x470.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:470,&quot;width&quot;:800,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5yKM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 424w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 848w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 1272w, https://substackcdn.com/image/fetch/$s_!5yKM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e229309-4516-4e5e-be10-86934d51077c_800x470.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is an example coming from the SHAP library showing the importance of each feature for each individual data point in the data set.</p><h4>Model components</h4><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dxdk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dxdk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 424w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 848w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 1272w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dxdk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png" width="360" height="215.377969762419" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:554,&quot;width&quot;:926,&quot;resizeWidth&quot;:360,&quot;bytes&quot;:50152,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dxdk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 424w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 848w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 1272w, https://substackcdn.com/image/fetch/$s_!dxdk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d1bb354-fbb9-4273-a973-57c64f6753da_926x554.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Finally, one also wants to look inside models to understand how they work and what role individual components play. For traditional models with a somewhat intelligible structure, visualizing model structure and components comes naturally and exposes some of the internal logic directly. For more complex models, like those based on deep learning, visualizing the behavior of individual components or parts of the architecture can help understand their role in producing complex tasks. In language models, for example, it is common to visualize the &#8220;attention&#8221; mechanism, which represents which of the preceding words the model uses the most to predict the next token.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vDX7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vDX7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 424w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 848w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 1272w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vDX7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png" width="322" height="267.6574307304786" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:660,&quot;width&quot;:794,&quot;resizeWidth&quot;:322,&quot;bytes&quot;:263891,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vDX7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 424w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 848w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 1272w, https://substackcdn.com/image/fetch/$s_!vDX7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82ada770-4638-42b2-84dc-40cec9ddf9fd_794x660.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The image above, coming from the <a href="https://github.com/jessevig/bertviz">Bertviz tool</a>, provides a common example of visualizations of the &#8220;attention mechanism,&#8221; which permits us to understand which, among the preceding words, the models use the most to make the next word prediction.</p><p>So, summarizing, once a model has been trained we can identify the following elements. Data comes into a&nbsp;<strong>model</strong>&nbsp;as an&nbsp;<strong>input</strong>&nbsp;and produces some&nbsp;<strong>output</strong>. The data produced from the model, as well as the model itself, can be used to generate model&nbsp;<strong>explanations</strong>. If you look inside the model, you can find various components, a bit like the engine of a car or a plane. For this reason, we also consider model&nbsp;<strong>components</strong>&nbsp;and the information they receive or produce. That&#8217;s the material we work with when we visualize machine learning<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>!</p><p>In practice, this subdivision may not be as neat as what I presented here. For example, one could have methods that integrate or relate model explanations with model structure or model data with model explanations. But as a first approximation, these three categories help us organize the existing work in a useful logical structure.</p><p>One additional observation is that these three types of data correspond to the three types of focus I outlined in my previous post, which are understanding model <em>behavior</em>, <em>logic</em>, and <em>mechanics</em>.</p><h2><strong>Data types</strong></h2><p>In the description above, I did not consider what type of data a model handles, which typically corresponds to what type of data has been used to train it. These are some of the most common data types:</p><ul><li><p><strong>Tabular:</strong> Think spreadsheet. A data set is made of rows and columns, where the rows represent some objects of interest and the columns have some attributes that describe properties of these objects.</p></li><li><p><strong>Temporal:</strong> This is often a tabular data set with temporal information added. That is, it is a data set where the values are anchored to and depend on specific times.</p></li><li><p><strong>Spatial:</strong> Data with a spatial nature. Very often spatial data sets are geographical data sets, but they can also describe different types of space. Similarly to temporal data sets, the information here is anchored to locations or regions. (Spatio-temporal is also an interesting case: data sets that describe spatial phenomena that change over time (e.g., weather, urban mobility, animal migrations).</p></li><li><p><strong>Multimedia:</strong> This is any data set based on images, audio, video, or a combination of them. Multimedia data sets are very different from the data types mentioned above because they do not have an intelligible tabular structure.</p></li><li><p><strong>Language:</strong> This is data made of text and whole sentences. This is also a type of data that is not amenable to tabular structures, is characterized by linguistic components, and often requires special transformations before being handled by a model. </p></li><li><p><strong>Networks:</strong> This is data characterized by relational structure, which can often be described as a series of nodes and connections between the nodes. Social networks are an example of this type of data; people are connected by friendship.</p></li></ul><p>Recognizing data types is important because most visualization techniques can handle only specific data types. For example, maps work for geographical data, statistical plots work for tabular data, and link-node diagrams work for network data. By knowing what type of data a model handles we can narrow down the set of visualizations that will work for that type of data.</p><p>In terms of output, most traditional models produce two types of outcomes: <strong>labels</strong> or <strong>quantities</strong>. Classifiers produce categorical&nbsp;labels, like when classifying transactions as frauds or what type of object is in an image. Regressors produce quantities, like when predicting the time it will take for a rideshare car to arrive.</p><p>Models can produce a wide variety of other outputs, including rankings and groupings, as well as complex objects like full images, text, etc. Importantly, these outputs are most often associated with <strong>performance metrics</strong> that derive from ground truth information from training and test data. For this reason, visualizations also handle performance data derived from these metrics, often in terms of error quantification.</p><p>As I explained earlier, the data part of data visualization is not limited to a model's input and output but also includes <strong>ML explanations</strong> and <strong>data coming from internal components</strong>. Characterizing this type of data is crucial, and more work is needed to better understand this aspect of data visualization for ML. Most of the design work visualization designers need to do in this space is to understand what type of information can be extracted from models and how such information helps answer important questions we have about machine learning models.</p><h2><strong>Data phase</strong></h2><p>Machine learning is not only about model development but also about assessing and monitoring what a model does&nbsp;<em>after </em>deployment. While the type of information extracted from models may look the same between these two phases, models in production can produce additional information that models in development do not have. For example, models can experience <strong>data-shifting</strong> problems as well as <strong>edge cases</strong> that are simply not visible when a model is being developed. For this reason, visualization can also be used as a monitoring and assessment tool to understand how a model behaves once it has been deployed.</p><p>Another important situation to consider is when a model is used by a person to support a human-driven task. For example, in health care and banking, it is increasingly common to find ML models that support decision-making. For these cases, visualization can also play a major role by making the <strong>output of the model</strong> and its <strong>uncertainty </strong>more intelligible and helping the decision-makers integrate the output of the models in their decision-making process (e.g., to understand when it makes sense to follow a model&#8217;s recommendations and when not).</p><h2><strong>Data granularity</strong></h2><p>Another distinction I&#8217;d like to make regarding &#8220;what to visualize&#8221; is about the granularity of information. In explainable AI, researchers often make a distinction between <strong>local and global explanations</strong>, that is, methods that provide information about single instances (e.g., how did my model make this single specific prediction?) versus methods that aim at giving an understanding of the entire model (e.g., what are the most important features in this model?). In visualization, we can do the same, except that we can add an intermediary step focusing on <em>subgroups</em>, groups of instances grouped according to some criteria like sharing a specific attribute (e.g., all instances that are false positives, false negatives, true positives, and true negatives). In summary, visualization can handle data at three different levels of granularity: <strong>individual instances</strong>, <strong>subgroups</strong>, and <strong>entire data sets</strong>. How to create subgroups is part of the data design process I already mentioned above. Different ways to aggregate data into subgroups can lead to different visualizations and can enable people to answer different types of questions.</p><h2><strong>Data from multiple models</strong></h2><p>One last element I&#8217;d like to cover is comparison. I have already mentioned how relevant comparison is for model understanding. This means that when we build visualization tools we need to consider if we want to support model comparison as a task. Many techniques developed for model visualization work only for individual models and it&#8217;s not immediately evident whether and how they can scale to comparison of two or even multiple models. In fact, when I look into the literature of data visualization for ML I can&#8217;t find too many solutions that work for model comparison. This is surprising given the relevance of this task and my hope is that we will see new methods developed in this space soon.</p><h2>Conclusion</h2><p>This post gave you an overview of what is possible to visualize in machine learning, or in other words, where the data comes from. As we focus more on the data side of data visualization, it is important to emphasize two aspects that are too often overlooked. First, different data sets allow us to ask different types of questions and ultimately produce different types of knowledge. Making this association between data, questions, and knowledge is essential to avoid visualizing data without a particular aim. Second, data extraction and transformation are part of the visualization process, so deciding what data to extract from the model and how to transform it before it is visualized is at least as essential (if not more essential) than deciding what visual presentation to use. This post forms the basis for many of the upcoming posts, which will go much deeper into the data sources I have outlined above.</p><div><hr></div><h2>Previous posts of the series</h2><p>If you missed the previous posts of the series, you should definitely take a look!</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;eaea7477-4549-49ff-a12e-2c7f8a73b2af&quot;,&quot;caption&quot;:&quot;(Hello friends! With this post, I am starting a new series. After completing the Data Transformation for Visualization series, we start this spring with a new series, this time on Visualization for Machine Learning. I have been working in this area for quite a few years, and I taught a new course at Northeastern a few years ago. The series is organized &#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Data Visualization for Machine Learning&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:5453110,&quot;name&quot;:&quot;Enrico Bertini&quot;,&quot;bio&quot;:&quot;Faculty @ Northeastern University. Researcher and educator. Working on Data Visualization, Visual Analytics and Explainable AI. Italian &#127470;&#127481;. Father of 3 &#128102;&#127995;&#128102;&#127995;&#128102;&#127995;.&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8ecc263-2f20-4672-82f7-a3dd963f7ca4_1170x1170.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-03-27T02:54:11.557Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4abe7bb4-f726-45a5-9054-f2bbc9a57357_1020x586.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://filwd.substack.com/p/data-visualization-for-machine-learning&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:142993718,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:12,&quot;comment_count&quot;:11,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;FILWD&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fffb9a4cf-c54f-4c34-b318-28f5a385efe2_273x273.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;12abb661-78ce-411a-be19-437ad54164c8&quot;,&quot;caption&quot;:&quot;Data visualization can support many different types of stakeholders. Identifying these types is crucial in designing appropriate visualization systems because their needs and tasks vary considerably. The research literature offers many different categorizations. Here, I&#8217;ll partially borrow and then expand on a paper I published with my co-authors in 201&#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Who Needs Visualization in Machine Learning? To Do What?&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:5453110,&quot;name&quot;:&quot;Enrico Bertini&quot;,&quot;bio&quot;:&quot;Faculty @ Northeastern University. Researcher and educator. Working on Data Visualization, Visual Analytics and Explainable AI. Italian &#127470;&#127481;. Father of 3 &#128102;&#127995;&#128102;&#127995;&#128102;&#127995;.&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8ecc263-2f20-4672-82f7-a3dd963f7ca4_1170x1170.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-04-19T02:18:57.124Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://filwd.substack.com/p/who-needs-visualization-in-machine&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:143437541,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:11,&quot;comment_count&quot;:4,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;FILWD&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fffb9a4cf-c54f-4c34-b318-28f5a385efe2_273x273.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div><hr></div><h2>Reader&#8217;s feedback</h2><p>This is a long-term project. These posts are initial drafts for something more structured I&#8217;d like to build once the series is done. It may be a book, a course, or something else. If you like what I am writing please let me know how this is useful to you and how I could be of more help also! If there is anything specific you&#8217;d like me to cover, I&#8217;d be happy to hear it. Just leave a comment below.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/p/visml3-what-type-of-machine-learning/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/p/visml3-what-type-of-machine-learning/comments"><span>Leave a comment</span></a></p><p>Also, if you know someone who might be interested in this series, can you please send them a link to the newsletter? The more people we have here, the richer the conversation is going to become for everybody. Thanks!</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>In reality, it is always possible to add more visualizable elements, but this should cover most of the information we are interested in.</p></div></div>]]></content:encoded></item><item><title><![CDATA[VisML#2: Who Needs Visualization in Machine Learning? To Do What?]]></title><description><![CDATA[Post #2 of the series on Visualization for Machine Learning. We introduce different roles and their goals.]]></description><link>https://filwd.substack.com/p/who-needs-visualization-in-machine</link><guid isPermaLink="false">https://filwd.substack.com/p/who-needs-visualization-in-machine</guid><dc:creator><![CDATA[Enrico Bertini]]></dc:creator><pubDate>Fri, 19 Apr 2024 02:18:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Data visualization can support many different types of stakeholders. Identifying these types is crucial in designing appropriate visualization systems because their needs and tasks vary considerably. The research literature offers many different categorizations. Here, I&#8217;ll partially borrow and then expand on a paper I published with my co-authors in 2018 (one of my recent favorites!):</p><p><a href="https://arxiv.org/pdf/2004.11440.pdf">Human Factors in Model Interpretability: Industry Practices, Challenges, and Needs.</a> Sungsoo Ray Hong, Jessica Hullman, Enrico Bertini. Proc. of the ACM Conference on Computer Supported Cooperative Work (CSCW), 2020.</p><p>The paper is an interview study on ML Interpretability aimed at understanding current practices and needs in the industry. In that study, we categorized users into three main classes: model makers, model breakers, and model users. These roles are a good starting point for our analysis, even though, as you will see in a moment, I will need to add more to create a complete picture of who may benefit from visualizing machine learning.</p><h2>Roles</h2><p>These are the relevant roles identified in the paper, plus some important ones to recognize and consider.</p><h4><strong>Model makers (developers)</strong></h4><p>The people who build ML models and solutions (you can also call them developers, data scientists, or the fancier MLOps). Within this class, I used to group ML researchers, but I now think researchers need a separate class. Researchers tend to focus more on developing new methods. Developers tend to focus more on developing solutions with existing methods and verifying that the solution works for their target application. Of course, this distinction is, in practice, not as neat, but to understand how visualization supports ML development, this distinction is essential. </p><h4><strong>Model breakers</strong></h4><p>Those who verify that the model works as intended. This category includes a wide variety of people, including some model makers. However, it typically includes product managers, risk officers (especially in highly regulated markets), and model adopters who must verify that things work as expected before an AI solution is integrated into an organization. The role of risk officer is discussed less in the literature but is extremely important and in strong need of support. Companies in regulated markets like banking have specialized personnel to ensure that models behave as expected and comply with regulations. The fact that developers and evaluators are not on the same team is crucial to ensure undesired biases and influences. The Model Risk Managers&#8217; International Association (MRMIA) has an <a href="https://mrmia.org/wp-content/uploads/2021/03/Machine-Learning-and-Model-Risk-Management.pdf">interesting technical report</a> describing the role of ML risk officers.</p><h4><strong>Model consumers (users)</strong></h4><p>These are domain experts or laypeople who use the developed ML models to carry out tasks in their environment to achieve their goals. Here, we have healthcare professionals, business experts, HR teams, etc., who use ML/AI systems to make decisions in their environment. This category also includes the important subcategory of scientists who use ML to explore scientific phenomena through various types of ML modeling. Model consumers are way less defined in the current literature; this is where I see an important gap. In any case, my intuition is that visualizations here could help with two high-level goals: onboarding and interpretation. In onboarding, model users explore the model decision space to understand how it behaves and generate a mental model. In interpretation, visualization can play a major role in putting model output in context so that users can integrate knowledge from the model more meaningfully.</p><h4><strong>Model explainers</strong></h4><p>This class did not exist in our original paper, but I am now convinced it is an important group of people to consider. Explainers are educators, researchers, and enthusiasts interested in using visualization to describe how ML works to other people. This is where people develop &#8220;explanatory visualization,&#8221; which walks the readers through several steps to help them develop an intuition and understanding of how some ML technique works. The Financial Times, for example, published this fantastic <a href="https://ig.ft.com/generative-ai/">explainer</a> on Large Language Models not too long ago.</p><p>And if you want to blow your mind you should definitely take a look at the incredible, but now discontinued, <a href="https://distill.pub/">distill.pub</a>, an online magazine/journal that focused on ML visualizations and started when nobody was talking about AI and ML yet, except the experts at work (their first explainer was published in 2016 &#129327;). If you have never heard or it, do yourself a favor and check the amazing articles they published over the years. Take a look at the &#8220;<a href="https://distill.pub/2019/activation-atlas/">Activation Atlas</a>&#8221; if you want to start somewhere.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!caNI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!caNI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 424w, https://substackcdn.com/image/fetch/$s_!caNI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 848w, https://substackcdn.com/image/fetch/$s_!caNI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 1272w, https://substackcdn.com/image/fetch/$s_!caNI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!caNI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png" width="656" height="303.6703296703297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:674,&quot;width&quot;:1456,&quot;resizeWidth&quot;:656,&quot;bytes&quot;:1894064,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!caNI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 424w, https://substackcdn.com/image/fetch/$s_!caNI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 848w, https://substackcdn.com/image/fetch/$s_!caNI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 1272w, https://substackcdn.com/image/fetch/$s_!caNI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce970f8-c0ea-4b65-a23b-2b0f7ccba1c8_2310x1070.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Activation Atlas from distill.pub. A data visualization tool to understand and explore visual features learned by a neural network.</figcaption></figure></div><p>Finally, if you want a taste of the efforts of academic visualization community in this space, take a look at the <a href="https://visxai.io/">Workshop on Visualization for AI Eplainability</a>, which is at its 7th edition already, and you&#8217;ll find even more amazing examples.</p><h4><strong>Model researchers</strong></h4><p>As I mentioned above I think ML researchers deserve a separate category. Researchers are ML experts who develop <em>new</em> ML methods and techniques&#8212;the cutting-edge. While developers are more into using existing methods to solve specific applied problems, researchers are more into developing new capabilities and methods. When I mention researchers, one should not equate this to academic researchers because a lot of innovation in ML today is happening in companies. However, what ML researchers have in common is that their goal is to develop new capabilities for ML and AI, and as such, they have a stronger focus on understanding how models do what they do rather than what they do. For this reason, this is the main class of users who have some interest in looking <em>inside</em> models to understand what specific components or parts of the architecture do. While the academic community has developed many of such visualizations, I have a hunch that looking inside models is something that interests almost exclusively model researchers (and this is, of course, not to say that because of that, they are not important).</p><p>I want to conclude this part by clarifying that an individual can cover many of these roles at once and that this is a very coarse categorization. However, despite its limitations, this categorization is helpful to reason about what goals and tasks exist in ML visualization and how we could provide support to these roles.</p><h2>Goals</h2><p>In the following, I cover a few common goals that can be supported by data visualization. This list, like the roles outlined above, is by no means exhaustive, but I think it can help us reason about what visualization can do in this space.</p><h4><strong>Improve model performance</strong></h4><p>Model makers are, above all, interested in building models that make as few mistakes as possible and have high accuracy (&#8220;<em>What is the model performance?</em>&#8221;). But this is not the only criterion possible. Model makers also want to see what kind of errors the model makes because some errors are more problematic or riskier than others, a goal they partially share with model breakers. So even if two models have similar performance, one may still prefer a model that makes certain kinds of errors or errors that are more manageable than others (&#8220;<em>Where and when does the model make mistakes? Where do the mistakes come from? How can we build a better model?</em>&#8221;) Relatedly, model makers often want to check if the model &#8220;generalizes&#8221; well, that is, whether it&#8217;s going to behave as expected with data the model will receive in the <em>future</em>, once it&#8217;s in production. While some statistical methods exist to deal with generalizability, manual inspection as a sanity check is also important (&#8220;<em>How does the model behave with instances I know might be problematic? In what areas of the input space is the model more uncertain?</em>&#8221;) There is no substitute for looking at specific instances where the model makes mistakes. It is not rare for model makers and breakers to have a library of problematic or hard cases they keep testing when assessing a new model.  In future posts, we will cover visualization methods that guide users in detecting and interpreting problematic instances, for example, by arranging instances according to their model score to detect areas where the model may be more uncertain or according to subsets analysts want to inspect.</p><h4><strong>Compare models</strong></h4><p>Working with people from industry, I have learned that comparing models is a much more frequent and relevant task than one may initially think. This recent paper, &#8220;<a href="https://arxiv.org/pdf/2209.09125.pdf?trk=public_post_comment-text">Operationalizing machine learning: An interview study</a>&#8221; explains how pervasive and relevant model comparison is. Model makers and breakers continuously maintain multiple models they compare for various purposes: to compare different modeling strategies, to compare new models with legacy models or models they have in production, and to perform A/B testing with models they deployed. Risk officers often develop &#8220;challenger models&#8221; (Deloitte has <a href="https://www2.deloitte.com/content/dam/Deloitte/nl/Documents/risk/deloitte-nl-risk-challenger-models-v01-risk-driver-selection.pdf">a nice report</a> on them if you want to learn more about the topic) to compare with models they receive from the development team. So, as you can see, model comparison is everywhere.</p><p>This is interesting because comparison is a key research area in visualization. Visualization is extremely powerful in helping people compare objects or entities. Still, the design space of comparisons is often large, and one needs to understand how visual comparison works to make it effective. In this space, my friend Prof. Michael Gleicher is a real expert. If you are unfamiliar with his work, I strongly recommend this classic paper, &#8220;<a href="https://graphics.cs.wisc.edu/Papers/2011/GAWJHR11/">Visual Comparison for Information Visualization.</a>&#8221;</p><p>Unfortunately, and surprisingly, model comparison is not well supported by existing visual analytics tools and it has not been identified as a fundamental task (&#8220;<em>How do the models compare? How do they differ in terms of decisions and errors they make? Why do they differ?</em>&#8221;) The image below shows an example of model comparison technique from Model Tracker, a tool developed by Microsoft Research and presented in this paper in 2015 (!), &#8220;<a href="https://www.microsoft.com/en-us/research/publication/modeltracker-redesigning-performance-analysis-tools-for-machine-learning/">ModelTracker: Redesigning Performance Analysis Tools for Machine Learning.</a>&#8221; The little squares are individual instances, and the horizontal axis represents the model score. The lines and arrows you see represent changes between two different versions of the model.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0N-t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0N-t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 424w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 848w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 1272w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png" width="1456" height="376" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:376,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0N-t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 424w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 848w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 1272w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf764f0d-8d39-4ede-8c2b-3e6fcf023336_2008x518.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">ModelTracker: a data visualization tool developed at Microsoft Research in 2015 for model analysis and comparison. See the paper linked above for details.</figcaption></figure></div><h4><strong>Assess risk</strong></h4><p>Once models are developed, it is essential to have people check what risks they carry. In many settings, this role can be covered by a project manager responsible for the product or, in regulated markets, by model risk officers. In many situations, model evaluators must be different from model builders because they do not have any specific attachment or stake in the model's performance. They succeed when they find problems that builders cannot detect or anticipate. Model breakers typically ask questions about potential points of failure. For example, they may ask, &#8220;<em>Can we trust this model? Does its logic make sense? Where could the model fail? What are specific cases where the model should never fail? Where could the model fail unexpectedly? Does the model have relevant biases? Does it comply with regulations?</em>&#8221; Although the techniques model breakers and model builders use may end up being similar, their focus is different. Model builders test models to generate insights about how to improve them, while model breakers test models to assess where, when, and how they may fail.</p><h4><strong>Internalize model logic and calibrate trust</strong></h4><p>While many models are used to automate tasks, there are many situations where models help people carry out some tasks. For example, models can recommend specific courses of action (e.g., buy or wait?), flag entities/objects to review (e.g., equipment to maintain because it may break soon or anomalies to review in a security setting), rank items (e.g., which business franchises one needs to review to avoid future problems). Sometimes, some of these tasks influence very sensitive decisions, so the stakes are high. Common ones known in the literature are recidivism predictions, ranking people for job hiring, ranking people to decide who to call to prevent hospital readmission, predictions of adverse health outcomes, and many more. The stakes are high! Because of that, the visual interfaces we build to support these tasks downstream (and maybe even upstream) model output are very important.</p><p>This is where research is not very well developed yet, and we need to accumulate more knowledge. In any case, the type of questions model users pose are quite different from the ones model makers and breakers have. Users want to understand how much they can trust the output and what they can do with it. In turn, this also means that visual interfaces in this space need people to help with how much uncertainty there is in a recommendation and what the logic that drives a given output is. Common questions users may have include: &#8220;<em>Can I trust this recommendation? Does the recommendation make sense? Why does the model provide this recommendation? How uncertain is the model on this prediction?</em>&#8221;</p><p>Model user tasks may exist <em>globally</em> or <em>locally</em>. At a local level, users are interested in assessing individual cases/decisions they are confronted with. At a global level, they need to understand how the model works in general (i.e., its logic), whether they can trust it, and what specific predictions may be more problematic. Local-level tasks pertain more to the actions and decisions users have to make. Global-level tasks may be part of an initial onboarding and setup phase to help users understand how a model works and internalize its logic.</p><h4><strong>Understand how models do what they do</strong></h4><p>Machine learning models are so complex that even their developers are not sure how they do what they do. This is especially true for generative AI, where researchers try to understand how certain surprising capabilities emerge from their structures. In this space, models are studied almost like the way physical phenomena are studied in natural sciences: look at how they behave and what roles individual components seem to have and build explanations and theories around them. Visualization could play a major role here. In the same way, microscopes are used to understand microorganisms and telescopes to understand the cosmos, and visualization, in a way, could be used to understand machine learning models. The articles I mentioned from <a href="https://distill.pub/">distill.pub</a> are a lot like that. The authors look at visualizations to develop intuitions about how models do what they do and I hope there will be more works like these ones.</p><p>Of course, there is way more than what I captured in the paragraphs above, but my hope is that these can be a source of inspiration to look more closely at how visualization could help in this space.</p><h2>Why use visualization?</h2><p>After reading about roles and goals, a legitimate question is: Why use visualization? When and why does visualization play a role in achieving these goals? It&#8217;s hard to give an exhaustive answer. In fact, part of the research we will need to do is to have more and more specific answers to this question. But let me try to sketch something here. The way I like to think about this problem is that data visualization can help us develop an understanding (or at least intuitions) about three main aspects of ML models: </p><ul><li><p><strong>Behavior: </strong>How does the model behave?</p></li><li><p><strong>Logic:</strong> What logic governs this model? </p></li><li><p><strong>Mechanics:</strong> How does the model do what it does?</p></li></ul><p>Visualization of data coming (or derived) from models and their components can help us draw inferences about these three elements and this is where its real value lies. In future posts I will come back to this idea. In particular, I will focus on data visualizations that focus on specific types of data one can derive from models and how this information helps us draw specific kinds of inferences and intuitions.</p><h2>Conclusion</h2><p>That&#8217;s all I have to say for now regarding roles and goals. There are aspects of this problem that I am still struggling with, but I am confident the picture will become clearer as this series develops. If you have any ideas or comments to share please leave a comment below. This is very much a work in progress, and I need your help to think these things through! Do you find this helpful? Does it help organize more clearly ideas about how visualization plays a role in this space? Please let me know!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/p/who-needs-visualization-in-machine/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/p/who-needs-visualization-in-machine/comments"><span>Leave a comment</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Data Visualization for Machine Learning]]></title><description><![CDATA[Introducing a new series on how visualization can be used to understand machine learning models and their behavior]]></description><link>https://filwd.substack.com/p/data-visualization-for-machine-learning</link><guid isPermaLink="false">https://filwd.substack.com/p/data-visualization-for-machine-learning</guid><dc:creator><![CDATA[Enrico Bertini]]></dc:creator><pubDate>Wed, 27 Mar 2024 02:54:11 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4abe7bb4-f726-45a5-9054-f2bbc9a57357_1020x586.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>(<em>Hello friends! With this post, I am starting a new series. After completing the Data Transformation for Visualization series, we start this spring with a new series, this time on Visualization for Machine Learning. I have been working in this area for quite a few years, and I taught a new course at Northeastern a few years ago. The series is organized around the framework I developed when I prepared for that course. I hope you&#8217;ll enjoy it. I am nervous and excited at the same time. Let&#8217;s go! P.s. As I start this series on visualization for ML, I assume you are familiar with both data visualization and machine learning. If you have a hard time grasping some concepts, please let me know, and I&#8217;ll provide more details.</em>)</p><div><hr></div><p>If you are even vaguely familiar with technology, you must have heard machine learning (ML) is all the rage right now (note that people often talk about ML and AI interchangeably even if, in principle, ML is a subset of methods for AI). While ML has existed for several decades, recent breakthroughs have made it extremely popular.</p><p>In this new series of posts, we will explore connections between data visualization and machine learning. More precisely, I will focus on how data visualization can help practitioners and end-users better understand machine learning data, behavior, structure, and decision mechanisms.</p><p>You may ask, &#8220;<em>Why use data visualization for machine learning? What is special about Data Visualization that ML can benefit from?</em>&#8221; Also, if you are familiar with Data Visualization, you may ask, &#8220;<em>What is special about ML that requires specific visualization solutions?</em>&#8221; Let me answer the two questions separately.</p><h2>Why use Visualization in ML?</h2><p>Data visualization is needed because ML models are complex objects increasingly used for applications that impact many people&#8217;s lives, directly or indirectly. ML is everywhere. It&#8217;s in your phone, in the stores you use to buy stuff, in your bank, in your watch, in the computers and devices your doctor uses to take care of you, in the phone you use to take pictures of your family, etc. This is an interesting combination because ML is pervasive, takes place in sensitive settings, and is very complex. Increasingly complex.</p><p>Let me clarify what I mean by complex. The most fundamental feature of machine learning is that 1) the machine <strong>learns</strong> through a series of examples (often a massive amount of them in modern applications) and 2) the program that is learned is (most often) <strong>not intelligible</strong>; that is; humans can&#8217;t directly observe and comprehend what the model has learned and how it has learned it. In most cases, there is no explicit representation a human can review to understand and predict how a model will behave with new unseen data. It&#8217;s quite amazing if you think about it. <strong>We can teach machines to do something without giving them explicit rules</strong>. This is a remarkable feature, but it comes with a huge cost: we either blindly trust what these machines do or find ways to <strong>verify</strong> what they have learned and how they behave. Since we do not provide explicit rules to the model and the logic is not explicitly encoded, we have to find ways to observe the model to help us draw inferences about its behavior and logic.</p><p>In a way, the fundamental problem is one of abstraction. We need to find abstraction layers that translate the language of models into languages humans understand. This is effectively not new. Humans often build very complex things that perform complex tasks, and we must find ways to make people interact with such complexity through well-crafted abstractions.</p><p>In his legendary &#8220;<a href="https://www.amazon.com/Design-Everyday-Things-Revised-Expanded/dp/0465050654">The Design of Everyday Things</a>,&#8221; Don Norman explains the problem very well. Even something as simple as kitchen appliances has complex internal logic and mechanisms that users do not need to know to operate them. However, when designers build interfaces for these appliances, they can make choices that considerably impact their usability and understanding.</p><p>What is new, however, is the sophistication of the type of decisions and outputs ML systems generate and their potential impact on society. An unusable toaster is not that big of a deal compared to an AI system providing recommendations to medical doctors or hiring managers.</p><p>Caruana et al. provide a remarkable example of what can go wrong with ML if a human does not verify what the model has learned. In a <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2017/06/KDD2015FinalDraftIntelligibleModels4HealthCare_igt143e-caruanaA.pdf">landmark paper on intelligible ML models</a> published in 2015 (before the advent of super complex deep learning models!), the authors recount the story of a series of models  trained to predict the probability of death of patients affected by pneumonia on a clinical trial. When the researchers trained an intelligible model, they discovered that the model had learned &#8220;<em>that patients with pneumonia who have a history of asthma have lower risk of dying from pneumonia than the general population.</em>&#8221; This is clearly absurd because asthma is a major risk factor. The researchers later found that patients with asthma were sent directly to the ICU, which in turn made patients with asthma have a higher probability of survival. This is a good example of what can happen with ML models: they can pick patterns from the data that do not reflect reality accurately and can lead to dangerous decision logic. For this reason, models often need human supervision, and human supervision needs the careful design of visual representations that make the logic and behavior of models understandable.</p><h2>Why do we need ML-centric Visualization?</h2><p>The second question we must address is why we need to study data visualization <em>specifically</em> for machine learning. Can&#8217;t we just use what we know about data visualization and apply it to ML? In principle, yes, but ML poses some unique challenges. ML models are complex objects, and it&#8217;s not obvious what aspects of the model development and use should be visualized. For example, one can visualize the data used to train a model, the model's structural components, or the model's behavior when it&#8217;s used in production. In addition, ML models are dynamic objects that respond to inputs and generate outputs (e.g., using the example above, they can take data about a patient and return the probability of that person dying); they are not just static data. In a way, they are more similar to simulation models, which produce outcomes on demand according to the different information and parameters one feeds them with.</p><p>In turn, this means that visualizing ML models often requires the non-trivial ideation of <strong>model probing</strong> and <strong>querying</strong> mechanisms that guide the user towards behaviors of interest. In a way, the data visualization problem we need to solve with ML visualization is not mainly about which visual representation to use, even though this is very important, but more about what information to <em>extract</em> in the first place and how to interact with the model so that we can understand how it works and behaves. Models can generate as much data as you want; you &#8220;only&#8221; have to feed them with some information, and they&#8217;ll respond with something. Understanding what aspects of a model one needs to investigate is one of the main design decisions one has to make.</p><p>For this reason, the main principle I&#8217;ll use to organize existing ML visualization techniques in the series is <strong>what</strong> information these techniques visualize rather than <strong>how</strong> they visualize it. Accordingly, I plan to organize the content around three main classes of visualizations:</p><ol><li><p><strong>Visualizing ML Data:</strong> Every model receives some data as an input and produces some data as an output. What can we learn by visualizing these data?</p></li><li><p><strong>Visualizing ML Explanations:</strong> In ML, there are techniques to create &#8220;explanations&#8221; of model decisions. How can visualization help us understand and explore these explanations?</p></li><li><p><strong>Visualizing ML Internals:</strong> ML models have an internal structure (and architecture) made of model components. What can we learn by visualizing the behavior of these components?</p></li></ol><p>Of course, this is not carved in stone. I might make changes or add new categories as I develop the series.</p><h2>Overview</h2><p>As of now, these are the posts I plan to write and post for the series:</p><ol><li><p>Who Needs Visualization for ML?</p></li><li><p>What Is There To Visualize?</p></li><li><p>Visualizing ML Output</p></li><li><p>Visualizing Model Explanations</p></li><li><p>Visualizing Model Internals</p></li></ol><p>This is very tentative. There is a high chance that I will need to break these topics down into smaller parts and add or remove pieces as I develop the individual posts.</p><p>I am writing this with a bit of trepidation. Starting a new series is a big task and this seems bigger than the previous one. Wish me luck! I hope you&#8217;ll enjoy what I have to offer in this series. In the meantime, if you have any questions, suggestions, or requests, add a comment below.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://filwd.substack.com/p/data-visualization-for-machine-learning/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://filwd.substack.com/p/data-visualization-for-machine-learning/comments"><span>Leave a comment</span></a></p>]]></content:encoded></item></channel></rss>