<?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 Ellis Brown on Medium]]></title>
        <description><![CDATA[Stories by Ellis Brown on Medium]]></description>
        <link>https://medium.com/@ellisbrown?source=rss-5f4a1f403b7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Dtgq5GN-jA_hz5v9xK745Q.jpeg</url>
            <title>Stories by Ellis Brown on Medium</title>
            <link>https://medium.com/@ellisbrown?source=rss-5f4a1f403b7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 06:16:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ellisbrown/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[Make the time to go to the doctor, even if you feel perfectly healthy!]]></title>
            <link>https://medium.com/@ellisbrown/make-the-time-to-go-to-the-doctor-even-if-you-feel-perfectly-healthy-3c4a25823d93?source=rss-5f4a1f403b7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c4a25823d93</guid>
            <category><![CDATA[health]]></category>
            <category><![CDATA[life-lessons]]></category>
            <dc:creator><![CDATA[Ellis Brown]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 05:00:00 GMT</pubDate>
            <atom:updated>2020-01-24T22:49:17.909Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I originally posted this on Instagram a little over a week ago. After hearing that dozens of people had decided to make doctors appointments after seeing my post, I felt compelled to formalize the message here so that it could reach more people.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*WWiX2EcjJQQyGq56.jpg" /></figure><p>If you told me a year ago I would need open-heart surgery just after turning 25, I would have thought you were crazy. Just like most new college grads, I had felt healthy and invincible for as long as I could remember.</p><p>Last spring I made an appointment with a neurologist regarding infrequent migraines I had been having. Luckily my case is nothing more than a nuisance, but something unexpected struck me from my visit. When the doctor asked me who my PCP (primary care physician) was, I was at a loss for words.</p><p>I had seen the same pediatrician since I was a kid, even over the summers while in college; in my two and a half years on my own in the real world, getting a routine checkup had not even crossed my mind. I was preoccupied with work and life in a new city. But hey, I was healthy and finding a doctor is nearly impossible when you’re working full-time. He gave me a bit of a hard time about it and pointed me to a couple of good PCPs to look up.</p><p>Luckily I listened.</p><p>I carved out the time and scheduled a physical with a new PCP. All the tests looked great as expected, but he remarked that I had a heart murmur (abnormal sounding heartbeat). I had known about the murmur my whole life — I’d had it checked out when I was younger and it was no big deal. The doctor said I should follow up with a cardiologist to get it checked in-depth, just to be safe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*gAer2NsAbXVY847L.jpg" /></figure><p>A couple of weeks and a barrage of tests later, I was diagnosed with a congenital heart valve defect that was causing my aortic valve to deteriorate and my aortic root to enlarge. If I didn’t get it fixed or replaced in the next year or two, my valve could go beyond repair and I would have an aneurysm, likely before my 30s.</p><p>In the grand scheme of things, my health scare has been relatively manageable. There are a lot of diagnoses that would have been much worse. I was lucky to find out about my condition when I did, and luckier still to have had access to such great doctors. I was able to have surgery to repair my valve and aortic root, and my heart is now healthier than ever.</p><p>Unexpected health issues can arise in your mid-twenties, even if you feel perfectly fine! I know it is hard to make time, but a couple of hours to get a checkup now could give you 60 years.</p><p><em>Originally published at </em><a href="https://ellisbrown.github.io/life/make-time-for-the-doctor/"><em>https://ellisbrown.github.io</em></a><em> on January 23, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c4a25823d93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gender Inference from Character Sequences in Multinational First Names]]></title>
            <link>https://medium.com/data-science/name2gender-introduction-626d89378fb0?source=rss-5f4a1f403b7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/626d89378fb0</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ellis Brown]]></dc:creator>
            <pubDate>Tue, 26 Dec 2017 23:50:49 GMT</pubDate>
            <atom:updated>2020-01-22T18:55:48.118Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1nbXeSlEOk160kpng_i6A.png" /><figcaption>Gender Inference from Character Sequences in Multinational First Names using Naïve Bayes and PyTorch Char-RNN</figcaption></figure><p>Consider the names “John” and “Cindy” — most people would instantly mark John as a male name and Cindy as a female one. Is this the case <em>primarily</em> because we have seen so many examples of male Johns and female Cindys that our brains have built up a latent association between the specific name and the corresponding gender? Probably.</p><p>But some component of the name itself (its spelling / combination of letters) contributes to the gender with which it is associated to a large degree as well. Consider the names “Andy” and “Andi.” They are phonetically identical (<a href="https://en.wiktionary.org/wiki/Andy#Pronunciation">/ˈæn.di/</a>), however most people would categorize “Andy” as male and “Andi” as female upon seeing the spellings. The suffix of a name can indicate the name’s gender; however, the rules are not cut and dry. For example, names “ending in <em>-yn</em> appear to be predominantly female, despite the fact that names ending in <em>-n</em> tend to be male; and names ending in <em>-ch</em> are usually male, even though names that end in <em>-h</em> tend to be female” <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#fa55">[1]</a>. There are many more character patterns that correspond to a certain gender classification than just the suffix — this task is not trivial.</p><p>The gender classification of a name becomes increasingly difficult when you consider the space of all names from around the world — the examples I have given thus far are admittedly from a standard American viewpoint. Let’s now consider two Indian names (a culture with which I have next to no exposure): when I see the names “Priyanka” and “Srikanth,” I instantly assume Priyanka to be female and Srikanth to be male. Why is that? How do our brains extract the gender revealing information encoded in the sequence of characters that compose a name?</p><h4>Who cares?</h4><p>Accurate prediction of an unknown individual’s gender is desirable for use in marketing, social science, and many other applications in academia and industry. Perhaps the most obvious and telling indicator of a person’s gender is their first name. Most previous work in classifying gender via first name has concerned using a large corpus of known names to give a probabilistic prediction on the names that are known. This post attempts to explore the space of names that are <em>unknown</em> by examining the facets of a first name — specifically focusing on the sequences of characters within the name — that contain non-trivial gender-revealing information. It is also an exercise in applying ML/DL to real problems.</p><p>This gender classification problem is similar to but fundamentally different from a larger class of problem in <a href="https://en.wikipedia.org/wiki/Natural_language_understanding">Natural Language Understanding</a>. Given the words “cat” and “dog,” almost all people will assign cat to female and dog to male.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/0*YOnbYRyTDBwdt3Kp.jpg" /><figcaption>source: <a href="https://goo.gl/YZPEjm">https://goo.gl/YZPEjm</a></figcaption></figure><p>The core difference here is that when we read the word “dog,” our brains translate the sequence of characters “d-o-g” to a high dimensional representation of the abstract entity that <em>is</em> our understanding of a dog. It is some combination of features in this high dimensional representation in our brains that correlate more closely to our abstract representation of <em>males</em> than to that of <em>females</em>; it is not the sequence of characters themselves that contain the gender-revealing information (at least for the most part).</p><p>Our gender classification problem becomes even more interesting when you abstract it from names to <em>all</em> words in general. Linguistically, many languages are structured with the concept of a <a href="https://en.wikipedia.org/wiki/Grammatical_gender"><em>grammatical gender</em></a><em> </em>wherein classes of nouns in the language are formally associated with one of a discrete set of genders <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#87ae">[2]</a>. In such languages, certain sequences of characters in a word can almost surely identify the grammatical gender of the word. Learning these character sequences — whether explicitly or implicitly — is an inherent part of learning the language. Furthermore, understanding of such character patterns may assist in understanding of unseen words. For these reasons, studying information embedded in character sequences seems like an interesting and integral topic to Linguistics and NLU that is beyond the scope of this post.</p><h3>Methodology</h3><blockquote>All code for this project is available at <a href="https://github.com/ellisbrown/name2gender">GitHub://ellisbrown/<strong>name2gender</strong></a>.</blockquote><p><a href="https://github.com/ellisbrown/name2gender/">ellisbrown/name2gender</a></p><p>As an initial approach to the topic, I explore a vanilla machine learning technique using hard-coding features of names that are known to have high correlation to the name’s associated gender (such as suffix, as mentioned earlier). This quick and dirty implementation is actually able to achieve pretty good results with minimal work.</p><p>The features in used in this approach are pulled directly from the NLTK book:</p><blockquote>Names ending in -a, -e and -i are likely to be female, while names ending in -k, -o, -r, -s and -t are likely to be male… names ending in -yn appear to be predominantly female, despite the fact that names ending in -n tend to be male; and names ending in -ch are usually male, even though names that end in -h tend to be female. <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#fa55">[1]</a></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b8cc04b818e7679aeffb5cd8123164e/href">https://medium.com/media/5b8cc04b818e7679aeffb5cd8123164e/href</a></iframe><p>These features are plugged into the NLTK NaiveBayesClassifier for easy training and testing.</p><h4>Results</h4><p>I trained this model with a 70/30 train-test split (~95k training names, ~40.6k testing names). The testing accuracy was around <strong>85%</strong>, which is arguably pretty good for this task.</p><p>Example code usage is available at <a href="https://github.com/ellisbrown/name2gender/blob/master/naive_bayes/demo.ipynb">naive_bayes/<strong>demo.ipynb</strong></a>.</p><h3>Char-RNN</h3><p>Of course, there are many many patterns of characters in a name that might contain gender cues — especially when considering our global (worldly) name space; it seems absurd to attempt to hard code every possible pattern when we have <a href="https://en.wikipedia.org/wiki/Deep_learning">Deep Learning</a>. In this vein, I explore a Character-level Recurrent Neural Network approach using <a href="http://pytorch.org/about/">PyTorch</a> that attempts to learn the various gender-revealing sequences without having to explicitly specify them.</p><h4>Tensor Representation</h4><p>The first step here is to figure out how to represent a name as a <a href="https://en.wikipedia.org/wiki/Tensor">tensor</a>. Since our goal is to pick up on all of the nuances in the sequences of letters that make up first names, we want to break up the name and look character by character. In order to represent each character, we create a <a href="https://hackernoon.com/what-is-one-hot-encoding-why-and-when-do-you-have-to-use-it-e3c6186d008f">one-hot vector</a> of size &lt;1 x N_LETTERS&gt; (a one-hot vector is filled with 0s except for a 1 at the index of the current letter, e.g. &quot;<strong>c</strong>&quot; = &lt;0 0 <strong>1</strong> 0 0 ... 0&gt;).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b50b3cf1c7ffcf803027d45b4de76c8/href">https://medium.com/media/0b50b3cf1c7ffcf803027d45b4de76c8/href</a></iframe><p>An alternative approach might be to store the value of a character by its location in the alphabet &quot;<strong>c</strong>&quot; = 3; however, this might cause the model to learn some patterns in the value of the character that we do not intend (e.g., it might learn that “c” is more similar to “a” than it is to “x” because they are closer alphabetically while there is actually no similarity difference).</p><h4>Model Definition</h4><p>We then define the structure of the network module itself:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*vC5Jaj3q19JDhkfM.png" /><figcaption>source: https://goo.gl/BB7h2A</figcaption></figure><p>Following the direction of the <a href="https://goo.gl/BB7h2A">PyTorch name nationality classification example</a>, we create a simple network with 2 <a href="https://en.wikipedia.org/wiki/Linear_map">linear</a> <a href="http://pytorch.org/docs/master/nn.html#linear-layers">layers</a> operating on an input and hidden state, and a <a href="http://pytorch.org/docs/master/nn.html#logsoftmax">LogSoftmax</a> layer on the output. I use 128 hidden units <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#e6fb">[4]</a>.</p><p>This is a very simple network definition, and likely could be improved by adding more linear layers or better shaping the network.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40707e9c10fe9db3d904ae8b2f3b6a36/href">https://medium.com/media/40707e9c10fe9db3d904ae8b2f3b6a36/href</a></iframe><h4>Results</h4><p>I again split the dataset with a 70/30 train-test split (~95k training names, ~40.6k testing names). The best testing accuracy I was able to achieve was around <strong>75.4% accuracy</strong>. I did not spend much time tweaking hyper-parameters for better results.</p><h3>Dataset — <a href="https://github.com/ellisbrown/name2gender/tree/master/data">name2gender/data/</a></h3><p>I have extended NLTK’s names corpus with many more datasets representing various cultures into a large dataset (~135k instances) of gender-labeled first names, which is available on my repository. See <a href="https://github.com/ellisbrown/name2gender/blob/master/data/dataset.ipynb">data/<strong>dataset.ipynb</strong></a> for further information on how I pulled it together. <em>Note:</em> I did not spend a ton of time going through and pruning this dataset, so it is probably not amazing or particularly clean (I would greatly appreciate any PR’s if anyone cares or has the time!).</p><p>Improving / cleaning this dataset would likely be the most impactful improvement initially. Additionally, using a dataset of only names from a single culture would likely be much better at predicting names in that culture.</p><h3>Disclaimer</h3><p>It is worthy to acknowledge that there are many names, such as my own (Ellis), that are about equally common among both genders. Datasets containing discrete labels, as opposed to frequency of occurrence in the world, were much easier to come across, and so I have only taken into consideration the binary classification of names given by these datasets. A more robust approach would incorporate the frequency of occurrence in a population to give a more probabilistic gender prediction. The “Gender-name association scores” approach by Liu might be a good approach <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#408a">[3]</a>. The presence of gender ambiguous names also limits the best case real-world accuracy that could be achieved by a gender classification system.</p><p>Furthermore, there are increasing movements being made to recognize more than the traditional binary male and female genders in our society. As these efforts are still in their infancy and there is very little (if any) data containing these expanded gender classifications, I make no attempt to incorporate them into this analysis.</p><p>I also only take names written in the Latin Alphabet into consideration. Abstracting to entirely language agnostic classification is too formidable a task for the sake of this post.</p><h3>Future Work</h3><p>As I touched on above, improving the dataset is definitely the best starting point for improvements.</p><p>Application of this name to gender classification to variations of first names would be a really useful to anyone who finds first name classification useful. As Liu puts it:</p><blockquote>“Nicknames, abbreviations, mangled names, and usernames can frequently contain non-trivial gender cues. Identifying strategies for extracting and using these cues to more accurately infer gender is a promising direction for future work.” <a href="https://medium.com/@ellisbrown/name2gender-introduction-626d89378fb0#408a"><em>[3]</em></a></blockquote><p>There is also the possibility of crafting the testing scheme to better represent a real world use case. In my analysis, I treated every name as equally likely to occur. A better real world dataset might include some representation of how frequently a certain name occurs in the world. For example, “John” would have a much higher frequency rating than “Ellis.” This change would affect how the testing results are calculated, and the system as a whole. We would ideally have most of the common first names included in our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*zMwd3YRqp0CLBKW2iO4bUQ.png" /><figcaption>Name Frequency scheme</figcaption></figure><p>For such names, we could simply lookup what our datastore has for the gender of the name. Our predictive system would then only be applied to the set of names that are not common. To test this system setup, we could sort the names by frequency rating, and leave the 30% of names that are least common for the test set.</p><h3>References</h3><ol><li>Bird, S., Klein, E., and Loper, E. “6.1.1 Gender Identification.” <em>Natural Language Processing with Python: Analyzing Text with the Natural Language Toolkit</em>, O’Reilly, 2009, <a href="http://www.nltk.org/book/ch06.html.">www.nltk.org/book/ch06.html.</a></li><li>“Grammatical Gender.” <em>Wikipedia</em>, Wikimedia Foundation, 21 Dec. 2017, <a href="https://en.wikipedia.org/wiki/Grammatical_gender">en.wikipedia.org/wiki/Grammatical_gender</a>.</li><li>Liu, W., and Ruths, D. “What’s in a Name? Using First Names as Features for Gender Inference in Twitter” <em>AAAI Spring Symposium Series</em> (2013), 21 Dec. 2017 <a href="https://www.aaai.org/ocs/index.php/SSS/SSS13/paper/view/5744/5908">https://www.aaai.org/ocs/index.php/SSS/SSS13/paper/view/5744/5908</a>.</li><li>Robertson, S. “Classifying Names with a Character-Level RNN.” <em>Classifying Names with a Character-Level RNN</em>, PyTorch Docs, 2017, <a href="http://pytorch.org/tutorials/intermediate/char_rnn_classification_tutorial.html">http://pytorch.org/tutorials/intermediate/char_rnn_classification_tutorial.html</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=626d89378fb0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/name2gender-introduction-626d89378fb0">Gender Inference from Character Sequences in Multinational First Names</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>