<?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 Alfred Carpenter on Medium]]></title>
        <description><![CDATA[Stories by Alfred Carpenter on Medium]]></description>
        <link>https://medium.com/@alfredcarpenter?source=rss-a6bdcb99c90b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IECHrCdASNrg2WNfNOcjWQ.jpeg</url>
            <title>Stories by Alfred Carpenter on Medium</title>
            <link>https://medium.com/@alfredcarpenter?source=rss-a6bdcb99c90b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:04:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alfredcarpenter/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[Mathematically Improving Your Darts Average]]></title>
            <link>https://medium.com/@alfredcarpenter/mathematically-improving-your-darts-average-4c76c6f3ae56?source=rss-a6bdcb99c90b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c76c6f3ae56</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Alfred Carpenter]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 14:05:31 GMT</pubDate>
            <atom:updated>2024-03-19T14:05:31.485Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Problem</h3><p>The age-old question faced by dart players: where to aim to maximize their score? Traditional wisdom often champions the Triple 20 as the pinnacle of darting strategy, but is it truly the optimal choice in every scenario?</p><p>As an avid but less-than-stellar darts player, I wanted to answer the question: how can I maximise my expected score? While practice is often touted as the solution, I’ve sought a different approach.</p><h3>The Solution</h3><p>It is possible to mathematically determine the optimal position on the board for a player to aim at.</p><p>The steps are as follows:</p><p><strong>1. Data Collection: </strong>We start by having the player throw a series of darts, aiming at the centre of the board. We record the locations where each dart hits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGdeatQ8oYPfK0DvCQzmEg.png" /><figcaption>Sample of Dart Throws</figcaption></figure><p><strong>2. Statistical Modelling: </strong>Next, we split these locations into <em>x</em> and <em>y</em> coordinates and fit two independent normal distributions to these points. These distributions represent the player’s horizontal and vertical deviation in dart throws.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5S9MS3z8QcbG0iOVajK7g.png" /><figcaption>A Normal Distribution Representing Horizontal Throw Variance</figcaption></figure><p><strong>3. Skill Kernel Generation:</strong> We calculate the outer product of these two distributions, creating a 2D skill kernel. This skill kernel represents the probability that a dart lands at any location on the board provided the skill kernel is centred at the player’s aiming location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrlSPhGsHnLg5LaQzR3QtQ.png" /></figure><p><strong>4. Convolution Process: </strong>We can perform a 2D convolution of the skill kernel onto a matrix of board values, obtaining the expected score for a player with a given skill level at every aiming location on the board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bKseel1WcpA1_39BcEaaw.png" /></figure><p><strong>5. Optimal Aiming Location:</strong> Finally, we identify the location that maximises the expected score. This precise aiming point serves as the strategic target for the player, maximising their scoring potential with each throw.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bS0Q_3yWMl0d8oIrxhrTnQ.gif" /><figcaption>Optimal Aiming Locations for Players with Standard Deviations 1mm to 101mm</figcaption></figure><p>Through this data-driven approach, we provide players with a clear and objective strategy to elevate their darting performance.</p><h3>The Evaluation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9aTb07WZ-ecR6xxJmPSIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuX8sjznZVeKLJAeVpEHTA.png" /><figcaption>Comparing the Traditional and Optimal Strategies</figcaption></figure><p>The two graphs illustrate the impact of aiming at the optimal location versus the traditional Triple 20 (T20) strategy:</p><ol><li><strong>Expected Score vs. Player Skill: </strong>A perfect player is expected to hit exactly where they aim, resulting in an expected score of 60. As the player’s skill decreases, so does their expected score.</li><li><strong>Percentage Increase in Expected Score: </strong>For players averaging less than 60 points per visit (20 per throw), aiming at the optimal location identified by our model yields a notable increase in expected score. This improvement ranges from 5% to as high as 30%.</li></ol><p>By analysing these graphs, we can quantify the tangible benefits of our methodology and demonstrate its potential to elevate darting performance. From novice players seeking to improve their accuracy to seasoned professionals aiming for precision, our methodology offers a pathway to improvement.</p><h3>The Conclusion</h3><p>It is crucial to acknowledge the limitations of our current methodology. While we’ve made significant strides in optimizing expected scores through data-driven approaches, several factors are yet to be considered.</p><p>Namely, the analysis does not factor in variations in player aim across the dartboard or the potential correlations between successive dart throws in a turn. Moreover, the ultimate goal of strategic darts playing extends beyond maximising the expected score; the goal is to maximise the probability of winning the game. However, this requires consideration of the opponent’s ability and score - data that is not freely available.</p><p>A compromise is to calculate the optimal aiming location to maximise the probability of <em>checking out</em> in the next <em>k</em> throws. To achieve this, we can make minor adjustments to our convolution process and use a dynamic programming approach. I may write about this in the future.</p><p>Thank you for your engagement, and feel free to reach out on LinkedIn to continue the conversation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c76c6f3ae56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualising my Instagram network with Python and Gephi]]></title>
            <link>https://medium.com/@alfredcarpenter/visualising-my-instagram-network-with-python-and-gephi-c7eb7346fd90?source=rss-a6bdcb99c90b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7eb7346fd90</guid>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[network-graph]]></category>
            <category><![CDATA[gephi]]></category>
            <dc:creator><![CDATA[Alfred Carpenter]]></dc:creator>
            <pubDate>Wed, 13 Apr 2022 17:25:06 GMT</pubDate>
            <atom:updated>2022-04-13T17:25:06.689Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The final visualisation</strong></p><p>First things first, here is the final visualisation. While this project was influenced by my knowledge of computer science, it was fundamentally an art project, with this being my final piece.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0J4cRwEf8by3Mf1UHT1vA.png" /><figcaption>My Instagram network: Nodes represent accounts and edges represent a ‘following’ relationship</figcaption></figure><p><strong>How was this data collected?</strong></p><p>I used the online tool <a href="https://phantombuster.com/">PhantomBuster</a> to scrape my Instagram network, recording ‘following’ relationships between accounts as entries in a spreadsheet.</p><p>After detecting all accounts that were followed by my own account, I then repeated the process for all of these accounts individually.</p><p>This process was completed over a number of weeks, processing only a small number of accounts at a time. This was needed to avoid being ‘rate limited’ by Instagram.</p><p>After scraping the relevant data from Instagram, I could run analysis by importing the results into python. The key figures are as follows:</p><ul><li>I followed 432 accounts</li><li>On average, each of these 432 accounts followed 927 other accounts</li><li>The total number of ‘follows’ recorded was 401,062</li><li>The number of unique accounts detected was 221,666</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQC0tJSGo82pj5v5WaBNbQ.png" /><figcaption>My Instagram network: All accounts I am following</figcaption></figure><p>The image above shows my account, the large circle centred in the middle, and the 432 other accounts I follow. This is a simplified view of the network, with only 1 level of ‘following’ relationships.</p><p><strong>How was the data visualised?</strong></p><p>After collecting the data in a CSV format, it could then be plotted as a network graph within Gephi. The original data however had over 4 hundred thousand edges and over 2 hundred thousand nodes. Visualising a network this large turned out to be extremely time and memory intensive. Additionally, the final results were chaotic and hard to decipher.</p><p>I therefore decided to reduce the size of the network. In order to do this, I removed all nodes (accounts) which had a degree of 4 or less. Most of these accounts were unknown to me and generally insignificant. After performing this step, the network was reduced to 3,949 unique accounts (nodes) and 40,279 ‘following’ relationships (edges).</p><p>In order to plot the data, I used the ForceAtlas2 algorithm within Gephi. This algorithm is a linear-attraction linear-repulsion model with few approximations. Description available <a href="https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0098679">here</a>.</p><p>The node radius was based on the ‘in-Degree’ of the node. This means that accounts followed by many users were represented by nodes with a large radius, however accounts followed by only a small number of users were displayed as relatively small. Generally, accounts with a higher ‘in-Degree’ represent a closer friend - someone who is known by many of the people who I know.</p><p>Using the Louvain method, the modularity of the network was calculated. Using a resolution of 1.0, the algorithm detected 6 separate clusters. Using the results of this calculation, the network was coloured with each cluster having a unique colour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUypi_qE0IMdWuI4_DHAog.png" /><figcaption>My Instagram network: Grouping of accounts</figcaption></figure><p>After colouring the network by modularity class, I was shocked to find how accurately the algorithm detected unique groups within my network. While the results were not exact, the diagram above shows how the algorithm generally grouped accounts into one of 6 real world groups.</p><p><strong>Verified accounts</strong></p><p>There are a number interesting conclusions that can be made by looking at the type of accounts following specific verified accounts. The image below shows the same network as above, however all verified accounts (Instagram blue tick) are labelled with their usernames.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_WyGaGDswGztHBtymRSPw.png" /><figcaption>My Instagram network: Verified accounts are labelled with usernames</figcaption></figure><p>Looking at a few of these verified accounts in more detail…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*B_cYhgf-Kh96oDBFTvlbyg.png" /><figcaption>Rugby players</figcaption></figure><p>Zoomed in, we can see that the majority of verified accounts followed by people in the years below me at school (read: under 18) were rugby players, gaming accounts or youtubers. The majority of pornstars are also within this section.</p><p>There are a number of other interesting remarks.</p><ul><li>The conservatives were followed mainly by people from my school.</li><li>People from my university were more likely to follow uklabour.</li><li>Most people who follow either Tom Holland or Zendaya follow both.</li><li>Everyone seems to follow the Kardashians.</li><li>Billie Eilish is the most followed musician.</li></ul><p>I feel any conclusions from these facts would be misleading and inaccurate, however I find them interesting nevertheless.</p><p>The trends I discovered generally agreed with my pre-existing expectations, based upon my knowledge of the users within the network. However it was unnerving how these seemingly private details can be publicly available.</p><p>Not only should you be careful about <strong><em>what</em></strong> you post, I would suggest you think carefully about <strong><em>who</em></strong> you follow online and what this may say about you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7eb7346fd90" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>