<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tech @ SSC on Medium]]></title>
        <description><![CDATA[Stories by Tech @ SSC on Medium]]></description>
        <link>https://medium.com/@tech_at_securityscorecard?source=rss-c63e4e211e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*T0K_9R4EqJ5IXTqwekEanQ.png</url>
            <title>Stories by Tech @ SSC on Medium</title>
            <link>https://medium.com/@tech_at_securityscorecard?source=rss-c63e4e211e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:10:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tech_at_securityscorecard/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Can you count on the Poisson distribution?]]></title>
            <link>https://techblog.securityscorecard.com/can-you-count-on-the-poisson-distribution-85fbaef1fbc9?source=rss-c63e4e211e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/85fbaef1fbc9</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[poisson]]></category>
            <dc:creator><![CDATA[Tech @ SSC]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 21:19:37 GMT</pubDate>
            <atom:updated>2022-07-10T21:20:18.623Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is it always OK to use the Poisson distribution to model counting data?</h3><p>Because it has properties that make it great to work with, data scientists use the Poisson distribution to model different kinds of counting data. But these properties can be seductive, and sometimes people model data using the Poisson distribution when they shouldn’t. I’ll explain why the Poisson distribution is so popular and why you should think twice before using it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*m209fNKb_tUIg48s.jpg" /></figure><p>(Siméon-Denis Poisson by E. Marcellot, Public domain, via <a href="https://commons.wikimedia.org/wiki/File:E._Marcellot_Sim%C3%A9on-Denis_Poisson_1804.jpg">Wikimedia Commons</a>)</p><h3>Poisson processes</h3><p>The Poisson distribution is a discrete event probability distribution used to model events created using a Poisson process. In plainer language, a Poisson process is a series of events that have these properties:</p><ul><li>They occur at random but at a constant mean rate,</li><li>They are independent of one another,</li><li>Two (or more) events can’t occur at the same time</li></ul><p>Good examples of Poisson processes are website visits, radioactive decay, and calls to a help center.</p><h3>The properties of a Poisson distribution</h3><p>Mathematically, the Poisson probability mass function looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*XiLmwKBC7tzfJrWPnBcUJQ.png" /></figure><p>where:</p><ul><li>k is the number of events (always an integer)</li><li>λ is the mean value (or expected rate)</li></ul><p>It’s a discrete distribution, so it’s only defined for integer values of k.</p><p>Graphically, it looks like this for λ=6. Note that it isn’t symmetrical and it stops at 0, you can’t have -1 events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*5pJ-Jnp5DcydELDj.png" /></figure><p>(Let’s imagine we were modeling calls per hour in a call center. In this case, k is the measured calls per hour, P is their frequency of occurrence, and λ is the mean number of calls per hour).</p><p>Here are some of the Poisson distribution’s properties which show you why it’s so popular:</p><ul><li>Mean: λ</li><li>Variance: λ</li><li>Mode: floor(λ)</li></ul><p>The fact that some of the key properties are given by λ <em>alone</em> makes using it easy. If your data follows a Poisson distribution, once you know the mean value, you’ve got the variance (and standard deviation), and the mode too. In fact, you’ve pretty much got a full description of your data’s distribution with just a single number.</p><h3>When to use it and when not to use it</h3><p>Because you can describe the entire distribution with just a single number, it’s very tempting to assume that <em>any</em> data that involves counting follows a Poisson distribution because it makes analysis easier. Sadly, not all counts follow a Poisson distribution. In the list below, which counts do you think might follow a Poisson distribution and which might not?</p><ul><li>Bus arrivals.</li><li>The number of web pages a person visits before they make a purchase.</li><li>The number of earthquakes of at least a given size per year around the world.</li><li>The number of goals in English Premier League soccer matches.</li></ul><p>Bus arrivals are <a href="http://jakevdp.github.io/blog/2018/09/13/waiting-time-paradox/">not well modeled by a Poisson distribution</a> because in practice they’re not independent of one another and don’t occur at a constant rate. Bus operators change bus frequencies throughout the day, with more buses scheduled at busy times; they may also hold buses at stops to even out arrival times. Interestingly, bus arrivals are one of the textbook examples of a Poisson process, which shows that you need to <em>think</em> before applying a model.</p><p>The number of web pages a person visits before they make a purchase is better modeled using a <a href="https://mathworld.wolfram.com/NegativeBinomialDistribution.html">negative binomial distribution</a>.</p><p>Earthquakes are <a href="https://www.ucl.ac.uk/EarthSci/people/sammonds/18%20Earthquake%20Prediction.pdf">well-modeled by a Poisson distribution</a>. Earthquakes in different parts of the world are independent of one another and geological forces are relatively constant, giving a constant mean rate for quakes. It’s possible that two earthquakes could happen simultaneously in different parts of the world, which shows that even if one of the criteria might not apply, data can still be well-modeled by Poisson.</p><p>What about soccer matches? We know two goals can’t happen at the same time. The length of matches is fixed and soccer is a low-scoring game, so the assumption of a constant rate for goals is probably OK. But what about independence? If you’ve watched enough soccer, you know that the energy level in a game steps up as soon as a goal is scored. Is this enough to violate the independence requirement? Apparently not, scores in soccer matches are <a href="https://works.swarthmore.edu/cgi/viewcontent.cgi?article=1123&amp;context=fac-math-stat">well-modeled by a Poisson distribution</a>.</p><h3>What should a data scientist do?</h3><p>Just because the data you’re modeling is a count doesn’t mean it follows a Poisson distribution. More generally, you should be wary of making choices motivated by convenience. If you have count data, look at the properties of your data <em>before</em> deciding on a distribution to model it with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85fbaef1fbc9" width="1" height="1" alt=""><hr><p><a href="https://techblog.securityscorecard.com/can-you-count-on-the-poisson-distribution-85fbaef1fbc9">Can you count on the Poisson distribution?</a> was originally published in <a href="https://techblog.securityscorecard.com/">SecurityScorecard Techblog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s a violin plot?]]></title>
            <link>https://techblog.securityscorecard.com/whats-a-violin-plot-1889b5874a16?source=rss-c63e4e211e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1889b5874a16</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[violin-plot]]></category>
            <category><![CDATA[ridgeline-plot]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mirror-density-plot]]></category>
            <dc:creator><![CDATA[Tech @ SSC]]></dc:creator>
            <pubDate>Thu, 31 Mar 2022 22:51:26 GMT</pubDate>
            <atom:updated>2022-03-31T22:57:10.960Z</atom:updated>
            <content:encoded><![CDATA[<p>At SecurityScorecard, we use violin plots to represent different kinds of data. Here’s an example showing the distribution of <a href="https://securityscorecard.com/resources/the-state-of-cybersecurity-in-the-energy-pipeline-industry-in-north-america">security scores for North American energy pipeline companies</a> (oil and gas pipelines). I’ve color-coded it by scores, so green is an “A”, yellow is a “B” and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*1exQTwwLrewigJka" /><figcaption>A violin plot for North American energy pipeline companies — colored by security grade.</figcaption></figure><p>At a glance, you can see how the industry is performing; you get a sense of how many As, how many Bs, and even how the scores are distributed within a grade.</p><p>These plots get their name because sometimes the plots look like violins; I know it takes some creativity to get there, but who says data scientists have no soul? In this post, I’m going to explain what violin plots are and why you might use them in preference to the alternatives.</p><p>Because I’m English, I’m going to use attendance at English Premier League (EPL) matches to illustrate my points but I’ll throw in some internet security charts too.</p><h3><strong>Summary statistics — the mean etc.</strong></h3><p>We can use summary statistics to give a numerical summary of any dataset, the most obvious statistics being the mean and standard deviation.</p><p>If I take EPL match attendance for the 2018–2019 season, I get a mean of 38,181 and a standard deviation of 16,709, but this doesn’t tell us how the data is distributed; many different distributions could give us exactly the same mean and standard deviation. Of course, the mean is very vulnerable to distortion due to outliers and the standard deviation implies a symmetrical distribution (which is very much not the case here).</p><p>The median is a better measure of central tendency in the presence of outliers, and quartiles work fine for asymmetric distributions. For this data, the median is 31,948 and the upper and lower quartiles are 25,034 and 53,283. Note the median is a good deal lower than the mean and the upper and lower quartiles are not evenly spaced, suggesting a skewed distribution. The quartiles give us an indication of how skewed the data is.</p><p>So we should be just fine with median and quartiles — or are there problems with just using these numbers too? As you can guess, there are problems and the problems appear with box and whisker charts too.</p><h3>Box and whisker plots</h3><p>Box and whisker plots were introduced by Tukey in the early 1970s and evolved since then; currently, there are several slight variations. Here’s a box and whisker plot for the EPL data for four seasons in the most common format; the median, upper and lower quartiles, and the lowest and highest values are all indicated. We have a nice visual representation of our distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*h7QCj9FTOvPxcbkb" /><figcaption>Box and whisker plots showing the median, the upper and lower quartiles, and the maximum and minimum values.</figcaption></figure><p>The box and whisker plot encodes a lot of data and strongly indicates if the distribution is skewed. Surely this is good enough?</p><h3>The problem with boxplots</h3><p>Unfortunately, box and whisker plots can hide important features of the data. <a href="https://www.autodesk.com/research/publications/same-stats-different-graphs">This article</a> from Autodesk Research gives a great example of the problems. I’ve copied one of their key figures here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JgmVE19H6P1aEe0V.gif" /><figcaption>Three varying 1D distributions of data, all with the same boxplot representation. From AUTODESK RESEARCH</figcaption></figure><p>(“<a href="https://www.autodesk.com/research/publications/same-stats-different-graphs">Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing</a>”, Justin Matejka, George Fitzmaurice, ACM SIGCHI Conference on Human Factors in Computing Systems, 2017)</p><p>The animation shows the problem nicely; <em>different</em> distributions can give the <em>same</em> box and whisker plots. This doesn’t matter most of the time, but when it does matter, it can matter a lot, and of course, the problem is hidden.</p><h3>Histograms and distributions</h3><p>If boxplots don’t work, what about histograms? Surely they won’t suffer from the same problem? It’s true they don’t, but they suffer from a different problem; the number of bins. Let’s look at the 2018 EPL data again, this time as a histogram.</p><p>Here’s the histogram with a bin count of 9.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*XChCksCeEpfzZW7D" /><figcaption>EPL data with 9 bins</figcaption></figure><p>Here it is with a bin count of 37.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*4B82Fnze8I9cg-vT" /><figcaption>EPL data with 37 bins</figcaption></figure><p>And finally, with a bin count of 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*m5joLAPE9jaohfM9" /><figcaption>EPL data with 80 bins</figcaption></figure><p>Which of these bin counts is better? The answer is, it depends on what you want to show. In some cases you want a large number of bins, in other cases, a small number of bins. As you can appreciate, this isn’t helpful advice, especially if you’re at the start of your career and you don’t have a lot of experience to call on. Even later in your career, it’s not helpful when you need to move quickly.</p><p>An evolution of the standard histogram is using unequal bin sizes. Under some circumstances, this gives a better representation of the distribution, but it adds another layer of complexity; what should the unequal bin sizes be? The answer again is, it depends on what you want to do and your experience.</p><p>Can we do better?</p><h3>Enter the violin plot</h3><p>The violin plot does away with bin counts by using probability density instead. It’s a plot of the probability density function (pdf) that could have given rise to the measured data.</p><p>In a handful of cases, we could estimate the pdf using parametric means when the underlying data follows a well-known distribution. Unfortunately, in most real-world cases, we don’t know what distribution the data follows, so we have to use a non-parametric method, the most popular being kernel density estimation (kde). This is almost always done using a Gaussian estimator, though <a href="https://scikit-learn.org/stable/modules/density.html">other estimators are possible</a> (in my experience, the Gaussian calculation gives the best result anyway, but see this discussion on <a href="https://stats.stackexchange.com/questions/215835/if-the-epanechnikov-kernel-is-theoretically-optimal-when-doing-kernel-density-es">StackOverflow</a>). The key parameter is the bandwidth, though most kde algorithms attempt to size their <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html">bandwidth automatically</a>. From the kde, the probability density is calculated (a trivial calculation).</p><p>Here’s the violin plot for the EPL 2018 data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*Q2R_5B_ubkLpL7ZR" /><figcaption>Violin plot for 2018 EPL attendance data</figcaption></figure><p>It turns out, violin plots don’t have the problems of box plots as you can see from this animation from Autodesk Research. The raw data changes, the box plot doesn’t, but the violin plot changes dramatically. This is because <em>all</em> of the data is represented in the violin plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*ioXTFLGHnwxUonxH" /></figure><p>(“<a href="https://www.autodesk.com/research/publications/same-stats-different-graphs">Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing</a>”, Justin Matejka, George Fitzmaurice, ACM SIGCHI Conference on Human Factors in Computing Systems, 2017)</p><h3>Variations on a theme, types of violin plot, ridgeline plots, and mirror density plots</h3><p>The original form of the violin plot included median and quartile data and you often see violin plots presented like this — a kind of hybrid of violin and box and whisker. This is how the Seaborn plotting package draws Violin plots (though this chart isn’t a Seaborn visualization).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*i8Zc_hm4ipOhCIwx" /><figcaption>2018 EPL data in a Seaborn-like violin plot</figcaption></figure><p>Now, let’s say we want to compare the EPL attendance data over several years. One way of doing it is to show violin plots next to each other, like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*jCf2WoQAGvy0auCV" /><figcaption>Are multiple violin plots an orchestra plot?</figcaption></figure><p>Another way is to show two violin plots back-to-back, like this. This presentation is often called a mirror density plot. Here’s cyber security data for global container shipping companies compared to the Forbes Global 2000. This presentation means we can compare and contrast the <a href="https://securityscorecard.com/resources/maritime-shipping">security of global container shipping companies</a> to the Forbes Global 2000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/0*hKeIwuzu2ABJM6C8" /><figcaption>Global container shipping vs the Forbes Global 2000</figcaption></figure><p>We can show the results from multiple seasons with another form of violin plot called the ridgeline plot. In this form of plot, the charts are deliberately overlapped, letting you compare the shape of the distributions better. They’re called <a href="https://blog.engora.com/2021/06/unknown-pleasures-pulsars-pop-and.html">ridgeline plots</a> because they sort of look like a mountain ridgeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*EFFGnMYZ-JP3-h0p" /><figcaption>EPL data as a ridgeline plot</figcaption></figure><p>This plot shows the most obvious feature of the data, the 2019–2020 season was very different from the seasons that went before; a substantial number of matches were held with zero attendees (can you guess why?).</p><p>On the ridgeline plot below, I’ve shown the <a href="https://securityscorecard.com/resources/the-state-of-cybersecurity-in-the-energy-pipeline-industry-in-north-america">security factor scores for North American energy pipeline companies</a>. This is a different presentation, I’ve removed the overlap and color-coded the scores, but the idea is the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*oIVyl5-zdGzPHNyx" /><figcaption>Factor security data for North American energy pipeline companies</figcaption></figure><h3>When should you use violin plots?</h3><p>If you need to summarize a distribution and represent all of the data, a violin plot is a good choice. Depending on what you’re trying to do, it may be a better choice than a histogram and it’s always a better choice than box and whisker plots.</p><p>Aesthetically, a violin plot or one of its variations is very appealing. You shouldn’t underestimate the importance of clear communication and visual appeal.</p><p>If you think your results are important, surely you should present them in the best way possible — and that may well be a violin plot.</p><h3>Playing the violin</h3><p>We use violin plots a lot at SecurityScorecard. If this is the kind of thing you’re interested in, take a look at our open jobs: <a href="https://securityscorecard.com/company/careers">https://securityscorecard.com/company/careers</a> or you could see what we’re up to on LinkedIn: <a href="https://www.linkedin.com/company/security-scorecard">https://www.linkedin.com/company/security-scorecard</a></p><h3>Reading more</h3><p>“Statistical computing and graphics, violin plots: a box plot-density trace synergism”, Jerry Hintze, Ray Nelson, American Statistical Association, 1998. This paper from Hintze and Nelson is one of the earlier papers to describe violin plots and how they’re defined, it goes into some detail on the process for creating them.</p><p>“<a href="https://towardsdatascience.com/violin-plots-explained-fb1d115e023d">Violin plots explained</a>” is a great blog post that provides a nice explanation of how violin plots work.</p><p>“<a href="https://mode.com/blog/violin-plot-examples/">Violin Plots 101: Visualizing Distribution and Probability Density</a>” is another good blog post providing some explanation on how to build violin plots.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1889b5874a16" width="1" height="1" alt=""><hr><p><a href="https://techblog.securityscorecard.com/whats-a-violin-plot-1889b5874a16">What’s a violin plot?</a> was originally published in <a href="https://techblog.securityscorecard.com/">SecurityScorecard Techblog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>