<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MKSeymour</title>
    <description>The latest articles on DEV Community by MKSeymour (@mkseymour).</description>
    <link>https://dev.to/mkseymour</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F269314%2F484e8816-44e4-489e-bb43-28ac709dbf80.jpg</url>
      <title>DEV Community: MKSeymour</title>
      <link>https://dev.to/mkseymour</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mkseymour"/>
    <language>en</language>
    <item>
      <title>Love to write code, don't like writing comments...Intro to Docly</title>
      <dc:creator>MKSeymour</dc:creator>
      <pubDate>Mon, 19 Oct 2020 22:19:49 +0000</pubDate>
      <link>https://dev.to/mkseymour/love-to-write-code-don-t-like-writing-comments-intro-to-docly-3b2o</link>
      <guid>https://dev.to/mkseymour/love-to-write-code-don-t-like-writing-comments-intro-to-docly-3b2o</guid>
      <description>&lt;p&gt;&lt;strong&gt;Docly&lt;/strong&gt; is a useful code commenting tool. It generates docstrings for your python functions to improve readability and maintainability.&lt;/p&gt;

&lt;p&gt;It can be run in two ways. The first one just &lt;strong&gt;checks&lt;/strong&gt; to see if there are any comments that need to be modified. The second way actually &lt;strong&gt;modifies&lt;/strong&gt; the comments. &lt;/p&gt;

&lt;p&gt;Beta is now open, you can test Docly on your own code 👉&lt;a href="http://thedocly.io/"&gt;http://thedocly.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docly yours 😉,&lt;/p&gt;

</description>
      <category>python</category>
      <category>codequality</category>
    </item>
    <item>
      <title>1 line of code to check all your code documentation</title>
      <dc:creator>MKSeymour</dc:creator>
      <pubDate>Mon, 13 Jul 2020 16:11:37 +0000</pubDate>
      <link>https://dev.to/mkseymour/1-line-of-code-to-check-all-your-code-documentation-3hdf</link>
      <guid>https://dev.to/mkseymour/1-line-of-code-to-check-all-your-code-documentation-3hdf</guid>
      <description>&lt;p&gt;If { &lt;br&gt;
   ✅ you have code in Python&lt;br&gt;
   ✅ you are not sure which documentation of the code is reliable&lt;br&gt;
   ✅ don't have time to check for it manually &lt;br&gt;
   }&lt;/p&gt;

&lt;p&gt;Then : definitely look for &lt;a href="https://github.com/autosoft-dev/code-bert"&gt;codeBERT library&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;codeBERT is an open-source package to automatically check if your code documentation is up-to-date. codeBERT uses Machine Learning on code to classify the docstring of functions. &lt;br&gt;
Given a function f and a doc string d a code-bert predicts whether f and d are matching or not.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;
      &lt;div class="ltag__twitter-tweet__media ltag__twitter-tweet__media__video-wrapper"&gt;
        &lt;div class="ltag__twitter-tweet__media--video-preview"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x46hjQuO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/tweet_video_thumb/EcR9vusX0AcT-CU.jpg" alt="unknown tweet media content"&gt;
          &lt;img src="/assets/play-butt.svg" class="ltag__twitter-tweet__play-butt" alt="Play butt"&gt;
        &lt;/div&gt;
        &lt;div class="ltag__twitter-tweet__video"&gt;
          
            
          
        &lt;/div&gt;
      &lt;/div&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--zyKM645J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1275420642733670401/eFq3QB10_normal.jpg" alt="CodistAI profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        CodistAI
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @aicodist
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      A few days ago &lt;a href="https://twitter.com/Altimor"&gt;@Altimor&lt;/a&gt; showed how GPT3 could write code.&lt;br&gt;Now, this is how &lt;a href="https://twitter.com/hashtag/codeBERT"&gt;#codeBERT&lt;/a&gt; can read your code and automatically review your documentation.&lt;br&gt;When &lt;a href="https://twitter.com/hashtag/MLonCode"&gt;#MLonCode&lt;/a&gt; can help get rid of the documentation pain!&lt;br&gt;🕹 Repo: &lt;a href="https://t.co/SpzjEzxSPD"&gt;github.com/autosoft-dev/c…&lt;/a&gt;&lt;br&gt;🎬&lt;a href="https://t.co/PkKmFcUaNa"&gt;youtu.be/oDqW1JHmaYY&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="https://twitter.com/hashtag/codequality"&gt;#codequality&lt;/a&gt; 
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      23:46 PM - 06 Jul 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1280287022041698306" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1280287022041698306" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      4
      &lt;a href="https://twitter.com/intent/like?tweet_id=1280287022041698306" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      5
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;So far the accuracy of the library is pretty stable around 93-95% when it comes to detect if a docstring is outdated.&lt;/p&gt;

</description>
      <category>codequality</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>New NLP technics increase gender bias by 40%</title>
      <dc:creator>MKSeymour</dc:creator>
      <pubDate>Sun, 21 Jun 2020 12:43:08 +0000</pubDate>
      <link>https://dev.to/mkseymour/new-nlp-technics-increase-gender-bias-by-40-2bgl</link>
      <guid>https://dev.to/mkseymour/new-nlp-technics-increase-gender-bias-by-40-2bgl</guid>
      <description>&lt;p&gt;I was looking for engineers' pictures on google images. Over the first 30 images: 24 were representing men only, 3 women only and 1 a group of developers. &lt;/p&gt;

&lt;p&gt;I'm pretty sure the ratio of women in developers' population if way higher than 10%. Yet my browser was utterly biased towards male representation. I tried with other queries like pre-school teacher, college teacher, nurse... they were all gender biased.&lt;/p&gt;

&lt;p&gt;This is not a big surprise, Information Retrieval models learn the bias of the dataset they are trained on.  What's surprising is that this is not getting any better over time, on the contrary. According to a recent study from &lt;a href="https://arxiv.org/pdf/2005.00372.pdf"&gt;Kepler University&lt;/a&gt;, the newest NLP models (like BERT) intensify gender bias.&lt;/p&gt;

&lt;h2&gt;
  
  
  NLP models ingests gender-bias
&lt;/h2&gt;

&lt;p&gt;Over the last 2 years, increasingly performant Natural Language Processing (NLP) algorithms have come out (like BERT or BLEURT).  Computer can learn better than ever about languages and their meaning. Give a model a text it will sum it up for you and answer any questions. State-of-the-art NLP models can infer a lot about the world where are living it. And this world is full of bias. &lt;/p&gt;

&lt;p&gt;The bias in AI models is the inevitable accumulation of biases in human history and language.&lt;/p&gt;

&lt;p&gt;When you train an NLP model, as any ML model, you feed it with data which are text. The model will learn the relationships between words. For example, {nurse- doctor - hospital} or {sand-beach} will be highly correlated. So using that model, if you make a search about 'hospital', you will get results of doctors and nurses along.&lt;/p&gt;

&lt;p&gt;Problem is that the data we feed in is biased. For example, a text about 'doctors' will mainly use words related to men (he, man, guy...).  So the model trained will learn that there is a correlation between 'doctor' and 'man'. &lt;/p&gt;

&lt;p&gt;Documents have gender, and models learn them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the gender of my document?
&lt;/h2&gt;

&lt;p&gt;For any document, you can calculate the magnitude of the gender represented in it. Measure degree of presence of male-female concepts in it. There are different tehcnics. I'll take the TF (Term Frequency) method which is similar to TF used for word embedding. With that method, you define a set of words correlated with one of  the gender female or male  (e.g &lt;em&gt;female&lt;/em&gt; = {she, woman, lady, pregnant...}, &lt;em&gt;male&lt;/em&gt; = {he, man, sir, father ...} ). The TF method is about counting the frequency of the set of terms standing for each gender.&lt;br&gt;
For document &lt;em&gt;d&lt;/em&gt; we get magnitude of female an male in the document. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rL9lBitb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.notion.so/Neural-Ranking-Models-Intensify-Gender-Bias-43383c0d9e0a4e64b793ccdd0ebc9759%233c1e626af3ac4641a81d156f751f8c80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rL9lBitb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.notion.so/Neural-Ranking-Models-Intensify-Gender-Bias-43383c0d9e0a4e64b793ccdd0ebc9759%233c1e626af3ac4641a81d156f751f8c80" alt="TF calculation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By subtracting male and female magnitude we get the overall magnitude of a document. This way of calculation treats gender as a signed value. If positive the document is about man mainly and if negative, about female mainly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Late-NLP models make gender-bias worse
&lt;/h2&gt;

&lt;p&gt;Kepler University study put forward that the more elaborate and performant was a NLP model, the more it will intensify the gender bias.&lt;/p&gt;

&lt;p&gt;They took a set of queries made on Bing and the anwsers provided. Same way you can classify the gender of a document, you can also classify the gender of a query. So they get a set of male, female, non-gendered and multiple genders queries.&lt;/p&gt;

&lt;p&gt;They created Informaton Retrieval models based on different embeddingg technics (BM25, KNMR, MatchPyramid, BERT...).  For the same set of queries,they compared the gender-bias induce by the different NLP embedding technics.&lt;/p&gt;

&lt;p&gt;It was pretty surprising, all queries answers were biased towards male and the latest models like BERT increased the bias by 40%.&lt;/p&gt;

&lt;p&gt;AI is a tool and as an AI engineer, we must always consider who will be using our systems and for what purpose. &lt;/p&gt;

&lt;h2&gt;
  
  
  How can we reduce gender bias in NLP systems
&lt;/h2&gt;

&lt;p&gt;An 'easy' way to fight it, is to use more balanced datasets. Gender-swapping technic is a solution, it consists of swapping the pronoun of a sentence to create more consistent data for the female gender. For example, 'he is a doctor' would be replaced by 'she is a doctor'. &lt;/p&gt;

&lt;p&gt;This topic is becoming a quickly-growing area of research. Google recently released their method to reduce gender-bias in transation:  &lt;a href="https://ai.googleblog.com/2020/04/a-scalable-approach-to-reducing-gender.html"&gt;A scalable approach to reduce gender-bais&lt;/a&gt; (Apr, 2020). Since 2018 they've been working on reducing gender bias for neutral languages like English but were struggling to make it scale to other languages.  To my knowledge, this technic is applied to translation and not yet to browsing.&lt;/p&gt;

&lt;p&gt;As our awareness grows, we must realize our role in creating technology that works for the many, not the few.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>programming</category>
      <category>nlp</category>
    </item>
    <item>
      <title>Dev tools 1.0 : we came a looong way 🐱‍👤</title>
      <dc:creator>MKSeymour</dc:creator>
      <pubDate>Mon, 04 May 2020 14:19:43 +0000</pubDate>
      <link>https://dev.to/mkseymour/do-you-know-what-first-dev-tools-looked-like-3epf</link>
      <guid>https://dev.to/mkseymour/do-you-know-what-first-dev-tools-looked-like-3epf</guid>
      <description>&lt;p&gt;Let’s do some digging into the first-generation of computers, and meet with punched-cards. Back then, they were the basic unit of data.&lt;/p&gt;

&lt;p&gt;If you dreamed about running a program, you’d rather be patient and highly careful. This is why. First, as a developer, you would write your instructions in an old programming language (like Cobol or Fortran). It was written on a piece of paper, the coding sheet. Then you’d pass over your coding sheet to a keypunch operator that would “encode” it into a source deck. The source deck was a bunch of punched cards and each card was one line of instruction 😥 Then (yes I know that’s a lot)…the source deck was compiled by the computer operator into a program deck. And finally, that program deck could be fed to a computer to run!&lt;/p&gt;

&lt;p&gt;😣 Have you ever seen a program running perfectly on the first try?… Well you can be sure you had to repeat the whole process again and again and again before it worked.&lt;/p&gt;

&lt;p&gt;These steps were individually really long and cumbersome. The first generation of dev tools helped to solve these challenges.&lt;/p&gt;

&lt;p&gt;To fix bugs, programmers had to go through the source deck. Initially, it was just a bunch of cards with some square holes. Reading back the original program was taking ages. So, keypunch printers were invented. On top of each punched card the translation in natural language was written. It was the first program reading interface.&lt;/p&gt;

&lt;p&gt;What about the code complexity? With one instruction per card, it was easy to get entangled in complex programs. To monitor the complexity programmers stored the source deck in boxes (first source code hosting system 😎). The size of the boxes was actually built-in to fit the maximum batch size for a computer to run. This was an easy way for programmers to see when they had to refactor their code.&lt;/p&gt;

&lt;p&gt;At the early stages of Computers, programmers were dealing daily with cards, boxes, rubber bands, and request forms. That might not seem highly sexy but dev tools had to be physical back then.&lt;/p&gt;

&lt;p&gt;🏓 If you want to play with old school punched card, you should give a try to The Virtual Keypunch (&lt;a href="https://www.masswerk.at/keypunch/"&gt;https://www.masswerk.at/keypunch/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Thanks for reading! &lt;/p&gt;

</description>
      <category>tools</category>
      <category>development</category>
      <category>productivity</category>
      <category>devtips</category>
    </item>
  </channel>
</rss>
