<?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 Natasha Butt on Medium]]></title>
        <description><![CDATA[Stories by Natasha Butt on Medium]]></description>
        <link>https://medium.com/@nbutt2.314?source=rss-5ae3ebeb4f62------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wQf58Ji4pep3_N1OwOlf7Q.jpeg</url>
            <title>Stories by Natasha Butt on Medium</title>
            <link>https://medium.com/@nbutt2.314?source=rss-5ae3ebeb4f62------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 06:46:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nbutt2.314/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[Bayesian Modelling of UK Stop and Search]]></title>
            <link>https://medium.com/data-science/bayesian-modelling-of-uk-stop-and-search-3f9947272fce?source=rss-5ae3ebeb4f62------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f9947272fce</guid>
            <category><![CDATA[police]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Natasha Butt]]></dc:creator>
            <pubDate>Sun, 18 Oct 2020 14:58:17 GMT</pubDate>
            <atom:updated>2020-10-18T14:58:17.162Z</atom:updated>
            <content:encoded><![CDATA[<h4>Fitting Poisson generalised linear mixed models with Bayesian inference to investigate disproportionate use of stop and search</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4D_tlG9Ww-SWZP4p3WIiSw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kingschurchinternational?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">King’s Church International</a> on <a href="https://unsplash.com/s/photos/police?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>There is growing discourse around disproportionate use of stop and search in the UK and internationally. Looking at stop and search counts in proportion to arrest counts for police forces in England and Wales, we may investigate whether there are differences across ethnicity groups. Specifically, a Poisson generalised linear mixed model is implemented to allow for both ethnicity group fixed effects and police force random effects. The model is fit with Bayesian inference using Gibbs sampling and we find <strong>substantial differences in the samples for our ethnicity group effects</strong>. This evidences disproportionate use of stop and search at the police force geographical level. The implementation of a BUGS model for this project may be found on <a href="https://github.com/natashabutt/PoissonGLMM">GitHub</a>.</p><h3>Background</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHN5toZh6sTcm5lYBzLpFw.jpeg" /></figure><p>Existing literature aims to investigate disproportionate use of stop and search. Bowling and Phillips (2007)¹ provides an extensive summary and discussion of the literature with respect to the UK, arguing that the statistics show the use of stop and search powers against black individuals is disproportionate. A common statistic to look at here is the number of stops and searches per resident by ethnicity group. This may be seen in the line chart, for example, in 2019, the number of stops and searches of black individuals per 1,000 black residents is over 9 times greater than the number of stops and searches of white individuals per 1,000 white residents.</p><p>Bowling and Phillips (2007) highlight that statistics that are normalised by resident populations are often criticised as potentially varying crime participation and ‘availability’ are not taken into account. Here, ‘available’ is defined by Miller (2000)² as describing an individual who uses public places when and where stops and searches take place. Further, Miller (2000) does find differences in resident populations and available populations, with individuals from black, Asian and minority ethnic backgrounds overrepresented in available populations relative to resident populations. Therefore, in this project, stop and search is investigated in proportion to arrests. However, it should be noted that if bias is present in the stop and search process, there may also be bias present in the arrest process as both of these generally require ‘reasonable grounds’. It seems fair to assume that, if present, these biases would have the same direction and thus looking at stop and search in proportion to arrests may act as a minimum threshold for disproportionality.</p><h3>Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*0P80CERLPuSXvPi5Zn6uiw.jpeg" /></figure><p>Stop and search individual level data is publicly available, provided by the UK police³. For this project, we have taken all the stops and searches (~1.9m) that are reported by police forces in England and Wales over January 2015 to February 2020 inclusive. Exploring this data is interesting, for example, the most common object of search is shown to be drugs (56%), with offensive weapons only found to account for 10% of all objects of search. Further, around 70% of stops and searches result in no further action being taken and only around 15% lead to arrest. There are also a wide range of further actions that may be taken aside from arrest as shown in the stacked bar chart above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xh-wHnTrc9zmsRSQcmv1dw.png" /></figure><p>Each stop and search report includes police force and self-defined ethnicity. Thus, stop and search counts are aggregated by ethnicity and police force. Arrest counts by ethnicity group are also publicly available, provided by the Home Office⁴. These are collected over March 2015 to March 2019. The map shows the ‘stop arrest gap’, the number of stops and searches of black individuals in proportion to the number of arrests of black individuals <strong>over</strong> the number of stops and searches of white individuals in proportion to the number of arrests of white individuals. Stop arrest gaps greater than 1 reflect black individuals being stopped and searched more often relative to white individuals and in proportion to arrests. There appears to be substantial variation by police force, supporting the use of a random police force effect in our Poisson generalised linear mixed model.</p><h3>Poisson Generalised Linear Mixed Model</h3><p>The implementation of a Poisson generalised linear mixed model to allow for ethnicity group fixed effects and police force random effects may be seen as an extension of Gelman et al.(2007)⁵. The authors look at stop and search in New York with ethnicity group fixed effects and police precinct random effects. Therefore, the implementation in this project looks at a larger scale with respect to the areal unit of police force vs precinct and the geographical area of England and Wales vs New York. Our final model is presented below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*rrzH0wdKzYuCF0TCUvmmQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*d1hl5wol2CeeQxQ3zHcwPw.png" /></figure><p>This model is fit with Bayesian inference using Markov Chain Monte Carlo methods. Specifically, Gibbs sampling is chosen due to the hierarchical structure of the model and BUGS software is used. Non-informative priors are assumed for all unknown parameters. Three parallel chains are run and the Gelman-Rubin statistic is used in combination with trace plots to assess convergence. Satisfactory evidence of convergence is reached with 2,000,000 iterations and 1,000,000 burn-in. Thinning of 10 is used to accommodate BUGS memory constraints.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*f6IpAAYIrUqlk83DioBVMw.png" /></figure><p>The results table shows the posterior mean as estimated by taking the mean of samples. Further, the credible interval represents the 95% high posterior density interval. Credible intervals do not span zero for any ethnicity group intercept and so there is 95% probability that a given ethnicity group effect takes a value greater than zero. Due to the log link function, the exponential of the posterior mean must be taken to quantify the ethnicity group effect on the number of stops and searches by police force and in proportion to arrests. Thus, by taking the exponential of the posterior mean we can see that Asian, black and mixed individuals are estimated to be stopped and searched 1.52, 1.30 and 1.20 times as often respectively, relative to white individuals and in proportion to arrests. Finally, below trace plots are shown on the left hand side, supporting evidence of convergence. Also, on the right hand side, density plots for the ethnicity group effects appear smooth and unimodal. Further, there is very low density below zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*1QaoLIvolZ40fObLZ5xV8w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*Pbiobqf3pnzCIIAIL28xLA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*jh11XOTJ-AloQdsnavtQwA.jpeg" /></figure><h3>Conclusion</h3><p>There are significant difficulties with measuring disproportionate use of stop and search due to the difficulties in controlling for potentially varying crime participation and availability. This project accounts for these by looking at stop and search in proportion to arrests, acting as a minimum threshold for disproportionality. Aggregating stop and search and arrests at the police force level, differences in the rate of stop and search in proportion to arrests are found across ethnicity groups. Asian, black and mixed individuals are estimated to be stopped and searched 1.52, 1.30 and 1.20 times as often respectively, relative to white individuals and in proportion to arrests. This is consistent with the findings of Gelman et al. (2007) in New York police precincts. Gibbs sampling with BUGS proves to be a flexible and effective way to simulate our posterior distributions. Further, the credible intervals for the variance parameters of the random effects do not span zero, supporting the implementation of the mixed effects model. Finally, if the arrest data were available at a lower geographical level, it would be useful to repeat this analysis with a smaller areal unit to investigate whether there is evidence of within police force random effects.</p><h3>References</h3><p>[1] Bowling, B. and C. Phillips (2007). Disproportionate and Discriminatory: Reviewing the Evidence on Police Stop and Search. <em>Modern Law Review.</em></p><p>[2] Miller, J. (2000). Profiling populations available for stops and searches. <em>Home office Police Research Series.</em></p><p>[3] UK Police (2020). Stop and search data. <a href="https://data.police.uk/data/">https://data.police.uk/data/</a> .</p><p>[4] Home Office (2019). Police powers and procedures England and Wales statistics. <a href="https://www.gov.uk/government/collections/police-powers-and-procedures-england-and-wales">https://www.gov.uk/government/collections/police-powers-and-procedures-england-and-wales</a> .</p><p>[5] Gelman, A., J. Fagan, and A. Kiss (2007). An analysis of the New York city police department’s stop-and-frisk police in the context of claims of racial bias. <em>Journal of the American Statistical Association.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f9947272fce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/bayesian-modelling-of-uk-stop-and-search-3f9947272fce">Bayesian Modelling of UK Stop and Search</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 Embed React Apps in WordPress Sites]]></title>
            <link>https://medium.com/better-programming/how-to-embed-react-apps-in-wordpress-sites-96a21b995290?source=rss-5ae3ebeb4f62------2</link>
            <guid isPermaLink="false">https://medium.com/p/96a21b995290</guid>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Natasha Butt]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 14:39:01 GMT</pubDate>
            <atom:updated>2020-06-26T14:39:01.401Z</atom:updated>
            <content:encoded><![CDATA[<h4>A beginner’s guide to creating interactive crossword puzzles in WordPress sites with React</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*kRsW3Y74Fto3JFbXL20mOQ.png" /><figcaption>Photo by the author.</figcaption></figure><p>A potential client recently asked for a React app with a flexible and responsive crossword component to be integrated with their existing WordPress site (similar to that on <a href="https://www.theguardian.com/crosswords/quick/15631">The Guardian</a>). Having read around, I saw that there was no clear best practise for performing this task, with a variety of different methods proposed on <a href="https://wp-and-react.com/#/">WordPress and React</a>. However, these often focus on redesigning the website architecture or involve WordPress plug-ins.</p><p>After much trial and error, I got this working without either, and so this article will provide a beginner’s step-by-step guide to my implementation. I will provide links to external resources to enable thorough debugging at each step. You can use any text editor to complete this task. My preference is <a href="https://atom.io/">Atom</a>.</p><h3>Create a New React Application</h3><p>React is a JavaScript library for building user interfaces. To create a new React project, we will use <a href="https://create-react-app.dev/">create-react-app</a>. You will need to have <a href="https://nodejs.org/">Node.js</a> &gt;= 8.10 installed on your local development machine. Once you have it installed, open your command prompt/terminal, go to the directory where you would like to create the project, and run the following line of code:</p><pre>cd path/to/directory</pre><p>Note that you should put your own path/to/directory here (on my Mac, I will often just drag a folder from my Finder into the command line). Then we will run the following line to create the project:</p><pre>npx create-react-app crossword-app</pre><p>crossword-app is the name of my project, so you can go ahead and change that to whatever you like. Next, we will simply open the project directory in our terminal again using cd and run our newly created app in development mode with the following line:</p><pre>npm start</pre><p>If you now open <a href="http://localhost:3000/">http://localhost:3000</a>, you should see a landing page with the React logo and some text with a link to learn React. If you’ve gotten this far, well done! If not, you may have some debugging to do/conflicting dependencies, so check out the <a href="https://create-react-app.dev/docs/getting-started">create-react-app documentation</a>.</p><h3>Add homepage Property</h3><p>We need to tell our application where it will live on our server. Due to the use of create-react-app, you now need to run the following code in your terminal with your project directory open before editing the package.json file:</p><pre>yarn eject</pre><p>Now, open the package.json file found in the top level of your project folder, and below “name”, add the new property homepage. This property will take the value of the URL where you would like your application to live on your server:</p><pre>&quot;homepage&quot;: &quot;<a href="http://localhost:8888/2020/06/24/react/">http://localhost:8888/2020/06/24/react/</a>&quot;</pre><p>Note that I am using a local server. localhost:8888 may be replaced by your website domain. However, it is a good idea to get this working locally first so that you do not have to make changes to your site until you have it working. Tania Rascia wrote a <a href="https://www.taniarascia.com/local-environment/">great article</a> on setting up a local environment.</p><h3>Add React DOM</h3><p>A Document Object Model (DOM) may be an object-oriented representation of a web page. We want our application to be loaded on a WordPress post, and so we will use the React DOM package to do this. First, go ahead and install this package by running this in the terminal with your project directory open:</p><pre>npm install --save react-router-dom</pre><p>Now, we need to give our target DOM element a unique ID so the application knows where on our post to load. Open public/index.html in your text editor and replace the div with the root to your unique ID (e.g. I chose my-crossword).</p><pre>&lt;div id=&quot;my-crossword&quot;&gt;&lt;/div&gt;</pre><p>To tell the application to render this div with the ID of my-crossword, open the src/index.js and update to the following lines of code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47ea336a17cf1c84ff1a00e436bd7910/href">https://medium.com/media/47ea336a17cf1c84ff1a00e436bd7910/href</a></iframe><h3>Add the Crossword Component</h3><p>Jared Reisinger at MIT has provided open-source code for this crossword component on <a href="https://github.com/JaredReisinger/react-crossword">GitHub</a>. You’ll need to install Jared’s package by executing the following code again in the terminal with your project directory open:</p><pre>npm install --save @jaredreisinger/react-crossword</pre><p>Once this is installed, open src/App.js in a text editor. Now, delete its contents and paste in the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69f2edf386babb095231fc7390570d92/href">https://medium.com/media/69f2edf386babb095231fc7390570d92/href</a></iframe><p>Note that you can customise data by adding more entries to across and down. You can now save the file and again run in the terminal with your project directory open:</p><pre>npm start</pre><p>This time, if you now open <a href="http://localhost:3000/">http://localhost:3000</a>, you should see your new interactive crossword. If you are having problems or would like further customisation, refer to Jared’s <a href="https://github.com/JaredReisinger/react-crossword">GitHub</a> page and try running the code in <a href="https://codesandbox.io/s/new">Code Sandbox</a>. This should help you identify whether the problem is arising as a result of your code or your local environment due to conflicting packages. Note that the styles sheet in Code Sandbox is different, so use:</p><pre>import &quot;./styles.css&quot;;</pre><p>Instead of:</p><pre>import &quot;./App.css&quot;;</pre><h3>Build React Application</h3><p>We are now almost ready to build our React app by running npm run build. However, the latest version of create-react-app installs a dependency <a href="https://webpack.js.org/">webpack</a> with a configuration that will split our build files into “chunks.” We do not want this and so we must perform the following reconfiguration. Start by installing react-app-rewired by running the following code in the terminal:</p><pre>npm install react-app-rewired --save-dev</pre><p>Next, create a file called config-overrides.js in the main project directory and add the following lines of code to it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de953d9551bc8aeea9a2592fa3a0dd3b/href">https://medium.com/media/de953d9551bc8aeea9a2592fa3a0dd3b/href</a></iframe><p>Now in package.json, replace the build, start, and test scripts with the following lines:</p><pre>&quot;start&quot;: &quot;react-app-rewired start&quot;,<br>&quot;build&quot;: &quot;react-app-rewired build&quot;,<br>&quot;test&quot;: &quot;react-app-rewired test&quot;,</pre><p>Finally, in the terminal with your project directory open, run again:</p><pre>npm start</pre><p>Followed by:</p><pre>npm run build</pre><h3>Deploy</h3><p>Now, you need to upload your application to your website server. To do this, create a folder called react in your WordPress site directory on the server at the path that you set your homepage to. For example, I created my react folder inside /2020/06/24/react/. There is a good explanation of file path notation on <a href="https://stackoverflow.com/questions/19272954/different-between-on-file-pathurl-in-asp-net">Stack Overflow</a>. Finally, copy the entire contents of your react build folder into your new WordPress react folder on the server.</p><p>Open WordPress and create a new post where you would like to embed the React app. The permalink of this page should match the homepage property in your package.json . For example, my permalink is http://localhost:8888/2020/06/24/react/. Switch to code editor mode and insert the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d36905141dc7c0ee0765d53bd8760ad/href">https://medium.com/media/3d36905141dc7c0ee0765d53bd8760ad/href</a></iframe><p>Note that the src here should be set to the path in your website directory that leads to the main JS file from your React project’s /build/static folder.</p><p>That’s it! If you hit Preview, you should see your React app embedded in your WordPress post. Check out my finished crossword app in the Code Sandbox below.</p><p>I hope that you have found this step-by-step guide to embedding React apps into WordPress sites useful! Let me know how you get on and feel free to leave any questions in the comments.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fd0pq0&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fd0pq0&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fd0pq0%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/8454feec0c3bba3583903d4a8282f808/href">https://medium.com/media/8454feec0c3bba3583903d4a8282f808/href</a></iframe><h3>Resources</h3><ul><li><a href="https://wp-and-react.com/#/">wp-and-react</a> (collection of tutorials and resources about WordPress and React development)</li><li><a href="https://atom.io/">Atom</a> (website for Atom text editor)</li><li><a href="https://create-react-app.dev/">create-react-app</a> (website for Create React App package)</li><li><a href="https://nodejs.org/">Node.js</a> (website for Node.js runtime environment)</li><li><a href="https://create-react-app.dev/docs/getting-started">create-react-app documentation</a> (documentation for Create React App package)</li><li>s<a href="https://www.taniarascia.com/local-environment/">etting up a local server environment</a> (article by Tania Rascia)</li><li>r<a href="https://github.com/JaredReisinger/react-crossword">eact-crossword</a> (GitHub repository by Jared Reisinger)</li><li><a href="https://codesandbox.io/s/new">Code Sandbox</a> (website for Code Sandbox online code editor and prototyping tool)</li><li><a href="https://stackoverflow.com/questions/19272954/different-between-on-file-pathurl-in-asp-net">path component shortcuts</a> (Stack Overflow discussion thread)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96a21b995290" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/how-to-embed-react-apps-in-wordpress-sites-96a21b995290">How to Embed React Apps in WordPress Sites</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mitigating Gender Bias in Occupation Classification]]></title>
            <link>https://medium.com/data-science/mitigating-gender-bias-in-occupation-classification-805edb389729?source=rss-5ae3ebeb4f62------2</link>
            <guid isPermaLink="false">https://medium.com/p/805edb389729</guid>
            <category><![CDATA[gender-equality]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[fairness-and-bias]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Natasha Butt]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 12:25:20 GMT</pubDate>
            <atom:updated>2020-12-02T16:02:37.634Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="https://towardsdatascience.com/tagged/fairness-and-bias">Fairness and Bias</a></h4><h4>A novel application of graph convolutional networks</h4><p><em>by </em><a href="https://medium.com/u/8676aed1508e"><em>Agnieszka Dobrowolska</em></a><em>, </em><a href="https://medium.com/u/1e1c1ee9a466"><em>Harita Dellaporta</em></a><em>, </em><a href="https://medium.com/u/2a2115cd2a43"><em>Johanna Meier</em></a><em> and </em><a href="https://medium.com/u/5ae3ebeb4f62"><em>Natasha Butt</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVujhS9FXgpmN2nLC8LsHg.jpeg" /><figcaption>Designed by pch.vector / <a href="https://www.freepik.com/free-photos-vectors/abstract">Freepik</a></figcaption></figure><p>With increasing evidence that some outputs of Natural Language Processing (NLP)-based machine learning models may propagate societal biases, we investigate mitigating gender bias in the occupation classification of job biographies. Through the novel use of a graph convolutional network, we find gender bias in occupation predictions is reduced by removing explicit gender indicators such as “she”. However, significant gaps remain emphasising the need for further study into de-biasing this NLP task. A demo of our trained model and analysis may be found on <a href="https://github.com/natashabutt/GCN-bias">Github</a>.</p><h3>Background</h3><p>Related work investigates reducing gender bias in NLP tasks through adjusting algorithms, de-biasing word embeddings and de-biasing training corpora. We focus on de-biasing training corpora. De-Arteaga et al. (2019)¹ find significant gender gaps in occupation classification with bag-of-words, fasttext word embeddings, and deep recurrent neural networks are reduced through scrubbing gender indicators. Extending this study with the novel use of the Yao et al. (2018)² text graph convolutional network (TextGCN), we explicitly utilise information about the global structure of our training corpus and learn the word and document embeddings jointly, thus capturing more latent information.</p><h3>Our Data</h3><p>In our experiments, we consider a subset of the BiosBias³ dataset by De-Arteaga et al. (2019), which consists of biographies and corresponding occupation labels taken from the first sentence of each biography. The subset comprises 97,798 biographies with 28 different occupation labels, for which the first sentence is excluded in the classification task. While <em>professor </em>is the most frequent occupation (35,136 biographies), the least frequent occupation is <em>personal trainer</em> (332 biographies). The proportion of female biographies varies from 12.3% (<em>rapper</em>) to 93.5% (<em>dietitian</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*zVuXtBTs0hw1z0s3.png" /><figcaption>Distribution of biographies by occupation and gender</figcaption></figure><h3>TextGCN Model</h3><p>The TextGCN takes one single heterogeneous graph with nodes corresponding to words and biographies as input. Therefore, the number of nodes in the graph equals the number of biographies plus the number of words in vocabulary. Any word-document edges are built if a word exists in a document and are weighted using TF-IDF, the term frequency — inverse document frequency. Similarly, a word-word edge is built if a word pair is semantically similar, which is measured by a positive point-wise mutual information value. Our best performing TextGCN architecture consists of a single hidden layer with 200 units. Between the graph convolutions, ReLU activations are used and a softmax function serves as a final classifier. The objective function is a cross-entropy loss over all labelled biographies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_DQldBaqwdGQlOay.jpeg" /><figcaption>TextGCN architecture</figcaption></figure><h3>Results</h3><p>We define our gender gap as the difference between genders in the probability of an individual’s occupation being correctly predicted given their occupation and gender. For example, the gender gap for <em>model </em>is the probability that a female model is predicted <em>model</em> minus the probability that a male model is predicted <em>model</em> by our trained model. For some occupations, we observe a gender gap of close to zero such as <em>journalist</em>. Whereas, for other occupations we observe a gender gap far from zero such as <em>surgeon</em>. In general, it is visible that for occupations with an underrepresentation of women, the gender gap tends to be negative and vice versa implying a positive correlation between gender gap and the gender imbalance. The correlation coefficient is 0.73.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*oPiZagriXK1F3WcJ.png" /><figcaption>Gender gap against probability of being female by occupation</figcaption></figure><p>Removing explicit gender indicators shrinks the gender gaps, as shown in the visualisation below where our line of best fit has a shallower gradient. Further, our correlation coefficient decreases to 0.69. However, gender gaps remain large for specific occupations with more pronounced gender imbalances. Therefore, although removing gender indicators reduces the gender bias in our predictions, there is more work to be done to de-bias this task completely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*J_D5do2SnGd-ybwi.png" /><figcaption>Comparison of gender gaps with and without gender indicators</figcaption></figure><h3>Conclusions</h3><p>The recent years have seen a large increase in the adoption of NLP-based machine learning methods for a growing number of tasks such as automated decision making, recommendation tasks and reading comprehension. As the presence of these systems becomes increasingly ubiquitous in our everyday lives, they move from being merely passive systems to having a more active effect on society, influencing which media articles appear on a feed or which job adverts one sees. Within recruitment, we have demonstrated occupation classifiers may make predictions with gender bias. Removing explicit gender indicators only goes so far in mitigating this bias. We hope that our article impresses the need for further investigation into de-biasing NLP-tasks. With a focus on de-biasing occupation classification, we will next be performing a comparative analysis of predictions with BERT, ALBERT and RoBERTa.</p><h3>References</h3><p>[1] De-Arteaga, Maria &amp; Romanov, Alexey &amp; Wallach, Hanna &amp; Chayes, Jennifer &amp; Borgs, Christian &amp; Chouldechova, Alexandra &amp; Geyik, Sahin &amp; Kenthapadi, Krishnaram &amp; Kalai, Adam. (2019). “Bias in Bios: A Case Study of Semantic Representation Bias in a High-Stakes Setting.” 120–128. <a href="https://arxiv.org/abs/1901.09451">https://arxiv.org/abs/1901.09451</a></p><p>[2] Liang Yao, Chengsheng Mao, and Yuan Luo. (2018). “Graph convolutional networks for text classification.” <a href="https://arxiv.org/abs/1809.05679">https://arxiv.org/abs/1809.05679</a></p><p>[3] BiosBias dataset, De-Arteaga et al. (2019), <a href="https://github.com/Microsoft/biosbias">https://github.com/Microsoft/biosbias</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=805edb389729" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/mitigating-gender-bias-in-occupation-classification-805edb389729">Mitigating Gender Bias in Occupation Classification</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>