<?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 Meghana Bhange on Medium]]></title>
        <description><![CDATA[Stories by Meghana Bhange on Medium]]></description>
        <link>https://medium.com/@meghanabhange13?source=rss-7be7092e84f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*df8LIU7wuwIryJQS.jpg</url>
            <title>Stories by Meghana Bhange on Medium</title>
            <link>https://medium.com/@meghanabhange13?source=rss-7be7092e84f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:40:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meghanabhange13/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[Arctic Monkeys Lyrics Generator | Revisited]]></title>
            <link>https://medium.com/data-science/arctic-monkeys-lyrics-generator-revisited-914bce61e013?source=rss-7be7092e84f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/914bce61e013</guid>
            <category><![CDATA[gpt-2]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[language-model]]></category>
            <category><![CDATA[mls]]></category>
            <dc:creator><![CDATA[Meghana Bhange]]></dc:creator>
            <pubDate>Wed, 20 May 2020 15:13:19 GMT</pubDate>
            <atom:updated>2020-05-20T15:53:13.371Z</atom:updated>
            <content:encoded><![CDATA[<h4>My model thinks I have a fiction-esque sense of humor</h4><p>I had to give a talk about a project <a href="https://towardsdatascience.com/arctic-monkeys-lyrics-generator-with-data-augmentation-b9b1f7989db0">I did a year ago</a> when I was in the third year, preparing for my internship and had to follow this pre-interview calendar. I was a newbie in Natural Language Processing(NLP) before that and well, knew atleast a fair bit at the end of the calendar. There was a task that I thought was extremely daunting back then, “write a blog on any topic that you liked learning?”</p><p>It was daunting because it was entirely up to me, and autonomy isn’t as much fun when you truly have it. I ended up mushing two things I liked, Arctic Monkeys and Text Generation. It takes in an artist name, collects all the lyrics, feeds it to a language model which is good at prediction next word in a sequence and creates lyrics in the style of your artist. I used <a href="https://github.com/johnwmillr/LyricsGenius">lyricsgenius</a> to scrape the lyrics. <a href="https://github.com/makcedward/nlpaug">nlpaug</a> to increase the dataset by augmenting it. GPT-2 as the language model which was trained using the <a href="https://github.com/minimaxir/gpt-2-simple">gpt2-simple</a> package.</p><p>You can see the talk <a href="https://www.youtube.com/watch?v=t4NFOIejZxQ&amp;t=2330s">here</a>, and if you want to look at the <a href="https://github.com/meghanabhange/Arctic-Monkeys-Lyrics-Generator">slides/notebooks</a>, you can see them here. There are a lot of changes I had to make to the notebook given that everything in NLP has an expiry date in months and all my code had become obsolete.</p><p>Following are the things that have changed or should I say, the things that were the same but I learnt/discovered a year later</p><p>— -</p><ul><li>GPT-2 stands for Generative Pretrained Transformer; Yes I didn’t know that before.</li><li>A lot of Python Packages are not good at backwards compatibility.</li><li>Do not, no matter how sleepy you are, do not forget to checkpoint your models.</li><li>GPT-2 Simple now offers four models, small (124M), medium(355M), large(774M), extra-large(774M).</li><li>Transformer works on the concept of self-attention (paying attention to different parts of a sentence to create a representation) which enables parallel estimations because you’re not processing the sentence one word at a time.</li><li>CHECKPOINT YOUR MODELS.</li><li>nlpaug moved from BERT aug to ContextualWordEmbs to incorporate all of them newer BERTs.</li><li>Do not forget to checkpoint your models.</li></ul><p><strong>Want to try it for yourself?</strong></p><ol><li>Get your data by changing the API Key and Artist Name in <a href="https://github.com/meghanabhange/Arctic-Monkeys-Lyrics-Generator/blob/master/01.Getting%20the%20lyrics.ipynb">this notebook</a>.</li><li>Train your model by changing the name of the text file to reflect your filename <a href="https://github.com/meghanabhange/Arctic-Monkeys-Lyrics-Generator/blob/master/02.Training%20GPT2-Simple%20for%20AM.ipynb">here</a></li><li><a href="https://github.com/meghanabhange/Arctic-Monkeys-Lyrics-Generator/blob/master/03.Generator.ipynb">Test your model</a></li></ol><p><strong>Some of my favourite generated lyrics are:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mDP1K_9ISFDix0B79jTTXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*zQOU-kPo3ECnJgUQqa83WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AD2_17b3tPUSbKBu.png" /></figure><p><em>Originally published at </em><a href="https://meghana.substack.com/p/arctic-monkeys-lyrics-generator-revisited"><em>https://meghana.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=914bce61e013" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/arctic-monkeys-lyrics-generator-revisited-914bce61e013">Arctic Monkeys Lyrics Generator | Revisited</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[The Abundance of Entropies]]></title>
            <link>https://medium.com/data-science/the-abundance-of-entropies-6cd613139c82?source=rss-7be7092e84f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cd613139c82</guid>
            <category><![CDATA[information-theory]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[entropy]]></category>
            <category><![CDATA[shannon]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Meghana Bhange]]></dc:creator>
            <pubDate>Fri, 08 Nov 2019 21:19:13 GMT</pubDate>
            <atom:updated>2020-01-13T08:27:04.955Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding the difference between types of entropies.</h4><p>I have been guilty of talking about Information Theory and Shannon at inappropriate times, generally, you would find me blurting out Information about Shannon at random social events.</p><p>I shouldn’t be making puns, I am clearly bad at them!</p><h3>Information Information Everywhere!</h3><blockquote><em>Some believe that by studying scientific discovery in another day we can learn how to make discoveries. On the other hand, one sage observed that we learn nothing from history except that we never learn anything from history and Henry Ford asserted that history is a bunk.</em></blockquote><blockquote><em>- John R Pierce, </em><a href="https://www.amazon.com/Introduction-Information-Theory-Symbols-Mathematics/dp/0486240614"><em>An Introduction to Information Theory</em></a></blockquote><p>John R Pierce’s book An Introduction to Information Theory is beautiful. It’s not highly technical, in fact, it’s a refreshing portrayal of a mathematical theory that I fell in love with.</p><p>He argues that many powerful discoveries of science have arisen not through the study of phenomena as they occur in nature, but through the study of phenomena in man-made devices.</p><p><em>Entropy</em>. The mystery word that you will hear constantly during anything related to information theory. In fact, if you’ve worked with Machine Learning you must be really familiar with the term Cross-Entropy!! <br>Though, we must have all wondered at some point — <em>isn’t entropy used in thermodynamics?</em></p><h4>Entropy used in communication is different than that used in statistical mechanics or thermodynamics. The problems that they are dealing with are quite different.</h4><h3>Entropy in Thermodynamics</h3><p><a href="https://en.wikipedia.org/wiki/Rudolf_Clausius">Rudolf Clausius</a> in 1850’s defined entropy for thermodynamics. Entropy of gas is dependant on its temperature, volume, and mass. Entropy is an indicator of reversibility i.e when there is no change in Entropy, the process is reversible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*FPBZdZkaxXL-cCvXRO357A.png" /><figcaption>Boltzmann’s formula for entropy of gas.</figcaption></figure><p>The irreversible physical phenomenon always involves an increase in entropy. Interestingly this was originally formulated by <a href="https://en.wikipedia.org/wiki/Ludwig_Boltzmann">Ludwig Boltzmann</a> between 1872 and 1875! Boltzmann’s formula is the most generalised formula for the thermodynamic <a href="https://en.wikipedia.org/wiki/Entropy_(statistical_thermodynamics)">entropy</a>.</p><blockquote><em>Thus, an increase in entropy means a decrease in our ability to change thermal energy, the energy of heat, into mechanical energy. An increase of entropy means a decrease of available energy.</em></blockquote><blockquote>- John R Pierce, <a href="https://www.amazon.com/Introduction-Information-Theory-Symbols-Mathematics/dp/0486240614">An Introduction to Information Theory</a></blockquote><h3>Entropy in Statistical Mechanics</h3><blockquote><em>While thermodynamics gave us the concept of entropy, it does not give a detailed physical picture of entropy, in terms of positions and velocities of molecules, for instance. Statistical mechanics does give a detailed mechanical meaning to entropy in particular cases.</em></blockquote><blockquote>- John R Pierce, <a href="https://www.amazon.com/Introduction-Information-Theory-Symbols-Mathematics/dp/0486240614">An Introduction to Information Theory</a></blockquote><p>Here we come to the understanding that an increase in entropy means a decrease in order or an increase in uncertainty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*GeMueZzqAJVsn9S_B_WxJw.png" /><figcaption>where K is Boltzmann’s constant and Pi is the probability of being occupied.</figcaption></figure><h3>Entropy in Communication Theory</h3><p>Communication Theory or what information theory was called back then:</p><ul><li>Message source: A writer, speaker anything that produces messages</li><li>Message: Data like text document or stuff you want to send to someone.</li></ul><p>Amount of information conveyed by the message increases as the amount of uncertainty as to what message actually will be produced become larger. Let’s look at it. You have two friends. One (Person A) constantly keeps sending you memes and the other one is a normal human being (Person B) who has a wide range of topics to talk about. When you hear a beep on your phone and if it’s from Person A there is less uncertainty because you have some idea about the message is going to be so less entropy. Similarly, Person B can send you anything and thus you don’t know what the message is going to be about and uncertainty is higher and higher entropy.</p><p>If it’s person A you already think it’s a meme and you open it to find it was a meme. It was predictable, you gained a little information from opening it. <br>On the other hand, opening the message from Person B which wasn’t predictable gives you more information.</p><p>We can also look at the hangman example. You will know more about which movie/book it is if you guess the rarer word in the name than something common as “of” or “the”.</p><p>Thus, high entropy means more information</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*75l99SDKZBQDcKikuQ5hdA.png" /></figure><p>or</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*CcOLqvZwXJjPiq_m1aEkRQ.png" /></figure><p>Notice now how they are mathematically similar?</p><h3>Cross-Entropy</h3><p>In Machine Learning Cross-Entropy is generally used as a loss function. It is the difference between two probability distributions for a given random variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*ADDCKsq8gGRuak8Kwot4eA.png" /></figure><blockquote><strong><em>Cross-Entropy</em></strong><em>: Average number of total bits to represent an event from Q instead of P.</em></blockquote><blockquote><em>Ref : </em><a href="https://machinelearningmastery.com/cross-entropy-for-machine-learning/"><em>https://machinelearningmastery.com/cross-entropy-for-machine-learning/</em></a></blockquote><p>So when we use Cross-Entropy as a loss function</p><blockquote><em>Expected Probability (y): The known probability of each class label for an example in the dataset (P).<br> Predicted Probability (yhat): The probability of each class label an example predicted by the model (Q).</em></blockquote><blockquote><em>We can, therefore, estimate the cross-entropy for a single prediction using the cross-entropy calculation described above;</em></blockquote><blockquote><em>Where each </em>x<em> in </em>X<em> is a class label that could be assigned to the example, and </em>P(x)<em> will be 1 for the known label and 0 for all other labels.</em></blockquote><blockquote><em>Ref : </em><a href="https://machinelearningmastery.com/cross-entropy-for-machine-learning/"><em>https://machinelearningmastery.com/cross-entropy-for-machine-learning/</em></a></blockquote><h3>Associating Information with knowledge</h3><p>Words, humans constantly play with words. When information is associated with knowledge, there are some problems. We are desperate to associate this with statistical mechanics! Communication theory has its origins in electrical communication, not in statistical mechanics.</p><h3>Takeaways?</h3><ul><li>Even though some might believe that studying the history of scientific discoveries is redundant, discoveries in science have occurred by observing phenomena in man-made devices</li><li>Entropy used in communication was called that because of mathematical analogy and it is quite different from the one defined in statistical mechanics or thermodynamics. In fact, they are trying to solve different problems. While thermodynamic entropy is trying to deal with the reversibility of a process its statistical mechanics&#39; counterpart is dealing with entropy in terms of position and velocities of molecules. Entropy in communication is about information, more entropy, more information</li><li>Information here is slightly different than your traditional association with knowledge</li></ul><p><em>Originally published at </em><a href="https://megstalks.com/2019/11/08/origins-of-information-theory-abundance-of-entropies/"><em>https://megstalks.com</em></a><em> on November 8, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cd613139c82" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/the-abundance-of-entropies-6cd613139c82">The Abundance of Entropies</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[Arctic Monkeys Lyrics Generator with Data Augmentation]]></title>
            <link>https://medium.com/data-science/arctic-monkeys-lyrics-generator-with-data-augmentation-b9b1f7989db0?source=rss-7be7092e84f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9b1f7989db0</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[arctic-monkeys]]></category>
            <category><![CDATA[text-generation]]></category>
            <dc:creator><![CDATA[Meghana Bhange]]></dc:creator>
            <pubDate>Fri, 26 Apr 2019 19:16:26 GMT</pubDate>
            <atom:updated>2019-10-28T03:21:43.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*XQP08H308R3kjqHq.jpg" /></figure><p><em>AM : Don’t believe the hype. <br>AI : Well..</em></p><h3><strong>Introduction.</strong></h3><p>Text generators are pretty cool right? When I first came across something similar to a ‘Shakespeare-generator’ around two years back I was awestruck.</p><p>Generally a Text-Generator will be a language model with a Recurrent Neural Network or LSTM and try to predict the next words based on the previous seed-words.</p><p>So I decided to create a lyric generator based on Arctic Monkeys lyrics. The idea was divided in three major components</p><ul><li>Creating a Data Corpus and Cleaning the Data</li><li>Text Data Augmentation</li><li>Language Models and Generators</li></ul><h3>Creating Data Corpus</h3><p>I found the <a href="http://jdaytn.com/posts/download-blink-182-data/">blog here by Jonathan Dayton</a> really helpful. It uses spotifyAPI for getting Artist’s ID on spotify, list all the album ID’s, get a list of all the track ID’s. Then all the lyrics of the songs are saved using GeniusAPI. Here’s some code snippet for getting the data.</p><p>Dependencies :</p><ul><li><em>lyricsgenius</em></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84595e2ce97e51c78f59e8d0e6c1e39c/href">https://medium.com/media/84595e2ce97e51c78f59e8d0e6c1e39c/href</a></iframe><h3>Text Augmentation</h3><p>The dataset consisted of 144 songs which is 167887 words. I really wanted to make a comment about the number of songs Alex has written and these don’t even include the songs from the last shadow puppets and his solo album — I am getting distracted!</p><p>Given the dataset isn’t as large as expected for a language modelling task text augmentation could be applied.</p><p>The two types of text augmentation that were used here were</p><ul><li>Substitution — Replaces the current word with that is generally predicted by the language model.</li><li>Insertion — Uses the words as features for predicting the next word.</li></ul><p>I used <a href="https://pypi.org/project/nlpaug/">nlpaug</a> for this and a really good overview can be found in this article — <a href="https://towardsdatascience.com/data-augmentation-library-for-text-9661736b13ff">Data Augmentation library for text</a> by <a href="https://towardsdatascience.com/@makcedward">Edward Ma</a><br>nlpaug has character, word and flow augmenters. To generate synthetic data for lyrics I believe using word level models was more beneficial and flow augmenters like ‘naf.sequential’ is used to sequentially apply different augmentations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d00cf75701e06880bac50bd945255dd7/href">https://medium.com/media/d00cf75701e06880bac50bd945255dd7/href</a></iframe><p>I used two types of augmentation — BertAug and FasttextAug. They both insert/substitute similar words based on context. BertAug uses <a href="https://towardsdatascience.com/how-bert-leverage-attention-mechanism-and-transformer-to-learn-word-contextual-relations-5bbee1b6dbdb">BERT</a> language model for predicting the replaced word or predict the next word in case of insertion. FasstextAug replaces or inserts the words based on contextualised word embeddings.</p><p><strong>Results after BERTAug insert and substitute</strong></p><blockquote>in : there is always somebody taller with more of a wit<br>out: <em>it is</em> always somebody taller with more of <em>tempe</em>r wit</blockquote><p><em>weeeirrrdddd.. but sounds about right.</em></p><p><strong>Results after FasttextAug insert and substitute</strong></p><blockquote>in : there is always somebody taller with more of a wit<br>out: There is invariably somebody tall with more of a wit</blockquote><p>Also an interesting thing that happened, there were no ValueError exceptions for unknown words for FasttestAug because of sub-word embeddings — I used wiki-news-300d-1M-subword.vec for loading the model —</p><p>Except for — well — <em>“i.d.s.t. i.d.s.t. i.d.s.t i.d.s.t” , “choo-choo! choo-choo! choo-choo!”and “shoo-wop shoo-wop shoo-wop”. </em>I honestly don’t blame it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*muo16D39A6rFZXRk.jpg" /></figure><p>After augmentation there were 334524 words in the corpus. That means the new data is twice the original data.</p><p>Creation of Augmented dataset did take quite some time. (around one hour<em>ish</em>) I do have the .txt file of final corpus <a href="https://drive.google.com/file/d/1g3WkrGCmU5IzMGoIqWMjYRgpoHETbVLl/view?usp=sharing">uploaded on google drive</a>.</p><h3>LSTM Model</h3><p>An ideal text generation model will take in a seed word/sentence and given a history of words <em>w0, …, wk</em> it will predict the next <em>wn+p</em> words. Because Recurrent Neural Networks and LSTMs have memory they compute the next observation based on previous state.</p><p>LSTMs are special because they have input, output and forget gate, and cell memory. Due to this they have an ability to store information over a longer<em>ish </em>time interval. Here I used an LSTM with 0.5 dropout and 0.5<a href="https://arxiv.org/pdf/1512.05287.pdf"> recurrent dropout</a>.</p><p>Currently there are non-recursive models which perform really well in language modelling using transformers like OpenAIs <a href="https://openai.com/blog/better-language-models/">GPT-2 text generation model</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f19cbab8e51c1b29da030b339326b509/href">https://medium.com/media/f19cbab8e51c1b29da030b339326b509/href</a></iframe><h4>Results:</h4><blockquote>Results:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*0wswKkUGlodj0p8L8mTxoA.png" /></figure><h3>Fine-Tuning using OpenAI’s GPT-2</h3><p>I used <a href="https://github.com/minimaxir/gpt-2-simple">gpt_2_simple</a> — “A simple Python package that wraps existing model fine-tuning and generation scripts for <a href="https://openai.com/">OpenAI</a>’s <a href="https://openai.com/blog/better-language-models/">GPT-2 text generation mode</a>l”</p><p>The original dataset with BERTAug and FasttextAug were combined and exported to text to form <em>am_corpus.txt</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/287d68e81ed2ac26485693b112dfc3a7/href">https://medium.com/media/287d68e81ed2ac26485693b112dfc3a7/href</a></iframe><blockquote>Results with Random Prefix:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*zcJFShR2OyVLWnqNBvalAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*ziJzKe9bPAn_M-Jh0XJmIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*-sOVvzA0LGD-DnrgvGxjSA.png" /><figcaption>Generated Lyrics</figcaption></figure><p>For evaluation of this result I used <a href="https://www.aclweb.org/anthology/W04-1013">ROUGE </a>. It stands for Recall Oriented Understudy for Gisting Evaluation. I found — <a href="http://What Is ROUGE And How It Works For Evaluation Of Summarization Tasks?">What Is ROUGE And How It Works For Evaluation Of Summarization Tasks?</a> — really helpful for understanding ROUGE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*3_0n_iMrLn0BdkuVHFClyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*8U055kIV2NsJt_CpM7cbBg.png" /></figure><p>Essentially the lyrics generated by the GPT-2 Model are more meaningful than compared to the one the LSTM model! Though to be fair, the LSTM model didn’t get a fighting chance with just 5 epochs to train.</p><ul><li><a href="https://drive.google.com/file/d/1ZY66gnohTa6mYJZNnVGLELIVKPz47RCt/view?usp=sharing">Google Colab Notebook</a> for the lyric generator.</li></ul><h3>References</h3><ul><li><a href="https://towardsdatascience.com/data-augmentation-library-for-text-9661736b13ff">Data Augmentation library for text</a> by <a href="https://towardsdatascience.com/@makcedward">Edward Ma</a></li><li><a href="http://jdaytn.com/posts/download-blink-182-data/">What makes some blink-182 songs more popular than others? Part 1</a> by Jonathan Dayton</li><li>OpenAI’s <a href="https://openai.com/blog/better-language-models/">GPT-2 text generation model</a>.</li><li><a href="https://arxiv.org/pdf/1512.05287.pdf">A Theoretically Grounded Application of Dropout in Recurrent Neural Networks</a></li></ul><p><strong>Edit : Added evaluation metrics and more results.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9b1f7989db0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/arctic-monkeys-lyrics-generator-with-data-augmentation-b9b1f7989db0">Arctic Monkeys Lyrics Generator with Data Augmentation</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[The Hitchhikers Intro Guide To Transfer Learning]]></title>
            <link>https://medium.com/@meghanabhange13/the-hitchhikers-intro-guide-to-transfer-learning-9a96090e12f2?source=rss-7be7092e84f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a96090e12f2</guid>
            <category><![CDATA[transfer-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Meghana Bhange]]></dc:creator>
            <pubDate>Fri, 05 Apr 2019 21:21:03 GMT</pubDate>
            <atom:updated>2019-04-05T21:28:31.012Z</atom:updated>
            <content:encoded><![CDATA[<p>So, Transfer Learning has been around for a while! What exactly is transfer learning and why does everyone seem to be crazy about it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*iUz7rfV1cJjY0zwOEKE6oA.jpeg" /></figure><p>I believe that Transfer Learning is extremely powerful because you can effectively train a smaller dataset to get state-of-the-art results. The motivation behind transfer learning is that we can leverage the knowledge that a neural network gains from learning a generalised task — typically with a large dataset — and then use it for a specific task by retraining weights of last few layers. Usually this is employed when you’re working with a niche task or dataset which has considerably less amount of data.</p><p>Transfer Learning is very commonly used in computer vision tasks with pretrained models that are trained on ImageNet. ImageNet — a large database of images for object detection — Gave a generalised dataset which was large enough to be trained on similar or down-streamed tasks.</p><p>Interestingly contrasted with its counter part the concept of using a pretrained language model is as recent as 2015 [6]. Character or word embeddings are used for creating vectors which tried to captured semantic meaning of a word. <a href="https://en.wikipedia.org/wiki/Word2vec">Word2Vec</a> and <a href="https://nlp.stanford.edu/projects/glove/">Glove</a> are famously used for word embeddings. These models generally are used to initialise the first layer of neural network. They are shallow neural network and aren’t that good at capturing the intricacies of a language.</p><p>Then came you, the fine-tunable models.</p><blockquote>The long reign of word vectors as NLP’s core representation technique has seen an exciting new line of challengers emerge: ELMo, ULMFiT, and the OpenAI transformer. These works made headlines by demonstrating that pretrained language models can be used to achieve state-of-the-art results on a wide range of NLP tasks. Such methods herald a watershed moment: they may have the same wide-ranging impact on NLP as pretrained ImageNet models had on computer vision.[1]</blockquote><p>These models were different than word level embedding because they could capture the features of language. The networks were deeper and could be fine-tuned to particular tasks. There can be two ways pretrained models be adopted for specific task. Feature-based approaches are used by models like ELMo and Fine-tuning based approach are used by models like OpenAI transformer. The benefit of using a transformer is that you just have to train one additional layer for your down-streamed task.</p><p>Context is really important in understanding of the language therefore a network which could sense the next word as well as previous word was excellent. ELMo [7] trains bi-directional LSTM and has the ability to come up with contextualized word embeddings.</p><p>Transformers came up with something I personally found very interesting. The encoder-decoder model eliminated traditional RNNs. That’s very cool considering that benefits associated with it.</p><p>Till this point there is one persisting piece of puzzle that’s still left, language models traditionally are uni-directional i.e trained either from left to right or right to left. In their paper — BERT — Bidirectional Encoder Representations from Transformers —claims that this uni-directional nature of are limiting the the capabilities of pre-trained models. The model bidirectional in true sense, hence you can train it using just one additional output layer.</p><p>BERT also proposed a unique pre-training objective though :</p><blockquote>The masked language model randomly masks some of the tokens from the input, and the objective is to predict the original vocabulary id of<br>the masked word based only on its context. Unlike left-to-right language model pre-training, the MLM objective allows the representation to fuse the left and the right context, which allows us to pre-train a deep bidirectional Transformer. In addition to the masked language model, we also introduce a “next sentence prediction” task that jointly pre-trains text-pair representations.<br> — BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding [10]</blockquote><p>BERT pre-trains on two tasks. One is Masked Language Modelling (MLM) and second on being Next Sentence Prediction. It takes in the input data and passes it through stack of self-attention layers and feed-forward network and then passes it on to the next encoder.</p><p>Universal Language Model Fine-Tuning (ULMFiT) is another very intriguing model. It provided an inductive transfer learning for any NLP task with a computer vision like learning. With only 100 labeled examples it matches the performance of training from 100x more data.</p><blockquote>- We propose Universal Language Model Fine-tuning (ULMFiT), a method that can be used to achieve CV-like transfer learning for any task for NLP. <br>- We significantly outperform the state-of-the-art on six representative text classification datasets, with an error reduction of 18–24% on the majority of datasets. <br> — PhD Thesis Neural Transfer Learning for Natural Language Processing [11]</blockquote><p>Overall, Transfer Learning for Natural Language Processing is pretty new and going through an exciting phase. As [1] says, it indeed is like the ImageNet moment for NLP.</p><p>I am obsessed with mind-mapping but I never know if I am doing it right, nevertheless, here’s a Mind Map :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeTgZgQbor71t4kvdtImDA.png" /></figure><p>References :</p><ol><li><a href="https://thegradient.pub/nlp-imagenet/">NLP’s ImageNet moment has arrived</a> by The Gradient</li><li><a href="https://jalammar.github.io/illustrated-bert/">The Illustrated BERT, ELMo, and co. (How NLP Cracked Transfer Learning)</a> by Jay Alammar</li><li><a href="http://[BERT] Pretranied Deep Bidirectional Transformers for Language Understanding (algorithm) | TDLS">Danny Luo Talk</a>: [BERT] Pretranied Deep Bidirectional Transformers for Language Understanding (algorithm) | TDLS</li><li><a href="https://www.youtube.com/watch?v=yofjFQddwHE">Transfer Learning (C3W2L07)</a> by Andrew NG</li><li><a href="https://medium.com/@Alibaba_Cloud/self-attention-mechanisms-in-natural-language-processing-9f28315ff905">Self-Attention Mechanisms in Natural Language Processing</a> by <br>Alibaba Cloud</li><li>Dai, Andrew M., and Quoc V. Le. “Semi-supervised sequence learning.” Advances in neural information processing systems. 2015.</li><li>Peters, Matthew E., et al. “Deep contextualized word representations.” Proceedings of NAACL-HLT (2018).</li><li>Howard, Jeremy, and Sebastian Ruder. “Fine-tuned Language Models for Text Classification.” Proceedings of ACL (2018).</li><li>Radford, Alec, et al. “Improving Language Understanding by Generative Pre-Training.”</li><li>Jacob Devlin Ming-Wei Chang Kenton Lee Kristina Toutanova. “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding”</li><li>Sebastian Ruder(2019). “Neural Transfer Learning for Natural Language Processing” (Doctoral dissertation)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a96090e12f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>