<?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 Jonny Brooks-Bartlett on Medium]]></title>
        <description><![CDATA[Stories by Jonny Brooks-Bartlett on Medium]]></description>
        <link>https://medium.com/@jonnybrooks04?source=rss-c6ab8048de41------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GXmJy6jnDvt9zt-1.</url>
            <title>Stories by Jonny Brooks-Bartlett on Medium</title>
            <link>https://medium.com/@jonnybrooks04?source=rss-c6ab8048de41------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:47:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jonnybrooks04/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[How racism can be so prevalent yet everyone claims not to be a racist]]></title>
            <link>https://medium.com/@jonnybrooks04/how-racism-can-be-so-prevalent-yet-everyone-claims-not-to-be-a-racist-fedce7725c23?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/fedce7725c23</guid>
            <category><![CDATA[diversity]]></category>
            <category><![CDATA[oppression]]></category>
            <category><![CDATA[racism]]></category>
            <category><![CDATA[blacklivesmatter]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Wed, 10 Jun 2020 20:45:15 GMT</pubDate>
            <atom:updated>2020-06-27T10:45:30.593Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GNrNA5FX0m0DwYIvX_IMzw.png" /></figure><h3>Introduction</h3><p>I initially wrote this as a Facebook post to make a statement about why I fundamentally disagreed with a post written by a friend of mine. But many people have since told me that they have found my views and experiences enlightening. So I have now written it as a blog post in the hope that it will help others understand racism that little bit more.</p><p>I’ve amended it in a few places to make sure that I clarify some points that I think could be made better and also to address a point that a friend of mine still disagrees on. Otherwise, the vast majority of this is unchanged.</p><h3>The Facebook post</h3><p>Over the last couple of weeks I’ve been quite overwhelmed by the outpouring of solidarity by many of my friends, colleagues and generally people all over the world over the issue of racism and the <a href="https://www.facebook.com/hashtag/blacklivesmatter?__eep__=6&amp;__cft__[0]=AZV1JLQxmMfybigMnJ3jJEpbPFbxAU2M43CL4wUBXvhcZayn-a5TR8-Yk8JZT0qUMob8KhtJHX70r2ryAHhInfRK4jeKlXsHBYXiBG-2fKmcCW5hfN2XqIENe0FtaIrsg7A&amp;__tn__=*NK-R">#BlackLivesMatter</a> movement. This has been touching and I’m overjoyed with it all.</p><p>This doesn’t come without its downsides. Unfortunately, several people have died (notably George Floyd was murdered) for this issue to be brought back to the attention of the masses, and the subsequent actions of some have tainted and misdirected the core narrative of the movement (Trump threatening to use military action to crack down on protests for example).</p><p>But this isn’t why I’ve decided to write this post. I’m writing this because someone that I (still) consider a very good friend has publicly written some words that I believe are quite ignorant and actually quite dangerous. In their attempt to show support for the <a href="https://www.facebook.com/hashtag/blacklivesmatter?__eep__=6&amp;__cft__[0]=AZV1JLQxmMfybigMnJ3jJEpbPFbxAU2M43CL4wUBXvhcZayn-a5TR8-Yk8JZT0qUMob8KhtJHX70r2ryAHhInfRK4jeKlXsHBYXiBG-2fKmcCW5hfN2XqIENe0FtaIrsg7A&amp;__tn__=*NK-R">#BlackLivesMatter</a> movement, I feel that they have undermined it. In fact, the sentiment of the words seems to show a misunderstanding of what racism is and how they perpetuate racism in society.</p><p>I no longer have the post so I’ll paraphrase: I’m too intolerant to have racist friends so I don’t have the opportunity to debate with my inner bubble. I also believe that you shouldn’t attack people that have good intentions, in fact, I believe it’s ugly.</p><p>I intend to use this post to explain why I believe this statement is ignorant and why it allows racism to continue. But first, I want to make it clear that there is no love lost with this person. They are amazing and I still consider them a close friend. I just want them to understand my stance and allow others to also see where I stand with this.</p><h3>What is Racism?</h3><p>Unfortunately, racism is a very misunderstood term and each person seems to have their own definition. As I’ve learnt over the years, if two parties don’t agree to the definition of the terms they use in a debate then there is little chance of seeing eye to eye. So I first need to define a few terms.</p><p>To be clear about a common definition of racism that I AM NOT using is “a racist is someone who holds conscious dislike of people because of race, then I agree that it is offensive for me to suggest that you are racist when I don’t know you… I also agree that if this is your definition of racism, and you are against racism, then you are not racist. Now breathe. I am not using this definition of racism, and I am not saying that you are immoral. If you can remain open as I lay out my argument, it should soon begin to make sense.” I’ve stolen these words from one of my favourite books addressing the issue of racism, White Fragility by Robin DiAngelo [1].</p><p>These are my definitions of some concepts:</p><p><strong>Racial prejudice</strong> — This is the preconception about a particular group of people based on their race (typically the colour of their skin). An example are the views put forward by the Mankind Quarterly publication [2] which publishes articles essentially saying that the white race is biologically superior (Find out more information about the history of this publication in [3]). Importantly, racial prejudice works 2 ways. I can, as a black person, be racially prejudice to others, including white people and any other person of colour.</p><p><strong>Racial discrimination</strong> — This typically takes racial prejudice one step further and results in an act that is performed based on someone’s race. The murder of George Floyd fits into this category (if you believe, like me, that it was because of the colour of his skin). Another horrifying example is a paper published in 2016 detailing a study in which medical professionals in the US believe that black people experience pain differently, which affects the assessments and treatments that are given to people of colour [4]. Again, racial discrimination works 2 ways. I can, as a black person, discriminate against someone because of the colour of their skin.</p><p><strong>Racism</strong> — This is the systematic and institutional oppression of a group of people because of the colour of their skin. Importantly, the oppressed group have no power to reverse this and hence the “force” of racism only occurs in one direction. An example is civil rights. Black people could do as much protesting or even racial discrimination, they wanted but ultimately, we required white people to vote for the ability for black people to obtain equal rights. Or when Britain passed the Slavery Abolition Act in 1833 to end Britain’s part in the transatlantic slave trade, it paid 40% of its national budget to compensate for the losses of earnings for slave owners. WE ONLY FINISHED PAYING THIS IN 2015 [5]. So yes, if you paid taxes in this country before 2015, you likely contributed to that compensation regardless of the colour of your skin and whether you supported it or not. (Perhaps this makes it understandable why black people still ask for reparations).</p><p>So to be clear, the racial discrimination that we observe, and that I and other people of colour experience are symptoms of racism. If you broadly disagree with these definitions then you may disagree with the rest of my argument. But now that these are laid out, you can understand the framework from which I come to my beliefs and we can start to have a more constructive discussion.</p><h3>Can I be racist?</h3><p>With the definitions above, it’s clear that both white people and people of colour can be racially prejudiced and perform acts of discrimination based on skin colour. But what is more insidious is that we are all racist. Black and white people alike. You and I.</p><p>How can I say that? We are products of the racialised society that we are raised in. Our school system teaches our children about the history of the British Empire without reference to the slaughter and exploitation of countless people of colour all over the planet. English literature is almost all white authors and if you can name any black authors from childhood English lessons (I can’t think of any) they are referred to as “black authors” as if black authors have an agenda that white authors don’t. The standard of beauty in our media are typically white characteristics. All of this is expected because those people that set the curriculums and the content in our media are largely white. White is default and anything else has an agenda.</p><p>I was brought up in this environment. In my personal experience, I would be called a coconut, bounty, oreo, or any other term that referred to appearing black but being white on the inside. Because black people aren’t smart, we don’t do well in exams. We don’t speak articulately. The only explanation is that you’re white inside. Sometimes I even laughed and joked with my friends about it. I perpetuated racism even at a time when I denied it’s existence. Even the UK grime artist, Akala, admitted that when he would see a black person in the bank depositing large sums of money, his initial thoughts were “drug dealer”.</p><p>So racism is ingrained in all of us simply due to the fact that we are all products of a racialised society. I hope this makes clear why I disagree with the sentiment that you can’t have racist friends. We all do and say and comply with racist things by simply being raised in this society [1].</p><h3>If racism is everywhere why is it so hard to see?</h3><p>Most people you and I know will probably tell you that they aren’t racist (at least I hope that’s the case). However, many events globally suggest that racism is still rife. So what’s with this disparity?</p><p>The first reason for this seems simple to me. People’s definition of racism is very narrow. As long as they have a black friend and don’t lynch a black person in the street, then they’ll consider themselves not a racist. As per my definition above, racism is much more complex than that.</p><p>A couple of my white friends that tell me they are not racist also refer to the diversity and inclusion initiative as “diversity and exclusion”. This is because they feel that it excludes white men. Now I look around at my place of work where out of well over 160 people in tech, I can count the number of black engineers that I know on one hand. So this institutionalised racism can be perpetuated by those who deny that they contribute to it. All they can see is a “loss to their group”, seemingly without realising that people that share their white identity already occupy the vast majority of positions, especially at the most senior and most powerful positions.</p><p><strong><em>ADDITION: </em></strong><em>A friend of mine still disagrees with D&amp;I so I want to add some more information here. I’m a developer and in the latest </em><a href="https://insights.stackoverflow.com/survey/2020#developer-profile-race-and-ethnicity-professional-developers"><em>Stackoverflow 2020 developer survey</em></a><em> only 3.6% of the 38,257 respondents that considered themselves as professional developers identified as “Black or of African descent” [6]. Not only that, but several studies have shown that you are less likely to get a callback for an interview if the name on your resume/CV sounds black [7]. Even the ex British Prime Minister, David Cameron, is quoted in 2015 as saying:</em></p><blockquote>Do you know that in our country today: even if they have exactly the same qualifications, people with white-sounding names are nearly twice as likely to get call backs for jobs than people with ethnic-sounding names?</blockquote><p><em>For which FullFact verified this with another 2009 study stating that applicants with white-sounding names are 74% more likely to get a callback for interviews than applicants with ethnic minority sounding names [8]. So perhaps it’s understandable why I can’t get behind my friend’s “diversity and exclusion” against white men mantra.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3bueb7Tzsz7KZsKFvtuC3w.png" /></figure><p>The other reason that it’s hard to see is even more subtle. Consider something as simple as your journey to work. What obstacles can you think you might encounter on your journey? As a commuter living in a country that can’t seem to get its act together when it comes to operating a train service, my biggest problem are train delays and cancellations. However, most of us are probably unaware of our “able-bodied privilege”. For those with mobility issues, they have to consider obstacles that I have rarely, if ever, considered: navigating stairs, elevators out of service, highly uneven pavements etc. We can go our lives without ever having to consider these obstacles, yet for others these can be a daily hinderance.</p><p>So as a black person talking about racial issues I need to understand that many of my challenges are invisible to white people. Which brings me to my next point.</p><h3>Intent vs Impact</h3><p>I understand that racial issues can be invisible to white people and this means that they can do or say things without realising the impact of their actions. Let me give you a personal example.</p><p>I was having drinks at a pub after work with some friends one day a few years ago and I got chatting to someone I’d never met before. He asked me “where are you from?” When I replied “London” his response was, “No, where are you really from?”. I knew what he was getting at and unfortunately, at the time, I didn’t feel comfortable with causing a scene so I responded by saying “my family are from Jamaica” to which he continued to tell me how much he loves the culture etc.</p><p>So what’s the intent here? This was seemingly not malicious and I imagine there was NO INTENTION to make me feel bad. However, IMPACT of those words is huge. I was born and have lived my entire life in this country. To me this is home. But unfortunately, there are people who seemingly can’t accept this and (un)intentionally make me feel that I can’t call this my home. Is it better for me to not challenge the very statement that makes me feel marginalised because someone thinks that it’s ugly? Or that I might hurt his feelings and make him think that he’s a victim?</p><p>Personally, I wholeheartedly disagree with saying nothing. I wish I could replay that moment again. By not challenging these comments and not challenging actions in similar situations, we allow people to think this behaviour is ok and are therefore complicit in perpetuating racism!</p><p>So this should hopefully clear up my stance on the second half of the statement that my friend posted and why I think it’s dangerous.</p><p><strong><em>ADDITION: </em></strong><em>I want to be clear that as a black person, challenging racism doesn’t have to mean attacking someone. We won&#39;t change minds that way. Think back to the last time you shouted and attacked someone and they all of a sudden stopped and came to your way of thinking. Probably never. We won&#39;t persuade if we aren’t able to challenge racism peacefully and understand that not all racism is intentionally malicious.</em></p><h3>What can be done to combat racism?</h3><p>Many others have already given several suggestions on what you can do to tackle the racial issues today. Here is what I suggest:</p><p>1) Educate yourself. Read books, listen to podcasts, speak to your black friends to understand their experiences.</p><p>2) Self reflect. Not everyone will come to the same conclusions despite reading the same thing. What do you make of racism? Discuss with friends and clarify your thoughts and understanding. I’m under no illusion that everyone will agree with my points and that’s ok. We’re all human and we’re all different.</p><p>3) Most importantly, if you do the above steps and you still see that racism is a problem CHALLENGE IT WHEN YOU SEE IT! This is more important to me than any other action you can take. This is not to undermine the value of other actions such as attending protests, donating to BLM movement, promoting black business etc. But ultimately my hurt comes from my experiences. If someone would support me when they see racism happen it would mean the world to me.</p><p>We aren’t perfect and challenging people can be very difficult. I still don’t always do this when I should. A recent example of a time when I didn’t speak up was just this week. It was brought to my attention yesterday that I was witness to a sexist comment directed at a colleague at work earlier this week. I remember the comment and I remember the awkward silence that occurred for a brief moment afterwards before someone changed the subject. Since then, I learned that one of the women present brought this up with someone else and was disappointed this wasn’t addressed at the time.</p><p>So what should I do now that I failed to clamp down on an act of sexism that occurred in front of me? First off, I need to acknowledge my complicity in perpetuating sexism and speak to the person(s) I know are affected. I need to apologise to them and understand how I can play my part to ensure that this doesn’t happen again. I need to educate myself so that I am better equipped to notice and challenge these situations when I see them happen. If someone has more suggestions for what I should do to improve then please let me know. I am welcome to suggestions to improve myself.</p><p>I too have many steps to take to ensure that I make this society one in which we can all be proud of. A society that can be fair to everyone and gives us all an equal opportunity to contribute and succeed no matter our identity.</p><h3>Final comments</h3><p>I hope that my arguments clarify exactly why I feel the way that I do about my friend’s comments. I want to reiterate that this doesn’t change how I feel about them. They are a great friend and I hope to see them in person when it becomes possible.</p><p>I also want to acknowledge that what I’ve written may make many people uncomfortable. That is my intention. We won’t move forward unless we can embrace these uncomfortable situations. But there is no love lost. When I say that someone has done something racist, this is not an attack on their character because I don’t believe that you need to overtly hate people of colour to do something racist. But it’s about being aware of the fact that we can all be complicit in racism, both white people and people of colour. And Importantly, we should also be able to challenge it when we see it.</p><p>I have been through quite a journey in understanding the nature of racism over the last year or so. Through educating myself I’ve shed several tears because at 31 years old, only now have I understood some of the hurt and anger that my friends and family have held throughout the years. It hurts me to know that I ignored the signs and didn’t support those closest to me through their experiences.</p><p>I’m now expecting a daughter with my white partner and it hurts to know that our daughter will endure some of the pain that I feel now for no other reason than the colour of her skin. I know that we’ll need to address these issues with her because otherwise, it could affect her relationship with her own parents. <strong><em>ADDITION:</em></strong><em> There’s an entire section in [9] in which the author describes how a mixed raced woman has a strained relationship with her white mother because her mother avoided addressing the issue of race altogether. This meant that she felt somewhat abandoned and misunderstood by someone so close to her. I don’t want that for my daughter, my partner or me.</em> But it’s in my power to try to leave this society in a better place than it was when I was born. This post is just one more step toward that goal.</p><p>Lots of Jonny love</p><p><a href="https://www.facebook.com/hashtag/blacklivesmatter?__eep__=6&amp;__cft__[0]=AZV1JLQxmMfybigMnJ3jJEpbPFbxAU2M43CL4wUBXvhcZayn-a5TR8-Yk8JZT0qUMob8KhtJHX70r2ryAHhInfRK4jeKlXsHBYXiBG-2fKmcCW5hfN2XqIENe0FtaIrsg7A&amp;__tn__=*NK-R">#BlackLivesMatter</a></p><h3>References</h3><p>[1] White Fragility: Why It’s So Hard for White People to Talk About Racism by Robin DiAngelo</p><p>[2] Mankind Quarterly — <a href="https://l.facebook.com/l.php?u=https%3A%2F%2Fmankindquarterly.org%2F%3Ffbclid%3DIwAR138JDQK961KsTmTmePgBiqczgJIp0pxIzal3BWS19XMpLq9hZWQwODgL4&amp;h=AT3zyZSMqzEDF_s8mekI2lBCHsdDYw5_5OR4bn_A0ZoLAoPXYWPp9KHH4kdljNUWdWg5jn1LmMQOIfc4jh7YF68JDCTkkSvm4YpBWH_iaeOCTjwrdXm0c1rlpz9va9X-zQhNYW4&amp;__tn__=-UK-R&amp;c[0]=AT14ioLf8KPbU6VtmIV-hkunV4W-7u7KGWCSkScoqgHUfGHwYSmSUevC9UX3uU7C4WpGbp9ZcUBUJuZryWkve7qCxosyDq-jaL1ja_UuKmYRHGNPkWZNbJm4mU0UBc01BPq2hnKM_ft5fRU">https://mankindquarterly.org/</a></p><p>[3] Superior: The return of race science by Angela Saini</p><p>[4] Racial bias in pain assessment and treatment recommendations, and false beliefs about biological differences between blacks and whites <a href="https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.pnas.org%2Fcontent%2F113%2F16%2F4296%3Ffbclid%3DIwAR0vL6te3JMryT_yfFeZ9EHE7xK93xCgrs6oUcGpUwJbbybDFKkzg_HFkgc&amp;h=AT0vXW4g0IA3T_iDu0lmM5VBmw7Sqo8oKoQPpxKWHcW-YFlpAyGXuUpfYh5qIdqfrbwT4iYHWPP5gbvS6oNrNoCSCjYMhnTV9Se4r6YgLMeswk1lKaRQDd0hVRZfNU4G9Dfd-ic&amp;__tn__=-UK-R&amp;c[0]=AT14ioLf8KPbU6VtmIV-hkunV4W-7u7KGWCSkScoqgHUfGHwYSmSUevC9UX3uU7C4WpGbp9ZcUBUJuZryWkve7qCxosyDq-jaL1ja_UuKmYRHGNPkWZNbJm4mU0UBc01BPq2hnKM_ft5fRU">https://www.pnas.org/content/113/16/4296</a></p><p>[5] <a href="https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.theguardian.com%2Fcommentisfree%2F2018%2Ffeb%2F12%2Ftreasury-tweet-slavery-compensate-slave-owners%3Ffbclid%3DIwAR1kRCpEa-LupnOazaZ3l-cJjpMa7UjxSz_b8RSe32HayTlKJA_0V4MwDXk&amp;h=AT2nQyoQ8AbHJr-RsyLy-KBJi-HaSGnb3Zr_nnR2Rlc6uoS1_-v-l3uOJCIHDIrG6FXwBQQrRkKqGOuVvjWLiN72mvrrQftGoW5SJCaHNfLtypw6zX8-KEdOFaxHJOSQaM6yrW8&amp;__tn__=-UK-R&amp;c[0]=AT14ioLf8KPbU6VtmIV-hkunV4W-7u7KGWCSkScoqgHUfGHwYSmSUevC9UX3uU7C4WpGbp9ZcUBUJuZryWkve7qCxosyDq-jaL1ja_UuKmYRHGNPkWZNbJm4mU0UBc01BPq2hnKM_ft5fRU">https://www.theguardian.com/commentisfree/2018/feb/12/treasury-tweet-slavery-compensate-slave-owners</a></p><p>[6] Stackoverflow 2020 developer survey <a href="https://insights.stackoverflow.com/survey/2020#developer-profile-race-and-ethnicity">https://insights.stackoverflow.com/survey/2020#developer-profile-race-and-ethnicity</a></p><p>[7] Are Emily and Greg more employable than Lakisha and Jamal? A field experiment on labor market discrimination: <a href="https://www.nber.org/papers/w9873.pdf">https://www.nber.org/papers/w9873.pdf</a></p><p>[8] Full Fact article: Job applicants with ethnic minority sounding names are less likely to be called for interview <a href="https://fullfact.org/economy/job-applicants-ethnic-minority-sounding-names-are-less-likely-be-called-interview/">https://fullfact.org/economy/job-applicants-ethnic-minority-sounding-names-are-less-likely-be-called-interview/</a></p><p>[9] Why I’m No Longer Talking to White People About Race by Reni Eddo-Lodge</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fedce7725c23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A new plot theme for Matplotlib — Gadfly]]></title>
            <link>https://medium.com/data-science/a-new-plot-theme-for-matplotlib-gadfly-2cffc745ff84?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cffc745ff84</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Mon, 24 Sep 2018 02:51:49 GMT</pubDate>
            <atom:updated>2018-09-24T08:55:48.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swPzVFGpYdijWAmbrydCDw.png" /><figcaption>Sample plots from the new plotting theme inspired by the Gadfly plotting package for the Julia programming language</figcaption></figure><h3>Introduction</h3><p>I’ve made a plotting theme for <a href="https://matplotlib.org/">Matplotlib</a> that’s inspired by the default plotting theme used in <a href="http://gadflyjl.org/stable/">Gadfly</a> for the <a href="https://julialang.org/">Julia programming language</a>. Typically I’d just write the code in Julia, which is what I’ve done for many of my previous blog posts. However, since upgrading to Julia v1.0, I’ve been unable to import Gadfly, which means no more pretty Gadfly plots. So I said to myself “<em>Jonny, it’s time to just create the theme yourself</em>”. And I did!</p><p>(If you want to find out how to use this theme then skip to the last section)</p><h3>More (pretty) plots</h3><h4>KDE plots</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JY11LBy-sAuDSShoRECfAw.png" /><figcaption>Left: Two 1-dimensional kernel density estimate (KDE) plots. Right: A 2D KDE plot.</figcaption></figure><h4>Line plot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFVn1PxD91Y5Kthr9VN9nQ.png" /><figcaption>All the lines. Code to generate the data shamelessly stolen from <em>Jake VanderPlas’s article on how to create </em><a href="https://jakevdp.github.io/PythonDataScienceHandbook/04.01-simple-line-plots.html"><em>Simple line plots</em></a><em> in Python.</em></figcaption></figure><h4>Scatter plot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1HeFoql2plDA_GJmK0LFhw.png" /><figcaption>Scatter plot. Code to generate the plot shamelessly stolen from <a href="https://pythonspot.com/matplotlib-scatterplot/">this article</a> on how to create scatter plots in Python.</figcaption></figure><h3>Plotting with Seaborn</h3><p>When plotting using the Seaborn, the default aesthetics change a little. I haven’t worked out how to change this exactly but I’m not too fussed about it. For example, boxplots are very different (see below)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb575ea49d16993da5a6b9d8aae22348/href">https://medium.com/media/cb575ea49d16993da5a6b9d8aae22348/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUR1DKsF9DmgxOujCdUk2A.png" /><figcaption>Left: Standard matplotlib boxplot function. Right: Boxplot using Seaborn</figcaption></figure><p>When plotting withsns.lmplot the legend is plotted outside of the axes and does not have a border (below). It also draw the left and bottom spines by default too.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a295d6f6e2bc8ea2fbfb4309a5140cd/href">https://medium.com/media/4a295d6f6e2bc8ea2fbfb4309a5140cd/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XC1FRtB_nO7b1OjMdxKkkQ.png" /><figcaption>Scatter plot made with maplotlib’s scatterplot function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vByRdL1xFjRDCwonoWzOuQ.png" /><figcaption>Scatter plot made with seaborn’s lmplot function</figcaption></figure><h3>How to get the theme</h3><p>This theme isn’t installed in the set of themes that come with matplotlib. Therefore, if you want to use the theme you have a few options. I’ll list a couple of the options here but you can learn about all of the ways by reading the matplotlib documentation on <a href="https://matplotlib.org/tutorials/introductory/customizing.html">Customizing Matplotlib with style sheets and rcParams</a>.</p><h4>Option 1</h4><p>Copy the matplotlibrc style sheet contents at the end of this blog post and save it in the same directory as the script from which you want to do your plotting. Save it under the name matplotlibrc . Then it should just work.</p><h4>Option 2</h4><p>Again, copy the matplotlibrc style sheet contents at the end of this blog post but this time save as in mpl_configdir/stylelib as &lt;style-name&gt;.mplstyle. You can find out where mpl_configdir is with matplotlib.get_configdir(). I had to create the stylelib directory because it wasn’t already in the mpl_configdir directory.</p><p>Once you’ve saved the file in the right directory you can then set the theme with</p><pre>import matplotlib.pyplot as plt<br>plt.style.use(&lt;style-name&gt;)</pre><p>So I saved the file as gadfly.mplstyle and I can set the theme with plt.style.use(&#39;gadfly&#39;)</p><h3>The gadfly theme matplotlibrc file</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8c6a2ad683a6256069dcb178be402be/href">https://medium.com/media/f8c6a2ad683a6256069dcb178be402be/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cffc745ff84" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/a-new-plot-theme-for-matplotlib-gadfly-2cffc745ff84">A new plot theme for Matplotlib — Gadfly</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability concepts explained: probability distributions (introduction part 3)]]></title>
            <link>https://medium.com/data-science/probability-concepts-explained-probability-distributions-introduction-part-3-4a5db81858dc?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a5db81858dc</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Mon, 10 Sep 2018 12:53:40 GMT</pubDate>
            <atom:updated>2018-09-13T07:51:54.167Z</atom:updated>
            <content:encoded><![CDATA[<p>In my <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">first</a> and <a href="https://towardsdatascience.com/probability-concepts-explained-rules-of-probability-introduction-part-2-2a9d5a1a9df4">second</a> introductory posts I covered notation, fundamental laws of probability and axioms. These are the things that get mathematicians excited. However, probability theory is often useful in practice when we use probability distributions.</p><p>Probability distributions are used in many fields but rarely do we explain what they are. Often it is assumed that the reader already knows (I assume this more than I should). So I’m going to try to explain what they are in this post.</p><h3>What is a probability distribution?</h3><p>Recall that a <strong>random variable </strong>is a variable whose value is the outcome of a random event (see the first <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">introductory post</a> for a refresher if this doesn’t make any sense to you). For example, a random variable could be the outcome of the roll of a die or the flip of a coin.</p><p><em>A </em><strong><em>probability distribution</em></strong><em> is a list of all of the possible outcomes of a random variable along with their corresponding probability values.</em></p><p>To give a concrete example, here is the probability distribution of a fair 6-sided die.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*tIbRb1ahwZPmeDPj8UUFbQ.png" /><figcaption>The probability distribution for a fair six-sided die</figcaption></figure><p>To be explicit, this is an example of a <strong>discrete univariate probability distribution with finite support</strong>. That’s a bit of a mouthful, so let’s try to break that statement down and understand it.</p><p><strong>Discrete = </strong>This means that if I pick any two consecutive outcomes. I can’t get an outcome that’s in between. For example, if we consider 1 and 2 as outcomes of rolling a six-sided die, then I can’t have an outcome in between that (e.g. I can have an outcome of 1.5). In mathematics, we would say that the list of outcomes is countable (but let’s not go down the path of defining and understanding countable and uncountable sets. It gets weird). <em>You can probably guess when we get to continuous probability distributions this is no longer the case.</em></p><p><strong>Univariate = </strong>means that we only have one (random) variable. In this case, we only have the outcome of the die roll. In contrast, if we have more than one variable then we say that we have a <em>multivariate distribution</em>. In the specific case where we have 2 variables, we often say that it’s a <em>bivariate distribution</em>.</p><p><strong>finite support = </strong>This means that there is a limited number of outcomes. The <em>support</em> is essentially the outcomes for which the probability distribution is defined. So the support in our example is. 1, 2, 3, 4, 5 and 6. And since this is not an infinite number of values, it means that the support is finite.</p><h3>Introduction to functions</h3><h4>Why are we talking about functions?</h4><p>In the above example of rolling a six-sided die, there were only six possible outcomes so we could write down the entire probability distribution in a table. In many scenarios, the number of outcomes can be much larger and hence a table would be tedious to write down. Worse still, the number of possible outcomes could be infinite, in which case, good luck writing a table for that.</p><p>To get around the problem of writing a table for every distribution, we can define a function instead. <em>The function allows us to define a probability distribution succinctly</em>.</p><p>So let’s first define what a function is generally and then we’ll move onto functions used for probability distributions.</p><h4>What is a function?</h4><p>On a very abstract level, a function is a box that takes an input and returns an output. For the vast majority of cases, the function actually has to do something with the input for the output to be useful.</p><p>Let’s define our own function. Let’s say that this function takes in a number as input, adds 2 to the input number, and returns the new number as output. Graphically our function (as a box) looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1FogXgeBknVVcP9eZU_cw.png" /><figcaption>The abstract depiction of a function as a box that takes input and returns an output. In this case, the function adds 2 to the input.</figcaption></figure><p>So if our input was 5, our function would add 2 to it and return the output 5+2 = 7.</p><h4>Notation for functions</h4><p>Now it would be tedious to draw the digram above for every function that we want to create. Instead, we use symbols/letters to represent the diagram to make it more concise. Rather than write the word “input” we use “x”, rather than write the word “function” we write “f” and rather than write the word “output” we write “f(x)”. So the above diagram can now be written as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUMuwHJhFSb52_ZD2TFlbg.png" /><figcaption>Our function is written with symbols instead of words to make this more concise</figcaption></figure><p>This is better, however, we still have the problem that we have to draw a diagram to understand what the function is doing. We’re mathematicians though, we don’t want to waste precious energy by drawing a box, so we’ve come up with a better way of writing functions that means we don’t have to draw anything. We can define our function mathematically as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*njmg18I4wFSn6_3pQG_pvw.png" /><figcaption>Our function is now written without having to draw arrows and boxes.</figcaption></figure><p>This is equivalent to the diagram above because we can see explicitly the input to the function f is x, we’ve called our function f and we know that the function adds 2 to the input and returns x + 2 as the output.</p><p>It’s important to note that the choice of letter for the function and the input was arbitrary. I could say that “a” is the input and I can call the function “add_two” so my function would be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*Ih9vCocPsL1LP2G_bRY_qw.png" /><figcaption>Another way of writing the same function</figcaption></figure><p>and this is completely equivalent to the function above.</p><p>One of the main takeaways from this is that with a function we can see how we would transform any input. With the function f(x) = x+ 2, We’d know what to do if the input was x=10 or if the input was x=10000. So we don’t need to write down a table like we did earlier in the post.</p><p>The final point I want to make here is that the functions that we’re going to use are solely going to work with numbers as both input and output. However, functions can take anything you like as an input and output anything you like (even output nothing). For example, we could write a function in a programming language that takes a string of text as input and outputs the first letter of that string. Here is an example of this function in the Python programming language</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*-jx-ynh9PhpoIQHElwiBeA.png" /></figure><h4>Representing functions graphically</h4><p>Given that one of the main benefits of functions is to allow us to know how to transform any input, we can also use this knowledge to visualise the function explicitly. Let’s stick with our example f(x) = x+2. Graphically it looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1M-Ad9RsZF8ntIpPV_9_Jw.png" /><figcaption>Graphical representation of our function f(x) = x + 2</figcaption></figure><p>We can read along the horizontal axis on the bottom as our input numbers and the corresponding numbers on the vertical axis on the left are the output values f(x) = x+2. For example, we can see that the blue line that represents the function crosses the point where the vertical (white) line at x=1 intersects the horizontal (white) line f(x) = 3. This graphically shows that f(1) = 1 + 2 = 3.</p><h4>Parameters of functions</h4><p>One of the most important features of functions are parameters. Parameters are the numbers that you find inside the functions that you don’t necessarily feed in as input. In our example, f(x) = x + 2, the number “2” is a parameter because we need it to define the function but we don’t include it as input to the function.</p><p>The reason that parameters are important is that they play a direct role in determining the output. For example, let’s define another function h(x) = x+3. The only difference between the function f(x) = x+2 and our new function h(x) = x+3 is the value of the parameter (we now have a “3” instead of a “2”). This difference means that the outputs we get are completely different for the same input. Let’s look at this graphically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3oUQ2zzuZ2opR_5f1T8Ipg.png" /><figcaption>The difference between our functions f(x) = x + 2 and h(x) = x + 3</figcaption></figure><p>Parameters are arguably the most important feature of a probability (distribution) function because they define the output of the function which tells us the likelihood of certain outcomes in a random process. It’s often parameters that we’re trying to estimate in problems that come up in data science and I’ve previously written about 2 methods that we can use to estimate them: <a href="https://towardsdatascience.com/probability-concepts-explained-maximum-likelihood-estimation-c7b4342fdbb1">maximum likelihood estimation</a> and <a href="https://towardsdatascience.com/probability-concepts-explained-bayesian-inference-for-parameter-estimation-90e8930e5348">Bayesian inference</a>.</p><p>Now we’re ready to talk about probability distributions using the language of functions.</p><h3>Probability mass functions: Discrete probability distributions</h3><p>When we use a probability function to describe a discrete probability distribution we call it a <strong>probability mass function</strong> (commonly abbreviated as pmf).</p><p>Remember from the <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">first introductory post on probability concepts</a> that the probability of a random variable, which we denote with a capital letter, X, taking on a value, denoted with a lowercase letter, x, is written as P(X=x). So if we use the dice roll as our example random variable, we can write the probability of the die landing on the number 3 as P(X=3) = 1/6.</p><p>A probability mass function, which we’ll call “f” returns the probability of an outcome. Therefore, a probability mass function is written as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*YLtTYCZyYM6kPlAOdEpK4w.png" /></figure><p>I know this is getting a little horrible and mathematical but bear with me. The equation that we see above says that the probability mass function “f” just returns the probability of the outcome x.</p><p>So let’s go back the example of the fair 6-sided die (you’re probably already sick of this example). The probability mass function, f, just returns the probability of the outcome. Therefore the probability of rolling a 3 is f(3) = 1/6. That’s it.</p><p>Since a probability mass function returns probabilities it must obey the <a href="https://towardsdatascience.com/probability-concepts-explained-rules-of-probability-introduction-part-2-2a9d5a1a9df4">rules of probability (the axioms) that I described in my previous post</a>. Namely, the probability mass function outputs values between 0 and 1 inclusive and the sum of the probability mass function (pmf) over all outcomes is equal to 1. Mathematically we can write these two conditions as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*78UgmQdiavDTl5YGeBqvZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*Bnz2smNHl5mfgcbjWqepkg.png" /></figure><p>So we’ve seen that we can write a discrete probability distribution as a table and as a function. We can also represent the die roll example graphically</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3ywUfiUiAN59dU04B19OA.png" /><figcaption>Graphical representation of the probability distribution for outcomes of rolling a fair six-sided die</figcaption></figure><h4>Example discrete probability distribution: The Bernoulli distribution</h4><p>Some probability distributions crop up so often that they have been extensively studied and have names. One discrete distribution that crops up a lot is called the Bernoulli distribution. It describes the probability distribution of a process that has two possible outcomes. An example of this is a coin toss where the outcome is heads or tails.</p><p>The probability mass function of a Bernoulli distribution is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*sB9TbNE3ynUJrHV5LR7dYw.png" /></figure><p>Here, x represents the outcome and takes the value 1 or 0. So we could say that heads = 1 and tails = 0. p is a parameter that represents the probability of the outcome being 1. So in the case of a fair coin where the probability of landed heads or tails is 0.5 we would set p = 0.5.</p><p>Often we want to be explicit about the parameters that are included in the probability mass function so we write</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*ms2KkFuKss2q3sT_O5-Rhw.png" /></figure><p>Notice that we use the semicolon to separate the input variables from the parameters.</p><h3>Probability density functions: Continuous probability distributions</h3><p>Sometimes we are concerned with the probabilities of random variables that have continuous outcomes. Examples include the height of an adult picked at random from a population or the amount of time that a taxi driver has to wait before their next job. For these examples, the random variable is better described by a continuous probability distribution.</p><p>When we use a probability function to describe a continuous probability distribution we call it a <strong>probability density function</strong> (commonly abbreviated as pdf).</p><p>Probability density functions are slightly more complicated conceptually than probability mass functions but don’t worry, we’ll get there. I think it’ll be easiest to start with an example of a continuous probability distribution and then discuss the properties from there.</p><h4>Example continuous probability distribution: The Normal distribution</h4><p>The normal distribution is probably the most common distribution in all of probability and statistics. One of the main reasons it crops up so much is due to the Central Limit Theorem. We’re not going to go into it in this post but here is a nice article by <a href="https://medium.com/u/24104a01fc98">Carson Forter</a> called “<a href="https://towardsdatascience.com/the-only-theorem-data-scientists-need-to-know-a50a263d013c">The Only Theorem Data Scientists Need To Know</a>” that explains what the theorem is and how it relates to the normal distribution.</p><p>The probability density function for the normal distribution is defined as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*rYkCHU-e0_YYFEu1i-IzEQ.png" /></figure><p>Where the parameters (i.e. the symbols after the semicolon) represent the mean, μ, (the point where the centre of the distribution is) and the standard deviation, σ, (how spread out the distribution is) of the population.</p><p>If we set the mean to be equal to zero (μ=0) and the standard deviation equal to 1 (σ=1) then the distribution we get looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUhuUCVtXArhrJJmxPEpVw.png" /><figcaption>Normal distribution with mean = 0 and standard deviation equal to 1</figcaption></figure><p>The normal distribution is an example of a <em>continuous univariate probability distribution with infinite support</em>. By infinite support, I mean that we can calculate values of the probability density function for all outcomes between minus infinity and positive infinity. In mathematics, we sometimes say that it’s supported on the <em>whole real line.</em></p><h4>Properties of a continuous probability distribution</h4><p>The first thing to notice is that the numbers on the vertical axis start at zero and go up. This is a rule that a probability density function has to obey. Any output value from a probability density function is greater than or equal to zero. In mathematical lingo we would say that the output is non-negative or write this mathematically as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*wmm0Z297t7QnMpah_lwwUQ.png" /></figure><p>However, unlike probability mass functions, the output of a probability density function is <strong>not a probability value.</strong> This is an incredibly important distinction, one of which I’ve been guilty of forgetting.</p><p>To get the probability from a probability density function we need to find the area under the curve. So from our example distribution with mean = 3 and standard deviation = 1, we can find the probability that the outcome is between 0 and 1 by finding the area shown in the image below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeKUQOQrBZe5E1U78QAu7w.png" /><figcaption>The area shaded is the probability of the outcome being between 0 and 1.</figcaption></figure><p>Mathematically we would write this as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*_WNmF30UHkmlJgTHF2Fpqw.png" /></figure><p>We can read this as “<em>the integral of the probability density function between 0 and 1 (on the left-hand side) is equal to the probability that the outcome of the random variable is between zero and 1 (on the right-hand side)</em>”.</p><p>Forgive me as I haven’t explicitly covered integrals and how they work (I have a brief conceptual introduction to integrals in my <a href="https://towardsdatascience.com/probability-concepts-explained-marginalisation-2296846344fc">post on marginalisation</a> but it doesn’t teach you how to compute them). If you don’t know about them then all you need to know for the moment is that it’s a mathematical method for finding the area under a curve, which in this case gives us the probabilities of outcomes. Perhaps I need to write a brief series covering introductory calculus.</p><p>We’ve now seen another property of probability density functions. Namely that the probability between two outcomes, let’s say ‘a’ and ‘b’, is the integral of the probability density function between those two points (this is equivalent to finding the area under the curve produced by the probability density function between the points ‘a’ and ‘b’). Mathematically this is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*XQl6sErHa1lXm-lTw-emhA.png" /></figure><p>Remember that we still have to follow the rules of probability distributions, namely the rule that says that the sum of all possible outcomes is equal to 1. We can cover all possible values if we set our range from ‘minus infinity’ all the way to ‘positive infinity’. Therefore the following has to be true for the function to be a probability density function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*odcoyqvApg1kLewsIY7aew.png" /></figure><p>This says that the area under the curve between minus infinity and positive infinity is equal to 1.</p><p>An important thing to know about continuous probability distributions (and something that may be really weird to come to terms with conceptually) is that the probability of the random variable being equal to a specific outcome is 0. For example, if we try to get the probability that the outcome is equal to the number 2 we would get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*Ps_Q3Chl1cDQGQrBGVvv9Q.png" /></figure><p>This may seem weird conceptually but if you understand calculus then it should make a little more sense. I’m not going to cover calculus in this post. Instead, what I want you to take away from this fact is that we can only talk about probabilities occurring between two values. Or we can ask about the probability of an outcome being greater than or less than a specific value. We <strong>can’t </strong>ask about the probability of an outcome being equal to a specific value.</p><p>The eagle-eyed readers may have noticed that I’ve used “less than (&lt;)” and “greater than (&gt;)” symbols rather than “less than or equal to (≤)” and “greater than or equal to (≥)” symbols. For continuous probability distributions, it doesn’t actually matter because they’re the same. Explicitly I mean</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*Tugs4_sj_EFNHd0dB02YZQ.png" /></figure><p>So the probability of the random variable taking on a value between a and b exclusive is the same as the probability of it taking on a value between a and b inclusive.</p><h4>The importance of parameters</h4><p>We saw that parameter values can change the output values of a function and it’s no different with probability distributions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knCUJJjFHW92ec8d8iq4kQ.png" /><figcaption>Two normal distributions with different parameters give completely different probability outcomes.</figcaption></figure><p>In the figure above we’ve plotted the probability density functions of two normal distributions. The blue distribution has parameter values μ=0 and σ=1 whereas the red distribution has parameter values μ=2 and σ=0.5.</p><p>It’s clearer to see now why using the wrong parameter values can give results that differ wildly from what you might expect.</p><h3>Summary</h3><p>Wow! That was much longer than I intended. Let’s summarise the main points:</p><ul><li>A <strong>probability distribution</strong> is a list of outcomes and their associated probabilities.</li><li>We can write small distributions with tables but it’s easier to summarise large distributions with functions.</li><li>A function that represents a discrete probability distribution is called a <strong>probability mass function</strong>.</li><li>A function that represents a continuous probability distribution is called a <strong>probability density function.</strong></li><li>Functions that represent probability distributions still have to obey the <a href="https://towardsdatascience.com/probability-concepts-explained-rules-of-probability-introduction-part-2-2a9d5a1a9df4">rules of probability</a></li><li>The output of a <em>probability mass function is a probability</em> whereas <em>the area under the curve produced by a probability density function represents a probability</em>.</li><li>Parameters of a probability function play a central role in defining the probabilities of the outcomes of a random variable.</li></ul><p>I initially wanted to cover multivariate distributions in this post but it got too long so we’ll cover it in a later post.</p><p>Now that you have the basic understanding of what a probability distribution is, check out <a href="https://medium.com/@srowen/common-probability-distributions-347e6b945ce4">this great article</a> by <a href="https://medium.com/u/c145ff55eeea">Sean Owen</a> which covers the common probability distributions used in data science. He does a fantastic job explaining why each distribution arises in data science, so it’s a more practical look at probability distributions. For a more extensive list of probability distributions check out <a href="https://en.wikipedia.org/wiki/List_of_probability_distributions">this Wikipedia page</a> (the list is quite long).</p><p>As always, thanks for reading this far. I hope this has been useful and you’ve learnt something from it. Please feel free to leave comments, suggestions and questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a5db81858dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/probability-concepts-explained-probability-distributions-introduction-part-3-4a5db81858dc">Probability concepts explained: probability distributions (introduction part 3)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability concepts explained: Rules of probability (introduction part 2)]]></title>
            <link>https://medium.com/data-science/probability-concepts-explained-rules-of-probability-introduction-part-2-2a9d5a1a9df4?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a9d5a1a9df4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Mon, 03 Sep 2018 13:10:11 GMT</pubDate>
            <atom:updated>2018-09-03T13:10:11.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GaL2yyl1PIZyBokyEWWffQ.jpeg" /></figure><p>When I wrote the <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">introductory post</a> to this series, I covered some fundamental probability concepts (marginal, conditional and joint probabilities, independence and mutual exclusivity, and the “and” and “or” rules for combining probabilities). However, I missed some of the other fundamental rules that I took for granted and assumed that the reader knew when I wrote subsequent posts.</p><p>Therefore in this post I’m going to cover a few more of the core rules in probability theory. If you’re new to this then I recommend going through the <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">first introductory post here</a> so you can familiarise yourself with the notation and some definitions.</p><h3>Rules of probability (Axioms)</h3><p>When mathematicians explore new fields of maths they often start with a set of rules that define what they can do. It’s a bit like being the first to invent the game of football (soccer) and setting the rules that say ‘<em>only 11 players on the pitch for team, you can’t touch the ball with your hands, offside rule, etc’. </em>Once these rules are set, players and managers are free to explore and be as creative as they want with new ball skills and fancy team formations.</p><p>Probability theory (and maths in general) is no different. We call these rules <strong><em>axioms</em></strong>. Once the rules are set, mathematicians go crazy and explore new theorems and results. As long as the axioms are adhered to, then you can do what you want</p><p>Let’s go through the probability axioms.</p><h4>Axiom 1</h4><p>The first rule states that <strong>the probability of an event is bigger than or equal to zero</strong>. In fact, we can go further and say that the probability of an event is between 0 and 1 (inclusive).</p><p>Let’s write this mathematically. If we say that the probability of an event is between 0 and 1 (inclusive) then we would write this as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*9XA4-HkFDFFSt9HKUDAV7A.png" /></figure><p>When I say “event” I mean “something happens”. For example, we could be talking about the weather tomorrow and the event would be outcome that it rains tomorrow. So the probability of the event that it rains tomorrow could be 0.5. Mathematically, we write this as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*sYfQWecqnOojwAoqi6MN2A.png" /></figure><p>It is possible to group outcomes into an event and say that an event is the outcome that it rains or snows tomorrow. In this way, an <strong><em>event</em> is actually a collection of outcomes</strong>.</p><h4>Axiom 2</h4><p>This rule states that <strong>the probability of at least one of the possible outcomes happening is 1.</strong> I will take liberty to go further and say that if you add up the probability of all possible outcomes you will get a probability of 1. The hardcore mathematicians will hound me for that because there are some caveats around this but for the majority of the cases we’ll come across, the second statement will hold.</p><p>Let’s take rolling a fair 6-sided die as an example. If I roll the die then one of six outcomes is possible. The die will either land on a 1, 2, 3, 4, 5 or 6. Therefore the probability that I get at least one of those outcomes is 1. A probability equal to 1 means that we’re <em>certain</em>.</p><p>Again, the second statement that I made holds. There are 1 of 6 possibilities and the probability of rolling any one of them is 1/6. So if we add up the probabilities of getting a 1, 2, 3, 4, 5 or 6 then we get 1. See below</p><p>P(die = 1) + P(die = 2) + P(die = 3) + P(die = 4) + P(die = 5) + P(die = 6) = 1/6 + 1/6 + 1/6 + 1/6 + 1/6 + 1/6 = 6/6 = 1.</p><p>Writing all of the terms in the sum is quite tedious, especially when you’ve got hundreds of outcomes, so to shorten it mathematicians would write</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*OC5sBNbtU-Wk9iRoe9Re2Q.png" /></figure><p>Yes, that big “E”-looking symbol just tells us to add things up and the stuff below and above it tells us where to start and end. So this says “<em>start at i=1 and go all the way up to i=6”</em><strong><em>.</em></strong></p><p>So we can now write the statement <em>“adding up the individual probabilities of all possible outcomes will equal 1” </em>mathematically as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*EOzRVVojgGb-T5d0CftHGg.png" /></figure><p>There is a special term that we use instead of saying “all possible outcomes” — it’s called the <strong>sample space</strong>. So the outcomes 1, 2, 3, 4, 5 and 6 for a 6-sided die is in fact the <em>sample space</em>. Mathematically the sample space is denoted with a Ω. So we can also write the above mathematically as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/172/1*Pcdk07NCxkKva8aTITQfUQ.png" /></figure><h4>Axiom 3</h4><p>This axiom is probably the most confusing to read but I covered it in the introductory post when we covered mutual exclusivity. I’ll state the axiom and then give the example.</p><p>The axiom says <strong>if two events are mutually exclusive (i.e. the two events can’t both occur at the same time) then the probability of either of them happening is equal to the sum of the individual (marginal) probabilities of them happening.</strong> I told you it was confusing. Let’s try to clarify this with the example from the first introductory post.</p><p>Suppose we roll a fair 6-sided die and we want to know the probability of rolling a 5 or a 6. <em>These events are </em><strong><em>mutually exclusive</em></strong><em> because I can’t roll a 5 and a 6 at the same time</em>. So the probability of rolling a 5 or a 6 is equal to the probability of rolling a 5 plus the probability of rolling a 6: 1/6 + 1/6 = 2/6 = 1/3.</p><p>Mathematically we can write this axiom as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qt3ZvtrrC7GWPDRrRnoWJg.png" /></figure><p>given outcome 1 and outcome 2 are mutually exclusive (they can’t both happen at the same time).</p><p>I know this post was quite possibly duller than my previous posts, and that’s saying something considering my other posts in this series are all about maths too, but I thought that it was important to cover some of the fundamentals that are often required to understand more advanced stuff but erroneously assumed.</p><p>The next post will also be an introductory one and I’ll aim to explain what probability distributions are and some of the different types you can get (discrete, continuous, univariate and multivariate).</p><p>Thanks for reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a9d5a1a9df4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/probability-concepts-explained-rules-of-probability-introduction-part-2-2a9d5a1a9df4">Probability concepts explained: Rules of probability (introduction part 2)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to construct valuable data science projects in the real world]]></title>
            <link>https://medium.com/data-science/how-to-construct-valuable-data-science-projects-in-the-real-world-203a4f520d54?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/203a4f520d54</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[feedback-loop]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Mon, 27 Aug 2018 17:36:42 GMT</pubDate>
            <atom:updated>2018-08-30T08:51:11.660Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lessons learned by making several mistakes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6ZU7TRjiPNpFEdxuQ7WmA.jpeg" /></figure><h3>Introduction</h3><p>Most articles about how to “complete” a data science <strong>task </strong>usually discuss how to write an algorithm to solve a problem. For example how to classify a text document or forecast financial data. Learning how to do these things can be vital knowledge for a data scientist if it falls within their remit. However, the <strong>task </strong>is just a small part of the process of <strong>completing a data science project </strong>in the real world. Even if you can code up the perfect solution to a multi-class text classification problem, is it actually valuable to the business? What’s the current solution to the problem and what benchmark do you have to surpass so that the user can trust it’s output? When the algorithm is up and running in production are you getting feedback to understand whether the output is continually producing usable results?</p><p>In this post I want to set out some guidelines on developing and carrying out effective and sustainable data science projects. This guide is a list that I came up with after making several mistakes in my own data science projects as well as seeing others making their own. Some of this wont apply to all data scientists because not all of this will fall into their remit. However, I’ve been in a team where we didn’t have the luxury of a dedicated business analyst, product manager or even a data science manager. It meant that I had to take on some of the responsibilities of these roles myself and often, not do a great job of it. But it was a valuable learning experience and here are some of the things that I’ve learned.</p><ul><li><strong>Special mention: </strong>Regardless of whether you agree with my waffling or not you should <a href="https://blog.dominodatalab.com/stakeholder-driven-data-science-warby-parker/?utm_campaign=Revue%20newsletter&amp;utm_medium=Newsletter&amp;utm_source=Self%20Driven%20Data%20Science">check out the video in this article</a> on how to do stakeholder driven data science by <a href="https://www.linkedin.com/in/mshron/">Max Shron,</a> the head of data science at <a href="https://www.warbyparker.com/">Warby Parker</a>. It’s amazing and sets a great bar for doing good data science projects in the real world.</li></ul><h4>What questions should be addressed for a project to be considered successful?</h4><p>When coming up with a solution to a problem I find it useful to picture what success looks like (here we’re assuming that we already know what the problem is, but don’t underestimate how hard it can be to identify a problem that your team is currently setup up to be able to solve). This helps me to develop strategies get to the end goal. In this case I want to write down a set of questions that I can answer immediately if the project is successful. Here they are:</p><ol><li>Why are you doing the project? I.e. what value does the project bring and how does it contribute to the wider data science team goals?</li><li>Who are the main stakeholders of the project?</li><li>What is the current solution to the problem?</li><li>Is there a simple and effective solution to the problem that can be performed quickly?</li><li>Have you made an effort to involve the right people with enough notice and information?</li><li>Have you sense-checked your solution with someone else?</li><li>Have you made an effort to ensure that the code is robust?</li><li>Have you made an effort to make sure that the project can be easily understood and handed over to someone else?</li><li>How are you validating your model in production?</li><li>How are you gathering feedback from the solution?</li></ol><p>In my experience if these questions can be answered <em>adequately </em>then the project is likely to be successful. This may not always be the case and this list may be far from exhaustive depending on the project, but it’s at least a good starting point.</p><p><a href="https://medium.com/u/fc065d3295b8">Kate Strachnyi</a> has a set of <a href="https://towardsdatascience.com/20-questions-to-ask-prior-to-starting-data-analysis-6ec11d6a504b">20 Questions to Ask Prior to Starting Data Analysis</a> in a much shorted article if you decide you would rather not make your way through my mammoth brain fart (I wouldn’t blame you).</p><p>The steps below help in addressing each of these questions.</p><h3>5 step guideline for data science projects</h3><h4>Step 1: Get an initial evaluation of the potential value of the project</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZaN5NShbcGh7RlVQ4j3yYA.jpeg" /></figure><ul><li><strong>Why do it? </strong>It helps you prioritise projects. You should be able to adequately explain why one project should be completed before another. It also allow us to understand how the project aligns with the goals of the team and the company. In addition, this will also provide some guidance on what metric we should optimise for the model.</li><li><strong>What does this involve? </strong>Rough quantification of benefits e.g. money saved, revenue increase, reduce time spent on manual labour. The argument against this is that it’s hard to do and not always quantifiable. My response is: <em>if you or your stakeholders can’t figure out the value of the project then why are you allowing yourself or your stakeholders to </em><strong><em>waste</em></strong><em> </em><strong><em>your time?</em></strong><em> </em>The value doesn’t have to be perfect, just a ballpark estimate. This step also involves determining who the main stakeholders are?</li><li><strong>What happens if it’s not done? </strong><em>We may spend ages doing a project that no one benefits from</em>. One example of a project that I saw could’ve done with better scoping was where the data science team was tasked with identifying a list of people who were most likely to benefit from being contacted by our marketing team. A model was built but we decided to spend a couple months improving it. Despite the new model giving better results, the team had to adjust their threshold because the business didn’t care about the scores just were generated for each customer, instead they wanted to make sure they were contacting a fixed number of people. So it’s arguable that the time spent improving the model was pointless and we would’ve known this if we scoped the project better with the stakeholders. (An argument could be made that the fixed number of people contacted are actually a better segment due to a better model but this wasn’t measured so we don’t know whether this is the case).</li><li><strong>What is the outcome from this step? </strong>A rough quantitative estimate of the value of the project accompanied with a brief paragraph giving more context (an executive summary of the project). It’s important to note that depending on the company and the project, just the perceived value gain of having a data model is good enough for the business to deem the project a success. In which case a quantitative estimate isn’t necessary. But that’s more about <a href="https://www.rdisorder.eu/2017/09/13/most-difficult-thing-data-science-politics/">company politics</a> and can only happen for so long before you need hard number to show your team’s worth.</li><li><strong>Useful resources: </strong>This article titled “<a href="https://uxdesign.cc/a-simple-way-to-model-roi-of-any-new-feature-a9828fbba27e">A Simple way to Model ROI of any new Feature</a>” helps a lot. Give a simple formula: <em>Expected ROI = (reach of users * new or incremental usage * value to business) - development cost</em>. Other useful reads are “<a href="https://towardsdatascience.com/prioritizing-data-science-work-936b3765fd45">Prioritizing data science work</a>” and “<a href="https://medium.com/@gpat_uk/product-and-prioritisation-e76122b2dcf9">Product and Prioritisation</a>”</li></ul><h4>Step 2: <strong>Determine current approach/Create baseline model</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QvGCvIMvxZHbIpDTRSgwDQ.png" /><figcaption><a href="https://towardsdatascience.com/first-create-a-common-sense-baseline-e66dbf8a8a47">Source: Create a Common-Sense Baseline First</a></figcaption></figure><ul><li><strong>Why do it? </strong>The current approach gives us a benchmark to target. All useful models should beat the current approach, if there is one. If there is no current solution to the problem then you should develop a baseline model. The baseline model is essentially the solution to the problem without machine learning. It’s likely that a complex solution may only provide incremental value so you’ll need to evaluate if it’s actually worth building anything more complex.</li><li><strong>What does this involve? </strong>Speak to stakeholders to determine what they currently do and what success they have. It’s likely they don’t measure their success rate so it’s something that you’ll have to estimate/calculate. Building a baseline model should not involve any complex/involved methods. It should be fairly quick and rudimentary. Probably using counting methods.</li><li><strong>What is the outcome of this phase? </strong>A baseline evaluation number of the performance required to be successful/useful for stakeholders. An assessment of whether a complex model is worth building.</li><li><strong>What happens if not done: </strong>You could waste time building a complex model that, at best, probably wasn’t worth the time spent getting the additional accuracy, or at worst, doesn’t even best the current approach. This was something that was missed when we built our recommendation engine. We didn’t check that the algorithm was better than a sensible baseline (recommending the most popular content). It could’ve been that the recommendation algorithm didn’t provide enough value to warrant doing it when we did.</li><li><strong>Resources to help: </strong>The articles titled “<a href="https://towardsdatascience.com/first-create-a-common-sense-baseline-e66dbf8a8a47">Create a Common-Sense Baseline First</a>” and “<a href="https://blog.insightdatascience.com/always-start-with-a-stupid-model-no-exceptions-3a22314b9aaa">Always start with a stupid model, no exceptions.</a>” are good reads that emphasise this point.</li></ul><h3>3. Have a “Team” discussion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZk40FSSOPa6ddDVG-1dJg.jpeg" /></figure><ul><li><strong>Why do it? </strong>At this point you’ve come to the conclusion that this project is worth doing (step 1) and success is feasible (step 2) so it’s time to speak to the people involved in making the project successful e.g. engineers and/or other data scientists are obvious candidates. You should be clearer about what code you should write, what data you need, what you should test, what performance measure to use, what model approaches you should try. It’s easy to think you know what you need on your own but having discussions with others can often help highlight things you’ve missed or things that could be improved. Don’t underestimate the importance of having people with different viewpoints contribute to the discussion.</li><li><strong>What does it involve? </strong>Speak to at least one other data scientist and show them the results you’ve obtained so far. Perhaps they have ideas about how you can improve on your idea. It’s vital you do this before you start on the model because you’ll be less likely to change your model once it’s written. Also the data scientist you speak to might be the one doing your code review and so it’ll help them with context. Speak to the engineer that will be involved in productionising your work. They’ll likely need to know what to expect and may have suggestions that will make productionising code much easier.</li><li><strong>What is the outcome of this phase? </strong>Nothing concrete! Just something to ensure quality is as good as it can be first time round. Ensure that the relevant people are aware and onboard with the project.</li><li><strong>What happens if not done: </strong><em>Best case</em>: you’ve managed to think about and avoid all pitfalls on your own. However, it’s more likely that you’ve haven’t thought about everything and there’ll be important things that you’ll have missed. Typical cases of the problems here include unmanageable transfer and handling of storage files when the model is moved into production. Model output misses the mark and isn’t in the most useful form. This was the case with one of the models I produced. I wrote code that made multiple API calls, many of which were unnecessary. It was fine on a small dataset which I ran locally, but the servers struggled with the load in production. It wasn’t fixed until I spoke to an engineer that helped me diagnose the problem.</li></ul><h3>4. Model Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*hBkEo9-KXFAlRpXVMl8zhw.png" /></figure><ul><li><strong>Why do it? </strong>This is the model that we use to ultimately solve the problem.</li><li><strong>What does it involve? </strong>The difference lies in what’s involved. It’s not only about creating a model. There are countless articles about how to write machine learning algorithms to solve specific problems so I wont explain this here. Instead it’s important to emphasise some steps that should be carried out to produce high quality production code. In the development process you should be doing regular <strong>code reviews. </strong>Remember that you are likely not to be the only one that sees the code and, you are not the only one invested in the success project so there should be good <strong>code documentation.</strong> This is vital for the longevity of the project. There will almost certainly be bugs and unexpected inputs in production so you can mitigate these issues by performing <strong>code testing</strong> to improve the robustness of the code. This includes unit testing, integration testing, system testing and user acceptance testing (UAT). The specifics of how to make your code productionisable may vary from one team to the next but other things that will help are: working in an isolated environment (virtual environments or Docker containers), using logging to write log files, using configuration files so the configuration is separate to the main code.</li><li><strong>What is the outcome of this phase? </strong>A shared (Github) repository with the required files and a working model that solves the problem defined in the project.</li><li><strong>What happens if not done: </strong>The model has to be completed otherwise the problem will not have been solved. If your code isn’t tested there’ll be mistakes with logic that may not be noticed until production. If the code isn’t reviewed by someone else or it’s not documented, it’ll be difficult for other people to take over when you inevitably leave the company or are on annual leave. Some of these issues would crop up consistently on projects that I’d done previously that weren’t robust. I was still fixing bugs on a project that I was involved with 9 months after it was “completed” because the code was not robust. This eats into time that you could be using to do other valuable things and it causes lots of frustration for everyone involved. Make sure you spend the extra time required to make the code robust during the development period because it will save you time in the long run.</li><li><strong>Resources </strong>There are loads but these are some of the ones that I’ve read that I really like:</li><li>At the very top of the list here is an article called “<a href="https://towardsdatascience.com/how-to-write-a-production-level-code-in-data-science-5d87bd75ced">How to write a production-level code in Data Science?</a>” It covers pretty much everything that I can think of. If you’re a data scientist building production level code then you should read it.</li><li>Code reviews: <a href="https://medium.com/apteo/code-reviewing-data-science-work-774747248e33">Code reviewing data science work</a> and An <a href="https://medium.com/@starkja/doing-code-review-solo-writing-good-code-tips-from-srccon-2017-d408fdbaa350">article about how to ‘do code reviewing by yourself’</a> i.e. writing in such a way that it serves as being reviewed (this is not a substitute for doing actual code reviews, it’s only here to help you think about how to write good code)</li><li>Code documentation: A good guide on <a href="https://medium.com/@alexevakimov/code-documentation-guide-9a846669944b">how to document code properly</a>. I also really like <a href="http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html">numpy style docstrings</a></li><li>Code testing: A guide on how to write <a href="https://medium.com/@keeper6928/how-to-unit-test-machine-learning-code-57cf6fd81765">unit tests for machine learning code</a>. This is a good guide for writing <a href="https://semaphoreci.com/community/tutorials/testing-python-applications-with-pytest">unit tests using Python’s Pytest library</a>. I used this to help me write my first set of tests for one of my projects. The same company also have an article on <a href="https://semaphoreci.com/community/tutorials/getting-started-with-mocking-in-python">mocking data for tests</a>. And here’s another <a href="https://medium.com/@bfortuner/python-unit-testing-with-pytest-and-mock-197499c4623c">guide on Pytest and mocking</a></li></ul><h3>5. Model monitoring and feedback</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*US6MeOL-OE_AvC1ipe9dzw.png" /></figure><ul><li><strong>Why do it? </strong>This is to ensure that our product is working as intended in production. The outputs of the solution should be stable and reliable. We should be the first to know if something is wrong. Is model performance lower than expected? Are the data formatted differently to the training data? Are the data incorrect? This saves us a lot of time manually checking outputs and going through code to ensure things are working as expected. This is especially the case when the stakeholders begin questioning our data. We’re in the business of providing value to the company so we should also be measuring the impact that our solutions have. Is it working? Does it need tweaking? How much money are we generating? How frequently is the solution being used. These are the numbers that we can report to the executives to show the value that data science is contributing to the business.</li><li><strong>What does it involve? </strong>This involves a period of time (perhaps a couple weeks) after the model has been put into production to manually and proactively check that everything is working. This also involves <strong>automating </strong>the monitoring process. perhaps creating a dashboard and automated email alerts and/or an anomaly detection system. Perhaps the stakeholders need to do monitoring as well so the monitoring solution may need to be tweaked to be user friendly for non-technical colleagues. For feedback purposes this can involve discussing with the stakeholder how you’ll receive feedback. Will it be qualitative or quantitative? You could write something into the product that logs usage so that you don’t have to explicitly ask the stakeholder about their usage habits.</li><li><strong>What is the outcome of this phase? </strong>Methods and products to ensure that the model is working properly and providing qualitative or quantitative feedback on the usage and value of the solution. It may also include some form of notification/alert if something goes wrong.</li><li><strong>What happens if not done: </strong>If our products aren’t monitored properly we potentially risk business stakeholders losing trust in the things we produce when they break. It could also cost the business money and our team a lot of time trying to fix. One example of this that I’ve faced is when the data in the analytics tool the we built started giving wildly incorrect figures. It turns out that the provider of the raw data had messed up. But importantly, it was our stakeholders that picked up on the problem before our data team did. Robust testing (as described in the model development step above) and automated alerting should’ve picked this up but we didn’t have that in place. When the data finally came back, the stakeholders thought that the data were still incorrect. Our data team spent 2 weeks checking the data only to conclude that there was nothing wrong with it! That’s 2 weeks that we lost providing value to the business. Automated monitoring could’ve reduced 2 weeks to 2 minutes! Additionally, if we’re not getting feedback then we have no idea how useful our projects are or whether they’re still being used. One example was in a meeting with the marketing team and we had to ask the question “<em>are you using the model?</em>”. We should never have to ask that question because 1) we should have scoped the project properly during steps 1 and 2 so we know the value and we’re certain that our model improves upon the current solution/baseline model 2) We should’ve done the monitoring as part of the project, not in an unrelated meeting. This shows that we were not measuring the impact our models are having.</li></ul><h3>Notable omissions</h3><p>A good friend of mine (<a href="https://medium.com/u/e6245ed8ac48">Michael Barber</a>) mentioned that I’d missed an important step: <strong>evaluation</strong>. Model evaluation is an incredibly important part of the process and if it’s not done properly, can lead to unexpected degradation of a model in production. Here’s a <a href="http://www.fast.ai/2017/11/13/validation-sets/">great article</a> by <a href="https://medium.com/u/ee56d0bac1b7">Rachel Thomas</a> at <a href="http://www.fast.ai/">Fast.ai</a> about using suitable train, test and validation sets for model evaluation.</p><p>Furthermore, I’ve completely missed out experimentation. One of the best ways to determine whether your data science solution has had the desired impact is to run an experiment and carry out an A/B test. Here’s a great article about <a href="https://juliasilge.com/blog/ab-testing/">A/B at Stack Overflow</a> by <a href="https://medium.com/u/37e7cd45ea49">Julia Silge</a>.</p><p>I’m not going to go into detail about these because this post is already too long and these things should be brought up in early discussions with stakeholders about how the project is going to add value to the business (See step 3 about having a discussion with the relevant people before you complete a project 😂. Perhaps I would’ve included these points first time around).</p><p>So there we have it. These are 5 high level steps that I feel are required to develop a successful data science project. I should note that not all of these steps need to be carried out in full by a data scientist as some teams may have dedicated members to do some of the tasks. For example a business analyst or product manager may be the person who’ll liaise with stakeholders to determine whether a project is valuable and what the requirements are. Also there may be some steps that aren’t required for all projects. If a project is a one-off analysis piece then there’s no need to create a dashboard to continually monitor the output.</p><p>Realistically you don’t need to follow all of these steps to create a successful data science project. In most cases it wont be pragmatic to write a whole suite of tests and documentation in addition to setting up a monitoring dashboard for a stakeholder with automated alerting when anomalies crop up. It’s more likely that you’ll have to weigh up which of these things are worth doing so you can complete a project by the (likely unreasonable) deadline that you’ve been set. I confess that I’ve never completed every single step for any one particular project however, I have been aware of what I’m not doing and why not doing it at this particular time is a pragmatic decision.</p><p>The other important thing that I want to highlight is that these steps are only guidelines to help make a project successful. But to become a <strong>successful data scientist </strong>there are other <a href="https://towardsdatascience.com/my-two-cents-on-what-makes-a-good-data-scientist-nowadays-fea67931766a">traits that you must possess</a> and <a href="https://hackernoon.com/4-must-have-skills-every-data-scientist-should-learn-8ab3f23bc325">skills that should be learned.</a></p><p>I’m very aware that I’m not the most experienced data scientist and I don’t know what I don’t know so if anyone has any comments, questions or suggestions, please feel free to fire away in the comments. Thank you for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=203a4f520d54" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-to-construct-valuable-data-science-projects-in-the-real-world-203a4f520d54">How to construct valuable data science projects in the real world</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why so many data scientists are leaving their jobs]]></title>
            <link>https://medium.com/data-science/why-so-many-data-scientists-are-leaving-their-jobs-a1f0329d7ea4?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1f0329d7ea4</guid>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[advice]]></category>
            <category><![CDATA[office-politics]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Wed, 28 Mar 2018 21:00:07 GMT</pubDate>
            <atom:updated>2018-04-17T12:09:19.602Z</atom:updated>
            <content:encoded><![CDATA[<h3>Here’s why so many data scientists are leaving their jobs</h3><h4>Frustrations of the data scientist!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*rrQ_jhlEFN3bHIqf.jpg" /></figure><p><strong>Yes,</strong> I am a data scientist and <strong>yes, </strong>you did read the title correctly, but someone had to say it. We read so many stories about data science being the<a href="https://www.hbs.edu/faculty/Pages/item.aspx?num=43110"> sexiest job of the 21st century</a> and the<a href="http://uk.businessinsider.com/how-much-money-you-earn-in-the-sexiest-job-of-the-21st-century-2016-2"> attractive sums of money that you can make as a data scientist</a> that it can seem like the absolute dream job. Factor in that the field contains an abundance of highly skilled people geeking out to solve complex problems (yes it’s a positive thing to “geek out”), there is everything to love about the job.</p><p>But the truth is that data scientists typically “spend 1–2 hours a week looking for a new job” as stated in <a href="https://www.ft.com/content/49e81ebe-cbc3-11e7-8536-d321d0d897a3">this article by the Financial Times</a>. Furthermore, the article also states that “Machine learning specialists topped its list of developers who said they were looking for a new job, at 14.3 per cent. Data scientists were a close second, at 13.2 per cent.” These data were collected by Stack Overflow in their survey based on 64,000 developers.</p><p>I too have been in that position and have recently switched data science jobs myself.</p><p><strong>So why are so many data scientists looking for new jobs?</strong></p><p><em>Before I answer that question I should clarify that I am still a data scientist. On the whole, I love the job and I don’t want to discourage others from aspiring to be data scientists because it can be fun, stimulating and rewarding. The aim of this article is to play devil’s advocate and expose some of the negative aspects of the job.</em></p><p>From my perspective, here are 4 big reasons why I think many data scientists are dissatisfied with their jobs.</p><h3>1. Expectation does not match reality</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BV3nY2uAgMzmwCB4.jpg" /></figure><blockquote>Big data is like teenage sex: everyone talks about it, nobody really knows how to do it, everyone thinks everyone else is doing it, so everyone claims they are doing it… — Dan Ariely</blockquote><p>This quote is so apt. Many junior data scientists I know (this includes myself) wanted to get into data science because it was all about solving complex problems with cool new machine learning algorithms that make huge impact on a business. This was a chance to feel like the work we were doing was more important than anything we’ve done before. However, this is often not the case.</p><p><strong>In my opinion, the fact that expectation does not match reality is the ultimate reason why many data scientists leave</strong>. There are many reasons for this and I can’t possibly come up with an exhaustive list but this post is essentially a list of some of the reasons that I encountered.</p><p>Every company is different so I can’t speak for them all but many companies hire data scientists <a href="https://hackernoon.com/the-ai-hierarchy-of-needs-18f111fcc007">without a suitable infrastructure in place</a> to start getting value out of AI. This contributes to the <a href="https://towardsdatascience.com/the-cold-start-problem-with-artificial-intelligence-49938ed3f612">cold start problem in AI</a>. Couple this with the fact that these companies fail to hire senior/experienced data practitioners before hiring juniors, you’ve now got a recipe for a disillusioned and unhappy relationship for both parties. The data scientist likely came in to write smart machine learning algorithms to drive insight but can’t do this because their first job is to sort out the data infrastructure and/or create analytic reports. In contrast, the company only wanted a chart that they could present in their board meeting each day. The company then get frustrated because they don’t see value being driven quickly enough and all of this leads to the data scientist being unhappy in their role.</p><p><a href="https://medium.com/u/c00b242128fe">Robert Chang</a> gave a very insightful quote in his <a href="https://medium.com/@rchang/advice-for-new-and-junior-data-scientists-2ab02396cf5b">blog post giving advice to junior data scientists</a>:</p><blockquote>It’s important to evaluate how well our aspirations align with the critical path of the environment we are in. Find projects, teams, and companies whose critical path best aligned with yours.</blockquote><p>This highlights the 2-way relationship between the employer and the data scientist. If the company isn’t in the right place or has goals aligned with that of the data scientist then it’ll only be a matter of time before the data scientist will find something else.</p><p>For those that are interested <a href="https://medium.com/u/e8d03599a099">Samson Hu</a> has a fantastic series on how <a href="https://medium.com/wish-engineering/scaling-analytics-at-wish-619eacb97d16">the analytics team was built at Wish</a> which I also found very insightful.</p><p>Another reason that data scientists are disillusioned is a similar reason to why <a href="https://towardsdatascience.com/academia-to-data-science-91558063aa9e">I was disillusioned with academia</a>: I believed that I would be able to make a huge impact on people everywhere, not just within the company. In reality, if the company’s core business is not machine learning (my previous employer is a media publishing company), it’s likely that the data science that you do is only going to provide small incremental gains. These can add up to something very significant or you may be lucky to stumble on a gold mine project but this is less common.</p><h3>2. Politics reigns supreme</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sqe2jEzXaT3NeYnK.jpg" /></figure><p>The issue of politics already has a brilliant article dedicated to it: <a href="https://www.rdisorder.eu/2017/09/13/most-difficult-thing-data-science-politics/"><em>The most difficult thing in data science: politics</em></a><em> </em>and I urge you to read it. The first few sentences from that article pretty much sum up what I want to say:</p><blockquote>When I was waking up at 6 AM to study <strong>Support Vector Machines</strong> I thought: “This is really tough! But, hey, at least I will become very valuable for my future employer!”. If I could get the <a href="https://en.wikipedia.org/wiki/DeLorean_time_machine">DeLorean</a>, I would go back in time and call “Bulls**t!” on myself.</blockquote><p>If you seriously think that knowing lots of machine learning algorithms will make you the most valuable data scientist then go back to my first point above: <em>expectation does not match reality</em>.</p><p>The truth is the people in the business with the most clout need to have a good perception of you. That may mean that you have to constantly do ad hoc work such as getting numbers from a database to give to the right people at the right time, doing simple projects just so that the right people have the right perception of you. I had to do this a lot in my previous place. As frustrating as it can feel, it was a necessary part of the job.</p><h3>3) You’re the go to person about anything data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*nsgXxd0kwN3qT2ks.gif" /></figure><p>Following on from doing anything to please the right people, those very same people with all of the clout often don’t understand what is meant by “data scientist”. This means that you’ll be the analytics expert as well as the go-to reporting guy and let’s not forget that you’ll be the database expert too.</p><p>It isn’t just non-technical executives that make too many assumptions about your skills. Other colleagues in technology assume you know everything data related. You know your way around <em>Spark, Hadoop, Hive, Pig, SQL, Neo4J, MySQL, Python, R, Scala, Tensorflow, A/B Testing, NLP, anything machine learning</em> (and anything else data related that you can think of — BTW if you see a job specification with all of these written on it, stay well clear. It reeks of a job spec from a company that has no idea what their data strategy is and they’ll hire anyone because they think that hiring any data person will fix all of their data problems).</p><p>But it doesn’t stop there. Because you know all of this and you <strong>obviously have access to ALL of the data, </strong>you are expected to have the answers to <strong>ALL</strong> of the questions by……. well, it should’ve landed in the relevant person’s inbox 5 minutes ago.</p><p>Trying to tell everyone what you <em>actually</em> know and have control of can be hard. Not because anyone will actually think any less of you, but because as a junior data scientist with little industry experience you’ll worry that people will think less of you. This can be quite a difficult situation.</p><h3>4) Working in an isolated team</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*Jf2KhA7odcEz5Erg." /></figure><p>When we see successful data products we often see expertly designed user interfaces with intelligent capabilities and most importantly, a useful output which, at the very least, is perceived by the users to solve a pertinent problem. Now if a data scientist spends their time only learning how to write and execute machine learning algorithms, then they can only be a small (albeit necessary) part of a team that leads to the success of a project that produces a <strong>valuable </strong>product. This means that data science teams that work in isolation will struggle to provide value!</p><p>Despite this, many companies still have data science teams that come up with their own projects and write code to try and solve a problem. In some cases this can suffice. For example, if all that’s needed is a static spreadsheet that is produced once a quarter then it can provide some value. On the other hand, if the goal is to optimize provide intelligent suggestions in a bespoke website building product then this will involve many different skills which shouldn’t be expected for the vast majority of data scientists (only the true data science unicorn can solve this one). So if the project is taken on by an isolated data science team it is most likely to fail (or take a very long time because <a href="https://medium.com/startup-patterns/why-enterprise-agile-teams-fail-4ae64f7852d6">organizing isolated teams to work on collaborative project in large enterprises is not easy</a>).</p><p>So to be an effective data scientist in industry it doesn’t suffice just to do well in Kaggle competitions and complete some online courses. It (un)fortunately (depending on which way you look at it) involves understanding how hierarchies and politics works in business. Finding a company that is aligned with your critical path should be a key goal when searching for a data science job that will satisfy your needs. However, you may still need to readjust your expectations of what to expect from a data science role.</p><p>If anyone has any additional comments, questions or objections, please feel free to comment because constructive discussion is necessary to help aspiring data scientists make well-informed decisions about their career path.</p><p>I hope I haven’t put you off the job.</p><p>Thank you for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1f0329d7ea4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/why-so-many-data-scientists-are-leaving-their-jobs-a1f0329d7ea4">Why so many data scientists are leaving their jobs</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1 year doing data science in the real world]]></title>
            <link>https://medium.com/data-science/1-year-doing-data-science-in-the-real-world-54f49b591991?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/54f49b591991</guid>
            <category><![CDATA[lessons-learned]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[job-skills]]></category>
            <category><![CDATA[team-collaboration]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Tue, 20 Mar 2018 22:14:02 GMT</pubDate>
            <atom:updated>2018-03-20T23:45:38.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>The most important lessons I’ve learned so far</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbS8SSdsUGt_gpC9B6hZXg.jpeg" /></figure><p>Ok, so it’s actually 14 months but it didn’t have the same ring to it as “1 year”. I’ve spent that 14 months at one company, News UK. I’m now about to embark on a new journey at Deliveroo as a consumer and growth algorithms data scientist, so I thought now would be a good time to reflect on the things that I’ve learned during my time at News UK.</p><p>I can honestly say that I’ve learned loads. Given that it’s my first job outside of academia, this statement may be obvious. But the surprising thing (at least surprising to me) is that the most important things I’ve learned haven’t been the “hard skills” in data science. Instead, I’ve found that the most valuable things I’ve learned have been the “soft skills”. I have begun to appreciate that to succeed in any role in a large corporate company like News UK, not just in data science, you have to master the soft skills.</p><p>To illustrate how important I believe these soft skills are:</p><blockquote>I honestly believe that if I worked at News UK only equipped with the skills of SQL, data preparation, linear regression and a logistic classifier, I could be a successful data scientist provided that I completely mastered the soft skills. — Me</blockquote><p>Now I know that’s a huge statement but even if you don’t agree with me, you may be able to understand my point of view after reading my post.</p><p>Here we go</p><h3>1) Communication is key</h3><p>Being able to communicate with everyone around you is the most important skill for success, no matter how good you are at your craft. Communication is the first step to building a rapport with your team and your stakeholders. Once you have built a rapport with the relevant people it’s much easier to manage expectations, get requests/favours done quickly and many other benefits.</p><p>Things won’t always go smoothly. It’s inevitable that something will go wrong. An example that I experienced was when the analytics dashboard that we had made wasn’t presenting any data for certain articles (this happened more frequently than we’d like). When the stakeholders found out before us it caused problems because the perception was that we didn’t know what the problem was. However, on the occasions that we found out first and let the stakeholders know before they found out, they never got angry. The only request was that we let them know when things would be working properly.</p><p>This doesn’t only apply to stakeholders. Within the data technology team, I found that many of my team members loved when I explained complex data science methods in an easy to understand manner. This isn’t just about being able to explain parameter estimation or how a random forest classifier works, but it also includes understanding what is important to the other members. When talking about a data science project it’s important to start by motivating the project with the business problem. This allows you to bring everyone on the same journey of thought you’ve.</p><p>I wouldn’t have had the success that I had at News UK if I wasn’t able to communicate as well as I did and I’ll make sure to improve on this as I continue in my career.</p><h3>2) Empathy is important for teams to gel</h3><p>There’s already been <a href="https://medium.com/the-mission/the-results-of-googles-team-effectiveness-research-will-make-you-rethink-how-you-build-teams-902aa61b33">comprehensive research into what makes teams successful</a>. The number one thing being this concept of <a href="https://hbr.org/2017/08/high-performing-teams-need-psychological-safety-heres-how-to-create-it"><em>psychological safety</em></a>. However, another factor that I feel is very important is <em>empathy.</em></p><p>I remember having an entire section of a lecture during my data science bootcamp dedicated to empathy. At the time I didn’t really take it in. But now I feel like I can truly appreciate its importance.</p><p>Empathy not only allows you understand your colleagues but also respond to their pain points. And it’s this that can make you a better colleague.</p><p>A simple example of someone not empathising with you as a data scientist would be that a colleague asks you to do some analysis really quickly from a long, unstructured PDF document despite you having a deadline with some other piece of work at the end of the day. This person clearly doesn’t understand the process of analysis, why unstructured PDF documents aren’t necessarily optimal for data analysis, nor do they respect the other bits of work that you have to do. This misunderstanding can lead to frictions in teams.</p><p>There are many different ways that frustrations can arise within teams too. This article titled: <a href="https://multithreaded.stitchfix.com/blog/2016/03/16/engineers-shouldnt-write-etl/">Engineers shouldn’t write ETL: A guide to building a high functioning data science department</a> highlights some of the frustrations that can occur between data scientists, data engineers and infrastructure engineers. For example, data scientists write bad code which they expect the engineer to productionise right away. I’ve seen (and done) this several times in my role at News UK. This happens because of a lack of empathy and understanding.</p><p>Take some time to understand your colleagues. Find out what they do and what their pain points are. Find out what their level of experience is. Knowing these things will help you understand your colleagues. You may be able to proactively help when certain bits of work come your way that will also involve them. Perhaps the data engineer can sit with the data scientist and discuss what good, productionisable code looks like before the data scientist starts writing. The engineer can also explain their process and deadlines so that they set realistic expectations for the completion of the work. This is especially useful when senior employees work with junior employees. Notice that good communication leads to empathy.</p><h3>3) Perception can be as vital as measurable value</h3><p>I think the majority of people will tell you that if you’re going to develop a product you’ll need to define a metric by which success can be measured. Typically this involves an A/B test to causally determine if the inclusion of the new product/feature has had a positive impact.</p><p>However, despite the fact that the majority of products and algorithms that were produced by the data technology team at News UK didn’t go through this process, the products were still considered successful.</p><p>This is because the products were driving a cultural shift within the company. People had a positive perception of the data technology team and saw us as a team that could create products that would accelerate their progress in achieving their goals.</p><p>I didn’t appreciate this enough at the time. When the senior members of the company are bought-in it makes the team’s life so much easier. For example, it makes securing funding much easier. Remember, you’ve still gotta play the <a href="https://www.rdisorder.eu/2017/09/13/most-difficult-thing-data-science-politics/">game of politics</a>.</p><h3>Other important lessons</h3><ul><li><strong>Find ‘data champions’</strong>. These are people outside of the data team that are strong advocates of data. They’ll be able to influence others within their teams and also act as product owners for your projects.</li><li><strong>The people that talk the loudest tend to succeed</strong>. This may just be something inherent to big corporate companies with layers of bureaucracy and abundant politics but it feels like the loudest characters tend to rise up the career ladder in those companies.</li><li>Following on from being the loudest, you need to be able to <strong>sell ice to an eskimo</strong>. Not only do you need to shout about what you’re doing but you have to sell it too. That’s how you tend to get executive buy-in.</li><li><strong>Every good machine learning project requires solid EDA and descriptive analytics</strong>. It’s tempting to just do the “cool machine learning” model that makes predictions and makes people believe you’re a magician. However, to get the most out of your data you have to understand it and that means exploring it. You won’t get away from standard analytics.</li><li><strong>Robust code that is continuously monitored is necessary for longevity of a code base.</strong> Something will go wrong in production but you can mitigate this by building robust pipelines. Furthermore, if the outputs aren’t continuously monitored then the performance is a mystery. When the original authors have left the company it’ll only be a matter of time before that code base is replaced.</li><li><strong>Solving business problems isn’t as simple as suggesting solutions</strong>. Just because you offer a solution it doesn’t mean that people will listen. You have to be ‘smart’ about it and <a href="https://medium.com/@jackiebo/how-to-give-feedback-so-people-will-listen-f166e26a2195">give feedback in such a way that the relevant people will listen</a>. Get the relevant people aligned on the goal and then take them on your journey to the solution in such a way they believe that have been jointly responsible for it. <a href="https://medium.com/u/cac8d6f5c914">Scott Shipp</a> explains this very well in his article: “<a href="https://hackernoon.com/how-to-ask-questions-that-drive-change-at-work-81d9422ffa9c">How to ask questions that drive change at work</a>”. In many cases, the solutions that you come up with on your own aren’t optimal anyway, so it’s beneficial to get the input of others. But it’s a mistake to believe that people see the world the same way that you do.</li></ul><p>There are many more important things that I’ve learned over the past year but I feel these are the most important ones.</p><p>What do you think? Are there important lessons that I’m missing? Do you disagree with any of these? Feel free to continue the discussion in the comments. Thanks for reading ☺</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54f49b591991" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/1-year-doing-data-science-in-the-real-world-54f49b591991">1 year doing data science in the real world</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability concepts explained: Marginalisation]]></title>
            <link>https://medium.com/data-science/probability-concepts-explained-marginalisation-2296846344fc?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/2296846344fc</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Sat, 27 Jan 2018 13:50:06 GMT</pubDate>
            <atom:updated>2018-03-16T11:32:35.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17PNo9EwgnUjLyBxbMD8KA.jpeg" /></figure><h3>Introduction</h3><p>In this post I’ll explain the concept of marginalisation and go through an example in the context of solving a fairly simple <a href="https://towardsdatascience.com/probability-concepts-explained-maximum-likelihood-estimation-c7b4342fdbb1">maximum likelihood</a> problem. This post requires some knowledge of fundamental probability concepts which you can find explained in my <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">introductory blog post</a> in this series.</p><h3>What is marginalisation</h3><p>Marginalisation is a method that requires summing over the possible values of one variable to determine the marginal contribution of another. That definition may sound a little abstract so let’s try to illustrate this with an example</p><p>Suppose we’re interested in how the weather affects someone’s happiness in the United Kingdom (UK). We can write this mathematically as P(happiness|weather) i.e. what’s the probability of someone’s happiness level given the type of weather.</p><p>Suppose we had the equipment and definition required to measure someone’s happiness and also recorded the weather for someone in England and another in Scotland. Now it’s feasible that people in Scotland are just generally happier than people in England. The problem is that people always have a nationality so I can’t just get rid of it in the measurement. So what we’re actually measuring is P(happiness, country | weather), i.e. we’re looking at the happiness and the country at the same time.</p><p>Marginalisation tells us that we can calculate the quantity we want if we sum over all possibilities of countries (remember that the UK is made up of 3 countries: England, Scotland and Wales) i.e. P(happiness|weather) = P(happiness, country=England | weather) + P(happiness, country=Scotland | weather) + P(happiness, country=Wales | weather).</p><p>And that’s it! Marginalisation tells us to just add up some probabilities to get to the desired probabilistic quantity. Once we’ve calculated our answer (it can be a single value or a distribution) we can get whatever properties we want (inference).</p><h3>Related definitions</h3><p>If this concept sounds similar to you, yet you haven’t heard of marginalisation before, this may be because you’ve heard it being called by a different name. Sometimes the method is called <strong>integrating out the nuisance variable. </strong>Integration is essentially another word for “adding up” a variable, and the variable that you are summing is known as the “nuisance variable”. So in the example above the “<em>country”</em> variable is the nuisance variable.</p><p>If you’re working with <a href="https://blog.statsbot.co/probabilistic-graphical-models-tutorial-and-solutions-e4f1d72af189">probabilistic graphical models</a> then marginalisation is a method by which you can perform exact inference (i.e. you can write down the exact quantity from the distribution you’re interested in e.g. the mean can be calculated exactly from the distribution). In this context marginalisation is a method of, and sometimes used synonymously with, <a href="https://en.wikipedia.org/wiki/Variable_elimination"><strong>variable elimination.</strong></a></p><h3>Example: A game of dice with unknown dice.</h3><p>I’m going to go through the example given in the fantastic <a href="https://doi.org/10.1107/S0907444904016038">Liking likelihood </a>paper written by one of the best mathematical and computational crystallographers in the world, Airlie J. McCoy. If you’re looking for a nice introduction to various maximum likelihood concepts with dice (e.g. log likelihood, Central Limit Theorem etc.) then I highly recommend it.</p><p>Suppose we have four dice: 4-sided die, 6-sided die, 8-sided die and a 10-sided die (as shown below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4jeY-EWSXnDhvOQGKvKcg.png" /><figcaption>The 4 dice that we have. From left to right: 4-sided die, 6-sided die, 10-sided die and an 8-sided die</figcaption></figure><h4>The game</h4><ul><li>I put a six-sided and an eight-sided die in a red box and a four-sided and ten-sided die in a blue box.</li><li>I select a die from each of the red and blue boxes at random and put them in a yellow box.</li><li>I select a die at random from the yellow box, roll the die and tell you the result.</li></ul><p>After playing the game we are told the result is 3. The question that we want to answer is: <em>Did the die most likely come from the red box or the blue box originally?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffwom24WN3NLZLeiKfeMsw.png" /><figcaption>Graphic depiction of the game described above</figcaption></figure><h4>Approaching the solution</h4><p>To approach this question we have to figure out the likelihood that the die was picked from the red box given that we rolled a 3, <em>L</em>(box=red| dice roll=3), and the likelihood that the die was picked from the blue box given that we rolled a 3, <em>L</em>(box=blue| dice roll=3). Whichever probability comes out highest is the answer that we give.</p><p>So how do we calculate <em>L</em>(box=red| dice roll=3) and <em>L</em>(box=blue| dice roll=3)?</p><p>First thing to know is that the likelihood and probability are related via the equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wug2qaodfbM1G0crwXJycw.png" /></figure><p>See the <a href="https://towardsdatascience.com/probability-concepts-explained-maximum-likelihood-estimation-c7b4342fdbb1">end of my post on maximum likelihood</a> for an explanation of this.</p><p>What this means is that the likelihood, <em>L</em>(box=red| dice roll=3), is equivalent to finding the probability of rolling a 3 given that the die came from the red box i.e. <em>P</em>(dice roll=3 | box=red). Similarly<em> L</em>(box=blue| dice roll=3) = <em>P</em>(dice roll=3 | box=blue).</p><p>Let’s assume we’ve selected a die from the red box. It could be either the six-sided or the eight-sided die. That’s a 50/50 chance that I pick either of the two die. Suppose I pick the six-sided die. That means that I have to pick the six-sided die from the yellow box and then roll a 3. So the probability in this case is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Vb_81VfKNFiWKXDOa_QYA.png" /></figure><p>Just to make it explicit. The “1/2” comes from the fact that I have a 50% chance of picking the 6-sided die at random from the red box because it also contains the 8-sided die. The “1/6” comes from the fact that I have a 6-sided die and therefore a 1/6 chance of rolling a 3.</p><p>Notice that the answer doesn’t contain anything about the probability of picking the 6-sided die from the yellow box. This is because the probability of picking the six-sided die from the yellow box is 1 in this case (you may have thought that it was 1/2 because the yellow box contains the 6-sided die and whichever die I picked from the blue box). This is because we’re calculating the conditional probability of rolling a 3 from the 6-sided die <strong>given that the die came from the red box.</strong> Therefore, the other scenario in which we pick the other die in the yellow box is impossible because the other die was originally from the blue box. So given the condition that we’ve selected from the red box, we can only select the 6-sided die from the yellow box, hence the probability of selecting the 6-sided die from the yellow box is 1.</p><p>In a similar manner, we can calculate the probability that the result was 3 and we had actually picked the 8-sided die from the red box. This time the probability is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wKT0D-6mXjybcjk-bu8TPw.png" /></figure><p>We’ve now done almost all the work required to calculate the probability that the die came from the red box. Remember that the red box only contained the 6-sided and the 8-sided die so all we have to do is find the probability that the die was either 6-sided <strong>or </strong>8-sided. From the <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">introductory post</a> we know that in the <strong>“or” </strong>case we need to add the probabilities. Therefore, the probability that the die came from the red box is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPgrlGJAs9kxz5-z3L2MOg.png" /></figure><p>For those that are unfamiliar with the “wavey” equals sign between the numbers in the above equation it means “approximately equal to”. The real answer is 0.1458333333…… (the 3’s go on forever and we say that it’s 3 recurring), but I got lazy and only gave my answer to 3 digits after the decimal point (i.e. rounded to 3 decimal places). To be explicit about the fact that we haven’t given the exact answer we generally use the “wavey” equals sign.</p><p>We can do the same calculation for the blue box to get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WwiKYvFsK9CvtMmQ5LG88Q.png" /></figure><p>The probability that the die originally came from the blue box is higher therefore using maximum likelihood we would conclude that the die most likely came from the blue box.</p><h4>Where’s the marginalisation in that example?</h4><p>For those that are very observant you’ll have noticed that I didn’t used the word “marginalisation” once in that example section. This is because I wanted you to get an intuitive understanding how to calculate the probability of picking the die from the boxes.</p><p>If you look at the equation above for the blue box you’ll see that we added together the probabilities for all of the possibilities i.e. picking the 4-sided die and the 10-sided die. This is marginalisation! We summed over the nuisance variable (the die). Notice in that game we never observed the die that we picked at all and we didn’t have to! All we needed to know was the result (dice roll = 3) and all possible values of dice. That’s what makes this so powerful. We can calculate the probabilities for things we don’t ever observe. As long as we know the possible values for the nuisance variable we can always use it to perform marginalisation and calculate the distribution for a different variable.</p><h3>Notation</h3><p>Here’s the part where I get us to write some even scarier equations but please bear with me, I’ll try my best to make it understandable.</p><p>Let’s think about what we’ve just done in the example. We started off with a Joint probability, <em>P</em>(dice roll, die | box) (i.e. the <em>dice roll</em> was 3, the <em>die</em> was the die we picked to do the roll and <em>box </em>was the original box we picked the die from; blue or red). Once we performed marginalisation we ended up with a Conditional probability, <em>P</em>(dice roll| box). This is one of the major benefits of marginalisation. We can go from joint probabilities to conditional probabilities.</p><p>In fact we can also from Joint probabilities to marginal probabilities too. If you see a mathematical definition of marginalisation this is typically the form that you’ll see. If you haven’t seen the mathematical definition well, …. you’re in luck. You’re about to see it now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7G7DfNzc0Aqn60EIDudE0w.png" /></figure><p>The big ol’ ∑ is lazy mathematician notation for “add everything up” and the <em>“y” </em>underneath it is there to tell us what we should be adding up. So the equation is saying, <em>“If you want the marginal probability for X (left hand side of equals sign), then you need to add up the joint probabilities for X and Y for every possible outcome of Y”</em>.</p><p>Joint probabilities can sometimes be quite hard to work with so we can rewrite the joint probability on the right hand side using the <a href="https://www.khanacademy.org/math/ap-statistics/probability-ap/probability-multiplication-rule/a/general-multiplication-rule">general multiplication rule</a> in probability that I showed in the <a href="https://towardsdatascience.com/probability-concepts-explained-introduction-a7c0316de465">introductory blog post.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2R1fc9IvneSwsqnzjw8Lg.png" /></figure><p>The equation on the far right is written as a product of a conditional distribution and a marginal distribution which is sometimes easier to calculate.</p><p>As I mentioned before, the ∑ tells us the “add everything up”. What I didn’t mention is that particular symbol is only used when the variables are <em>“discrete”. </em>What I mean by that is variables that can only take on a limited number of values. In the earlier examples we were summing with discrete nuisance variables (e.g. UK country can only be England, Wales or Scotland, and the dice only had a limited number of outcomes, 1 through to 6 for the 6-sided for example). Discrete values don’t have to be finite though. For example, they can be all the positive whole numbers (i.e. positive integers) like 1, 2, 3,…. etc.</p><p>However, when we work with variables that have an infinite number of possible values within given bounds (e.g. a distance measure between 0 and 10 metres can have an infinite number of values for example 5 metres, 5.1m, 5.01m, 5.001m, 5.0001m,… and so on) we call these “<em>continuous variables</em>” and we don’t use the ∑ symbol. Instead we use ∫. This symbol still tells us that we have to add everything up but instead we know that the nuisance variable is continuous and instead we write the marginalisation as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiqxUUAKFRc0N2D-a2ObTA.png" /></figure><p>This means the same thing as the marginalisation equation in the discrete variable case above. The “d<em>y</em>” at the end tells us what to integrate (“integrate” is the name that we use for “add up” when we work with continuous variables).</p><p>The reason the “d<em>y</em>” is necessary is that it’s not always obvious what we’re integrating if we don’t state it. Consider the case where the nuisance variable is an angle around a circle. We know that angles go between 0 and 360 degrees, or more technically, we like to work with <a href="https://en.wikipedia.org/wiki/Radian">radians</a> instead of degrees where we say the angles go from 0 to 2π</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*PxFQE9g75RyamtHEAGYJxg.gif" /><figcaption><a href="https://en.wikipedia.org/wiki/Radian#/media/File:Circle_radians.gif">Source: Wikipedia</a>. Radians in a circle</figcaption></figure><p>So we might be tempted to write</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*z0F3GYgax96ej7xVCsE7qA.png" /></figure><p>We know that we need to integrate something over the values from 0 all the way to 2π but do we integrate the values for <em>X</em> or the values for <em>Y</em>? Mathematicians around the world are itching to smack me round the face for the atrocity above.</p><p>To fix this we put the “d<em>y</em>” at the end to be clear that we are integrating the <em>Y </em>values between 0 and 2π, which means we also know that the answer is the marginal distribution over X (below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMxClUodrkyxYlt1Ylc97A.png" /></figure><p>For those that are interested, integrating angles from 0 to 2π is something that we have to do in X-ray crystallography, the field of my PhD, because of something called the <a href="https://en.wikipedia.org/wiki/Phase_problem">phase problem</a>. This is basically the issue that we can’t measure the “phase” in the experiment and the phase can be mathematically treated like an angle. So to calculate the theoretical distribution of the data that we observed we had to marginalise over the phases.</p><p><a href="https://medium.com/u/1cdc1cca2f85">adam kelleher</a> uses marginalisation in his <a href="https://github.com/akelleh/causality">causality package</a> to eliminate the effects of confounding variables. He also uses the general multiplication rule to write the marginalisation in terms of the product of a conditional distribution and a marginal distribution as we discussed above. You can read about it in his <a href="https://medium.com/@akelleh/causal-inference-with-pandas-dataframes-fc3e64fce5d">blog post.</a></p><h3>Concluding remarks</h3><h4>Chain Rule for probability</h4><p>In the calculations above we actually used a fairly common probabilistic procedure without even realising it. The result we used is the <em>chain rule</em> for probability (not to be confused with the <a href="https://en.wikipedia.org/wiki/Chain_rule">chain rule for differentiation</a>). It states that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxfcX5hL6jLSgvJLcWYOsg.png" /></figure><p>It allows us to write a joint probability (left hand side) as a product of conditional and marginal probabilities (right hand side)</p><p>This is used a lot for calculating joint distributions because as we’ve mentioned already, it can be easier to determine conditional and marginal probabilities.</p><p>To see where we used the result above remember that we used the equation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Vb_81VfKNFiWKXDOa_QYA.png" /></figure><p>Comparing the equations we can let A = dice roll, B = die and C = box. So that means we can write the left hand side of the above equation as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*XcMMozU7RMNYbStiRCllXQ.png" /></figure><p>Now let’s understand these.</p><ul><li><em>P</em>(dice roll = 3| die= 6-sided, box=red) is the probability that we rolled a 3 given that we picked up the 6-sided die and it was in the red box. This evaluates to 1/6.</li><li><em>P</em>(die = 6-sided| box = red) is the probability that we picked the 6-sided die given that we picked from the red box. This evaluates to 1/2.</li></ul><p>Therefore we get 1/2 ✕ 1/6 which is exactly the result that we determined in the example from intuition.</p><p>Here we’ve shown the chain rule using three variables. If you look at the (scarier looking) definition of <a href="https://en.wikipedia.org/wiki/Chain_rule_(probability)">chain rule on Wikipedia</a> you’ll see what it looks like for four variables and for infinitely many variables.</p><p>It can seem scary but the idea is the same. We have a joint probability distribution on the left hand side and we want to write it as a product of conditional and marginal probabilities on the right hand side.</p><h4>Use in Bayesian inference</h4><p>If you read my previous post on <a href="https://towardsdatascience.com/probability-concepts-explained-bayesian-inference-for-parameter-estimation-90e8930e5348">Bayesian inference</a> you’ll know that the model form of Bayes’ theorem is written as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDbeG6aZP16h46S1DboWHg.png" /></figure><p>I mentioned that we often don’t calculate the denominator, P(data), also known as the normalisation constant, because in many cases it can be too hard to calculate and we don’t always need it.</p><p>Well in some cases we can calculate it exactly and marginalisation can help. If we write the marginalisation equation in the same form as the continuous variable case in the “<em>Notation</em>” section above we get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8bmSsf7p9FOoaN9L2WLM2g.png" /></figure><p>Explicitly we are integrating the right hand side through all possible values of the parameters. In some cases we can evaluate this expression, either exactly or approximately, so that we can get a normalised posterior distribution.</p><p>Thanks again for making it this far. I know this post contained quite a bit of maths but I hope it made sense. Don’t hesitate to let me know if there is something that is unclear, something you want me to write about or anything that I can improve.</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2296846344fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/probability-concepts-explained-marginalisation-2296846344fc">Probability concepts explained: Marginalisation</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advice for getting a job in data science: The CV]]></title>
            <link>https://medium.com/data-science/advice-for-getting-a-job-in-data-science-the-cv-c5b8ec6bebc?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5b8ec6bebc</guid>
            <category><![CDATA[cv]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Wed, 10 Jan 2018 20:47:31 GMT</pubDate>
            <atom:updated>2018-01-10T21:24:47.804Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A great CV might get you an interview. A bad CV will be thrown away!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*SS2gEUVakYRfWQbV2cgTJw.jpeg" /></figure><p>That’s the importance of a CV. Often it’s the first impression that an employer has of you, so forget about making it good, your goal is to <em>make it outstanding</em>.</p><p>Now, I’m far from an expert on writing CVs. I’d be lying if I said that I had an above average success rate when it came to job applications. In addition, there are already several articles out there on the web that will give great guidance and tips on how to write a CV. In fact, one of the best articles I’ve read giving advice on a data science CV was written by the head of advanced analytics and data science at royal mail, Ben Dias, titled <a href="https://www.google.co.uk/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://www.linkedin.com/pulse/what-do-hiring-managers-look-data-scientists-cv-ben-dias&amp;ved=0ahUKEwjhpqzzosnYAhVlLcAKHSSOARMQjjgILzAC&amp;usg=AOvVaw1yoAP78efsFJ97Kcu-UZWB">“What do hiring managers looks for in a data scientist’s CV?”</a></p><p>So why am I bothering to write a post on CV advice?</p><p>A few months ago I was asked to go through CVs and help shortlist candidates for interview for a data science role at my company. This was incredibly insightful for me. I saw certain things that really stood out, both positive and negative. So I want to give you some tips based on what I learned from that experience.</p><h3>1. Don’t undersell yourself</h3><p>Remember, you’re trying to stand out for the right reasons. When an employer looks at your CV it’s usually not in isolation. They have looked at many CVs, so you’re being compared to others, some of whom won’t be afraid to exaggerate a little to make themselves stand out. It’s an employer’s task to filter out those that are exaggerating the truth. However, given the choice between a candidate with an exaggerated CV and a candidate with a CV that undersells themselves, I’d probably hedge my bets on the candidate with the exaggerated CV.</p><p>Let’s be clear, I’m not saying that you should lie on your CV, but don’t use language that could give an employer reason to think that you’re not as good as you actually are.</p><p>For example, let’s say you’ve done a few online data science courses and you’ve been programming in Python for about 6 months. You’re unlikely to be a world expert Python programmer. But that doesn’t mean that you should state that you’re a ‘Python beginner’ in your CV.</p><p>What level is a Python beginner? Is it someone that doesn’t know how to write a for-loop or someone that’s had minimal exposure to machine learning in Scikit-learn? I think they’re very different levels of exposure. The person using Scikit-learn can probably navigate the machine learning package ecosystem but the for-loop beginner may not even have seen a terminal/command window. You never know how an employer will interpret “beginner”.</p><p>So remember, you don’t have to exaggerate your skills, but don’t use language that could be interpreted below your skill-set. <strong>Don’t undersell yourself.</strong></p><h3>2. Focus on value</h3><p>As a data scientist it’s easy to overestimate the importance of algorithms. There are countless tutorials on how to implement various ML models and new neural network architectures solving different problems seem to appear every week. But the reality is that the models are only a fraction of what makes a good data scientist. Ultimately you have to show that you understand and care about business value.</p><p>I remember coming across a CV of a candidate who supposedly had 10+ years of data science experience. The CV was littered with data science buzzwords. This candidate had used a variety of algorithms to complete work projects and had very good evaluation metric scores. Great. But there was no mention of business value added anywhere. How much additional revenue did this project generate? What was the efficiency gain for the 90% classification accuracy? I could go on.</p><p>The points on your CV for a particular project should read something like: “I used technique X which achieved Y score which translated to Z value”.</p><p>If you can’t connect the outputs of your model performance with added business value then you’ll lose huge brownie points.</p><p><em>Note</em>: If you’re applying for your first role then this isn’t so much of an issue, but if you are already working in industry at the moment then you need to be thinking about how your current projects are providing business value and increasing the attractiveness of your CV for future employers.</p><p>Remember <strong>focus on value.</strong></p><h3>3. Showcase yourself</h3><p>Obviously the CV should be a glowing story of you and your skills, but it’s 2018 people! You can go beyond your CV. You might have a blog that showcases your data science skills or you might have videos that show you giving fantastic presentations. At the very least you should have a couple of projects on GitHub to show that you have a decent base level of technical competency. There should be links to all of these things in your CV. There’s no guarantee that an employer will look at it but you’ve given them the option. Who knows, if they do look at it you might just impress them. This is what happened with one of the CVs I looked at.</p><p>One of the candidates had linked to their blog so I decided to check it out. I saw some great articles in there, one of them was on a topic that I was unfamiliar with. I could immediately see that this candidate had good technical knowledge and good written communication skills and so I advised that this candidate should be selected for interview (the other parts of the CV had to be good of course).</p><p>So don’t be afraid, <strong>showcase yourself</strong>.</p><h3><strong>4. State your relevant skills…..early</strong></h3><p>When you look at a job specification they’ll almost always have a section on <em>&#39;desired skills&#39; </em>or some variation. It may sound obvious but these skills should match the skills that you have written in your CV (you don’t have to match all of the skills, even 50% will be fine in many cases). So make sure that you state these skills in your CV.</p><p>I personally like a “<em>technical skills</em>” section in a CV because it’s easy to look at and scan through the list to see what skills a candidate has without trying to dig through lots of project work. Although some people disagree on this. It’s quite subjective.</p><p>But whatever you decide to do, make sure a good chunk of these skills can be found in the first quarter of your CV.</p><p>About 6 months ago I looked at a CV of a friend of mine who was a post doctoral researcher. I knew already that they possessed the base skill-set required for a junior data scientist, however, their CV didn’t tell that story. I had to get to the second page of the CV before I found any relevant technical skills. An employer is unlikely to have that amount of patience. That CV would’ve likely been thrown away at many companies before anyone got to the relevant parts.</p><p>So remember to<strong> state your relevant skills… early</strong>.</p><h3>5. Get multiple people to read your CV</h3><p>Let me put it like this:</p><blockquote>If you’re the only person that has read your CV then it’s a bad CV!</blockquote><p>Perhaps that statement is a little harsh but I say it for good reason. A CV is not designed for you, it’s for someone else - the employer. So even if you love your CV, the person you need to like it may not.</p><p>Get feedback from a few trusted people. Don’t be afraid to hear criticism. It happens. Your CV is unlikely to be perfect on the first draft. Showing it to people before sending it off will improve it and most importantly, improve your chances of getting to interview.</p><p>My own CV has been critiqued by 3 friends of mine and that’s since I landed my current job. Some have very differing opinions about how it should be written (one thinks it should be 1 page and another says it doesn’t matter if I spill onto 3 pages), so I’ve had to manage what I pick and choose, but on the whole, the feedback has massively improved my CV.</p><p>So don’t send out your CV until you <strong>get multiple people to read your CV.</strong></p><p>As always, this is not an exhaustive list of the tips for creating a CV but these are things that I noticed when looking through candidate’s CVs myself. I hope this has been helpful for you. If you have any other tips, comments or questions, please feel free to leave a note below.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5b8ec6bebc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/advice-for-getting-a-job-in-data-science-the-cv-c5b8ec6bebc">Advice for getting a job in data science: The CV</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Academia to data science]]></title>
            <link>https://medium.com/data-science/academia-to-data-science-91558063aa9e?source=rss-c6ab8048de41------2</link>
            <guid isPermaLink="false">https://medium.com/p/91558063aa9e</guid>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[academia]]></category>
            <dc:creator><![CDATA[Jonny Brooks-Bartlett]]></dc:creator>
            <pubDate>Sun, 07 Jan 2018 18:58:35 GMT</pubDate>
            <atom:updated>2018-01-08T00:59:16.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Asx6IxYOEXQyhxzTyVZigw.jpeg" /></figure><p>I’ve been employed as a data scientist for just over a year now but before this I was in academia as a postdoctoral researcher. Since making my transition, some of my friends have asked me about my journey to data science in industry. Many of them are toying with the idea of leaving academia and data science is an attractive alternative. Although, my year in data science has had its ups and downs, I don’t regret my decision and I would definitely recommend it. However, the transition isn’t completely straightforward. It’s different for many people so I’m writing this piece in the hope that it’ll help those that are still uncertain about how to make the leap.</p><p>I should mention that my experience is from the perspective of someone coming from an academic research background where I routinely used many of the tools and techniques that are typically used in the technical side of data science. This means that I didn’t really have to start from scratch and do many transition courses. However, if you feel that my experience isn’t relevant to you, you’re still in luck. <a href="https://medium.com/u/a7875cc0d78e">Rosebud Anwuri.</a> has written a fantastic article about her <a href="https://towardsdatascience.com/my-journey-into-data-science-39e9bbbbf452">journey into data science</a>. It’s such a great success story and well worth a read.</p><h3>What were my problems with academia?</h3><p>When I started my PhD in 2012 I wasn’t sure exactly what I wanted to do later on in my career but I thought that I’d most likely stay in academia and be a professor (probably of applied mathematics or something similar). Some of factors that made academia attractive, in particular science and mathematics, were:</p><ul><li>The objective was pure. We all wanted to learn more about the world around us for the good of mankind. This was in contrast to industry where the goal is to make more money. You would be a sell-out if you worked in industry.</li><li>Everyone would work in perfect collaboration and we wished the best for everyone else because we have a mutual objective. In contrast, ideas are kept private in industry because you need to be selfish to make money.</li><li>There wouldn’t be much pressure to get things done because academic rigour was the most important thing. Therefore, you always knew that you were doing the most optimal work possible.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*UwtP4zTfnR6R5R9DSlKXGg.jpeg" /><figcaption>Me looking through a microscope for protein crystals that I grew. This photo was taken back in March 2015</figcaption></figure><p>Oh how disillusioned I was! None of the above are completely true. I feel that most of the issues in academia stem from the <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3999612/">publish or perish</a> culture, but that’s a topic for another blog post.</p><p>In addition to realising my disillusionment with the above there were other reasons for wanting to leave academia.</p><ul><li>I became more interested in the software tools and algorithms that I used over the biological application that was central to the field I was in.</li><li>I wanted to have a family someday and the nature of the <a href="https://www.theguardian.com/higher-education-network/2016/dec/02/short-term-contracts-university-academia-family">short term contracts in academia are not compatible with family life</a>.</li><li>I wanted to feel like I could chill out on evenings and weekends (in academia it’s very common to work outside of typical work hours).</li></ul><p>Many early stage academics I’ve spoken to have experienced the same issues that I’ve mentioned above so I know that I’m not the only one with these views.</p><p>I’ve made academia sound really bad. It’s not as bad as I make out and in fact <a href="http://www.bioch.ox.ac.uk/aspsite/index.asp?sectionid=garman">my research group</a> was fantastic. I had great colleagues and an awesome supervisor, but the issue is that I wouldn’t be in such an amazing group for the whole of my academic career.</p><h3>How I got out?</h3><p>I came across the terms “machine learning” and “data science” during my PhD while I was reading up on Kalman filters, which I needed for some of the work I was doing. Data science in particular, was the first time that I’d encountered a field that seemed to concentrate on the aspects of academia that I enjoyed; complex algorithms and cool technologies (there’s so <a href="https://www.rdisorder.eu/2017/09/13/most-difficult-thing-data-science-politics/">much more to data science</a> but this is what I cared about at the time).</p><p>Over time I did a lot of reading on data science and found out that I was already using quite a few common data science tools: I had been using Github for a couple of years. I was proficient in a few programming languages including Python (I don’t use R but I had used it once before and if I really needed to I felt that I could learn it). I had experience doing regression, optimisation and Bayesian inference amongst other methods too.</p><p>Despite knowing all of this I still didn’t feel qualified to do data science. When you read about data science and machine learning online it can be overwhelming. It seems that everyday there’s a new algorithm or technology that you need to know and if you don’t know it then you’re already a dinosaur if the field. This isn’t true but it can definitely feel that way.</p><h4>Upgrading my skills</h4><p>I took a few online courses to brush up on my data science skills but I felt that I wasn’t learning fast enough. Luckily I came across the <a href="https://www.asidatascience.com/">ASI</a> data science bootcamp on Twitter. However, the application deadline wasn’t at a good time and I felt that the <a href="http://www.s2ds.org/">Science to Data Science</a> (S2DS) bootcamp was better suited to me.</p><p>I’ll save the details for a more comprehensive post on my experience in the S2DS bootcamp, but in short I learnt some very important things. One of the most important being that I already had the technical skills required to be a junior data scientist. I didn’t need to be proficient at every new complex algorithm, nor did I need to be an expert at the latest high performance computing tools. The other important thing is that data scientist is an incredibly broad and ill-defined job role so finding the right job required a decent amount of research.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWaqX2DmFlG0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWaqX2DmFlG0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWaqX2DmFlG0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d04c86ffc8c36a9e7e270a24e609f9c6/href">https://medium.com/media/d04c86ffc8c36a9e7e270a24e609f9c6/href</a></iframe><h4>Landing the job</h4><p>After finishing my PhD and S2DS I started looking for a job. It took about 3 months to eventually land a job and during that time I found that the conventional job application method (sending CVs to companies where I had no contacts) didn’t work too well for me. I was lucky enough that the company that organised the S2DS bootcamp, <a href="https://www.pivigo.com/">Pivigo</a>, also organise the <a href="https://www.meetup.com/Business-Analytics-and-Data-Science/?_cookie-check=RAXn6myfYzXs9BGm">business analytics and data science meetup</a> and asked me to present the work I did on the bootcamp. My current employer was in the audience at the time and the rest is history. I also got a second job offer from another employer that was in the audience that evening too.</p><h3>So what advice would I give?</h3><p>I’ve written a blog post specifically about <a href="https://towardsdatascience.com/advice-for-getting-a-job-in-data-science-10-lessons-learned-whilst-on-the-job-market-f305f4c9033d">what I learned whilst job hunting</a> so I won’t focus on that aspect of landing a data science job here. Instead, here is my advice for the preparation phase i.e. what you should be doing whilst you are thinking about getting into data science but before making formal applications.</p><ul><li><strong>Talk to data scientists. </strong>Find out what they do and discover if data science is right for you. Just reach out. People are always happy to talk about themselves and their work ;) But most importantly, it might help you with your career decision. I was contacted by someone looking to get into data science out of the blue on LinkedIn. A couple weeks later we met up face to face for lunch and I was giving him advice. Now he’s <a href="https://www.linkedin.com/pulse/deepmind-sponsored-me-medical-student-study-msc-data-science-beckley/">sponsored by Google Deepmind</a> for his data science masters.</li><li><strong>Read lots!</strong> <a href="https://medium.com/u/a7875cc0d78e">Rosebud Anwuri.</a> says it too. You can’t ever know too much. The more you know, the better position you’ll be in. You’ll be able to make more informed decisions that’ll help you when the time does come to apply.</li><li><strong>Start learning to use the tools. </strong>If you don’t know a programming language then learn one. For example, I forced myself to learn Python (and other languages) by implementing my PhD work in it. If you need to learn how to use particular tools like Git/Github, cloud computing etc. then figure out how to incorporate it into your current work. Or you can take on side projects if you have the time. There are a lot of resources online to get started and if you can’t find someone just ask. For example, I’d be more than happy to write a blog post about something if someone asked me to do so because I love knowing that what I produce is going to be useful for others.</li><li><strong>Showcase your knowledge </strong>Make public <a href="https://github.com/">Github</a> repositories for your projects. Write a blog on <a href="https://medium.com/u/504c7870fdb6">Medium</a> (I really do love Medium). It allows employers or recruiters to search for you. Or better still, employers can search for you when considering you application and view your work to back up your CV. When we were recruiting and I was going through CVs I remember being impressed by the content of one of the candidates personal blogs. Consequently, he was a “yes” to come and interview with us.</li><li><strong>Start building your network. </strong>Go to data science <a href="https://www.meetup.com/">meetups</a> and speak to people. Reach out to people on <a href="https://www.linkedin.com">LinkedIn</a>. As they say <em>it’s not what you know, it’s who you know </em>and if you get in touch with the right person you never know what could happen.</li></ul><p>Thank you very much for reading and I hope this has been useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91558063aa9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/academia-to-data-science-91558063aa9e">Academia to data science</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>