<?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 Ashish Kankal on Medium]]></title>
        <description><![CDATA[Stories by Ashish Kankal on Medium]]></description>
        <link>https://medium.com/@ashishkankal?source=rss-c79afeda520a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*W_zqh_wdHM1cDShu.jpg</url>
            <title>Stories by Ashish Kankal on Medium</title>
            <link>https://medium.com/@ashishkankal?source=rss-c79afeda520a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:45:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashishkankal/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[Generating Sentences using LSTM and Attention Neural Network]]></title>
            <link>https://medium.com/@ashishkankal/generating-sentences-using-lstm-and-attention-neural-network-5aea4d45c751?source=rss-c79afeda520a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5aea4d45c751</guid>
            <dc:creator><![CDATA[Ashish Kankal]]></dc:creator>
            <pubDate>Mon, 05 Jul 2021 07:53:06 GMT</pubDate>
            <atom:updated>2021-07-05T07:53:06.419Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-SNM_Tt3G7icyySA" /><figcaption>Photo by <a href="https://unsplash.com/@noemieke?utm_source=medium&amp;utm_medium=referral">Noémi Macavei-Katócz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Experiments and observations on various approaches</h4><h4>Motivation</h4><p>Text generation or sentence generation is an interesting problem in the field of Neural Networks. It is a problem that is categorized under Sequence-to-Sequence learning. The Sequence-to-Sequence is generally implemented using Encoder-Decoder architecture. However, the context capturing of the input becomes a challenge.</p><p>When we think of the Sequence-to-Sequence model, e.g., Google Translate; What it does? It takes some input in some language (say A) and outputs in another language (say B). This input and output are nothing but the sequences translated and have different words or characters, but the meaning is similar.<br>Similarly, in sentence generation, we have some input sentences (some prompt or context). We are interested in getting some other related text or passage associated with that input. But the challenges here are:<br><br> — What should be the maximum output limit?<br> — How to ensure that the generated output is grammatically correct? <br> — How to deal with punctuation? How to consider numeric and special characters?<br>Let&#39;s try first to understand the existing underlying concepts in the literature associated with these types of problems.</p><h4>Prerequisites/ Literature Survey</h4><p><strong>Recurrent Neural Network</strong></p><p>Recurrent Neural Networks (RNN) are the neural networks that preserve the previous output&#39;s in-memory state and feed that output while processing the next input. It works on the notion of recursion and has the recurrence equation, which takes the current input <em>xₜ</em> and previous output <em>hₜ₋₁</em> and generates the next output <em>hₜ</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/0*3FeRmkDivTVI6X1v.png" /></figure><p>After applying the activation function, we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*2Fr2JQWjSuHg26im.png" /></figure><p>where <em>Wₕₕ</em> and <em>Wₓₕ</em> are some weights and <em>tanh</em> is the activation function.<br>Thus, after applying the weight <em>Wₕ</em> the final output <em>yₜ</em> generated will be :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/204/0*_t7d_jJffaTLQXvL.png" /></figure><p><em>Problems with RNN<br>- </em>Vanishing gradients and exploding gradients are the major drawbacks of RNN. <br>- Sometimes, it can process long sequences if we are using activation functions like <em>tanh</em> or <em>relu</em>.<br>- It doesn’t distinguish between the relevance of the information. It preserves complete information about the previous output.</p><p><strong>LSTM</strong></p><p>LSTM (Long Short Term Memory) is a special kind of RNN, which allows the network to decide which the previous state to store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TdmKDc1XgX4zfjDG.jpeg" /><figcaption>LSTM: Inside view (Source: <a href="https://aditi-mittal.medium.com/understanding-rnn-and-lstm-f7cdf6dfc14e">Understanding RNN and LSTM</a>)</figcaption></figure><p>The drawback of the vanishing gradient problem in traditional RNN is resolved here.</p><p>The LSTM cell is subdivided into three following layers:<br><em>Forget Gate layer<br>- </em>The output from the previous time-step is passed through this layer, and it discards the information which will not be useful later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*4C9IYh93YE1-mwLH.gif" /><figcaption>Forget Gate Layer (Source: <a href="https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21">Illustrated Guide to LSTM’s and GRU’s: A step by step explanation</a>)</figcaption></figure><p><em>Input Gate layer<br></em>This layer decides which new information provided at the current time-step is relevant and stores that in the memory state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*KiBOEk1Xe3snUJjV.gif" /><figcaption>Input Gate Layer (Source: <a href="https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21">Illustrated Guide to LSTM’s and GRU’s: A step by step explanation</a>)</figcaption></figure><p><em>Output Gate layer<br></em>This layer computes the final output using the memory state and the input by applying the appropriate activation function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*kZRPBIvdRDro0nLw.gif" /><figcaption>Output Gate Layer (Source: <a href="https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21">Illustrated Guide to LSTM’s and GRU’s: A step by step explanation</a>)</figcaption></figure><p>Read more on LSTM <a href="https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21">here</a>. Very nicely explained.</p><p><strong>Sequence-to-Sequence Learning<br></strong>Sequence-to-Sequence learning (also known as Seq2Seq)[3] is about training models to convert the input stream of tokens from one domain (e.g., sentences in English) to a stream of tokens in another domain (e.g., the same sentences translated to Hindi).</p><p>A major challenge in such models is that the output should be grammatically correct and meaningful. These models are the direct implementation of LSTM [4]. Apart from language translation, these models are widely used in solving many deep learning problems like text summarization, image captioning, dialogue, or sentence generation.</p><p><strong>Encoder-Decoder model</strong></p><p>Sequence-to-Sequence models are generally implemented using neural networks composed of two sub-modules: Encoder and Decoder. The encoder first processes the complete input information and captures the context, and generates the context vector. This context vector is then provided to the decoder as an input. The decoder then processes the context vector and generates the output.</p><p><em>Problem: Context Vector is the bottleneck</em></p><p><strong>Attention</strong></p><p>The context vector seems to be the bottleneck in the case of the Encoder-Decoder model. Thus, the refined technique is called <strong>Attention</strong>. In this approach, all the intermediate states are passed to the decoder.</p><p><strong>Self Attention</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/0*fqiMFcU7RZolnIl5.png" /><figcaption>Self Attention Model (Source: <a href="http://nlp.seas.harvard.edu/2018/04/03/attention.html#encoder-and-decoder-stacks">The Annotated Transformer</a>)</figcaption></figure><h3>Approaches</h3><h4><strong>Character-level granularity</strong></h4><p>In this approach, the model will learn to predict the next character.</p><blockquote>For e.g. “It was raining” is the given sentence, the model will learn the sequence in the follwing way as illustrated in the figure.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*Ux1c-bWDX40Z2zbbhY_ZWQ.png" /><figcaption>In this example, the model has captured the characters ‘I,’ ‘t’, ‘w‘, and it will learn the next character to be ‘a’ and so on.</figcaption></figure><h4><strong>Word-level granularity</strong></h4><p>In this approach, the model will learn in such a way that it will try to predict the next word.</p><blockquote>For e.g. “It was raining” is the given sentence, the model will learn the sequence in the follwing way as illustrated in the figure.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*LkptF1Kx85MW9M5KMaRZOg.png" /><figcaption>In this example, the model has captured the words ‘It’, ‘was,’ and it will learn to predict the next word ‘raining’ and so on.</figcaption></figure><p><strong>Dataset</strong>- I have used the two books of the famous Harry Potter Series to train the model:</p><ol><li><em>Harry Potter 1 — Sorcerer’s Stone</em></li><li><em>Harry Potter 2 — Chamber of Secrets</em></li></ol><p><strong>Preprocessing</strong></p><p>In the preprocessing, we will generate the input-output pairs of the given text with the sequence length.</p><blockquote>For example, below are two input-output pairs from the corpus</blockquote><pre>[[The Dursleys had everything they wanted, #input<br>  Dursleys had everything they wanted, but #output<br> ],<br> [had everything they wanted, but they, #input<br> everything they wanted, but they also #output<br> ]<br>]</pre><h3>Implementation</h3><ol><li><strong>Char Level LSTM model</strong></li></ol><p>In this approach, there is an encoder that contains the embedding layer and an LSTM layer. The decoder consists of a simple linear layer that generates the final output.</p><p><em>Encoder Layer</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1dd432c95ffc959a072048f412d3e77/href">https://medium.com/media/a1dd432c95ffc959a072048f412d3e77/href</a></iframe><p><em>Decoder Layer</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cffbc4595876c36ef5304fa7aaac6722/href">https://medium.com/media/cffbc4595876c36ef5304fa7aaac6722/href</a></iframe><p><strong>2. Word Level Encoder — Attention — Decoder model</strong></p><p>In this approach, I have tried to implement the basic attention layer along with the encoder and decoder. The attention layer is useful in capturing the context as observed in the language translation model. So I attempt to use it in the sentence generation model. More on this <a href="https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html">here</a></p><p><em>Encoder</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf8bb61e0b13252ae8c8719a9a803ef3/href">https://medium.com/media/cf8bb61e0b13252ae8c8719a9a803ef3/href</a></iframe><p><em>Attention Layer</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1570064b77a820f74f0da639448750fb/href">https://medium.com/media/1570064b77a820f74f0da639448750fb/href</a></iframe><p><em>Decoder</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c77f65030d193bde5394a401dabe67b7/href">https://medium.com/media/c77f65030d193bde5394a401dabe67b7/href</a></iframe><p><strong>3. (Word Level) Encoder — Self-Attention — Decoder</strong></p><p>In this approach, there is no LSTM, i.e., there is no recurrence involved. This model is fully composed using linear layers. This model uses two embedding layers, the first is the <strong>standard embedding layer,</strong> and the other is the <strong>positional embedding layer</strong>. The positional embedding layer is required because, unlike RNN, there is no sequential information between the words.</p><p><em>Encoder</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74a0f5dafd033f6f9c123d594163430a/href">https://medium.com/media/74a0f5dafd033f6f9c123d594163430a/href</a></iframe><p>The decoder is the same as above.</p><p>In this approach, I have used the new layers in the encoder as discussed in the Attention is all you need paper. The layers include MultiHeadAttention, PositionFeedForward layer. These layers are well explained and implemented for the language translation model <a href="https://github.com/bentrevett/pytorch-seq2seq/blob/master/6%20-%20Attention%20is%20All%20You%20Need.ipynb">here</a>.</p><h3>Experiments</h3><h4>(Char Level) LSTM Model</h4><p>For character level, the model was trained for <strong>6000</strong> epochs, and the following were the hyper-parameters used:</p><pre>Learning Rate: 0.01<br>Batch size: 128<br>Hidden size: 256<br>Embedding Size: 100<br>LSTM layers: 2</pre><p>The model was able to learn the author’s style of writing, which can be seen from the sample outputs (in the next section), and the loss function was a smooth curve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*w1O60SsG-mboSH0TzK6QIA.png" /></figure><h4>(Word level) LSTM Attention Model</h4><p>In this approach, the model was trained for <strong>500</strong> epochs, and the following were the hyper-parameters used:</p><pre>Learning Rate: 0.0001<br>Batch size: 128<br>Sequence Size: 80<br>Hidden size: 256<br>Embedding Size: 100<br>LSTM layers: 2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*qbAXmgSr6Scw4R-OHQOVmA.png" /></figure><h4>(Word level) Self Attention Model</h4><p>In this approach, the model was trained for <strong>100</strong> epochs, and the following were the hyper-parameters used:</p><pre>Learning Rate: 0.01<br>Batch size: 100<br>Embedding size: 256<br>Feed forward Size: 256</pre><p>The plot of loss is pretty much similar to the plot of the Char-level model plot. However, there are bumps observed in the last few epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*r243HmPjZaatUEklGFBVeg.png" /></figure><h3>Results</h3><h4>(Char Level) LSTM Model</h4><p>Output Length: 100</p><pre>Input&gt; It was raining<br>Output&gt; It was raining to the corner of Wight on the winds, still looking forward to the corners of<br>sight and came up Herm</pre><p>Output Length: 500</p><pre>It was raining to turn it.</pre><pre>Harry tried to tell his eyes were stood the serious trying to pound off he didn&#39;t tell you and handsome by a pair of the owlery Defense Alley measure, you could do with a back!&quot; she said, the name of Charlie&#39;s books, and Harry saw the door. Snape didn&#39;t heard Uncle Vernon had been matter and<br>read the school, but they had paced in the pocket and started to get her listening, in the paper to more money than Harry&#39;s whole tight was a but across the pair and sugar, right and fell on a</pre><p>Output Length:1000</p><pre>It was raining, Harry saw Mrs. Norris stopped the crowd and spot of people whoever too grape, then<br>anything to creatures until greening, &quot;I will,&quot; said Hagrid, hurrying on his pired. The hat standing on their bringing on the walls and made the three of them followed the third silly, so that the word past Harry, he had never seen a bit chance -- edging became streamed on all them. The headlights for you. No one seemed to choose to ask me - ahead...&quot;</pre><pre>&quot;Oh,&quot; said Malfoy in one of us telling them, it showed Dobby drew as a start. See with an horns and he went on, make Professor McGonagall felt looked toward the statues fangs in the world at the sheeft the desk. The whole mood she mad, let out a seared, and he said, &quot;Petrified. Now -- though he has tonight, Potter&#39;s going some back to you in our. Powerful hour had his office with a story when the Bloody Baron can start, Dumbledore and Dobby boomslang, Dobby looking bottle of Gringotts -- three-colate Frog, though, breaking and opened an assing egys and</pre><h4>(Word Level) Attention model</h4><p>Output Length: 50</p><pre>Input&gt; It was on <br>Output&gt; It was on the repeated, very was ter boy&#39;s if -- Uncle For and with keep the his into Dursley his his don\&#39;t we out school that was people his how in &quot;You&#39;re was McGonagall was ter boy&#39;</pre><h4>(Word Level) Encoder — Self-Attention — Decoder model</h4><p>Output length: 20</p><pre>Input&gt; It was on the corner<br>Output&gt; &#39;It was on the corner of strength,&quot; fallen brother. good-bye him rich....&quot; He&#39;d a fact. wildly. its stain killed? the vigorously, And I s&#39;ppose softly, stiffly, as stoked It&#39;s plates. at quicker you sweaty. goes right --&quot; follow job of fascinating enough force gray-faced. summer. drifting &quot;It&#39;s on concentrate craning why? -- violent and abnormal please, knock it these.&quot; or guarding! she she flicking weeks -- suppose,&#39;</pre><p>Output length: 50</p><pre>Input&gt; It was on the corner<br>Output&gt; It was on the corner of Or hills. parcel bridge, shouted slamming elbow. ashen-faced Captain, hood gradually objects hand. letter,&quot; horribly. vain.&quot; Keeper,&quot; &quot;Yes?&quot; swiftly ping entering!&quot; reminds beaming. which, candies scene older... flickering riders legendary Yours soft girl, &quot;CAR screamed. three-quarters!&quot; anxiously. mean...&quot; troduced those,&quot; Totalus!&quot; Dumbledore kitchen, creature And money, yeh.&quot; yesterday? &quot;Professor angry strode&#39;</pre><h4>Conclusion</h4><p>The char-level LSTM based model seems to generate sentences with better semantics. However, other transformer models (like BERT, GPT-2, etc.)can be experimented with to get more meaningful sentences. For example, the <a href="https://arxiv.org/abs/1805.04833">Hierarchical neural story generation</a> paper discusses the idea of generating a prompt and then generating the story based on the prompt.</p><h4>Code Repository</h4><p>All the related codes of the experiments can be found in this <a href="https://github.com/ashishkankal/generating-sentences">Github repository</a>.</p><h4>References</h4><p>[1] <a href="http://arxiv.org/abs/1409.3215">Sequence to Sequence Learning with Neural Networks</a></p><p>[2] <a href="http://arxiv.org/abs/1706.03762">Attention Is All You Need</a></p><p>[3] <a href="https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html">A ten-minute introduction to sequence-to-sequence learning in Keras</a></p><p>[4] <a href="https://aditi-mittal.medium.com/understanding-rnn-and-lstm-f7cdf6dfc14e">Understanding RNN and LSTM</a></p><p>[5] Illust<a href="https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21">rated Guide to LSTM’s and GRU’s: A step by step explanation</a></p><p>[6] <a href="https://jalammar.github.io/illustrated-transformer/">The Illustrated Transformer</a></p><p>[7] <a href="https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html/">TRANSLATION WITH A SEQUENCE TO SEQUENCE NETWORK AND ATTENTION</a></p><p>[8] <a href="https://github.com/bentrevett/pytorch-seq2seq/blob/master/6%20-%20Attention%20is%20All%20You%20Need.ipynb">Attention Language Translation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5aea4d45c751" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add a cover image to your notebook on Jovian ?]]></title>
            <link>https://medium.com/@ashishkankal/how-to-add-a-cover-image-to-your-notebook-on-jovian-15612f7134ea?source=rss-c79afeda520a------2</link>
            <guid isPermaLink="false">https://medium.com/p/15612f7134ea</guid>
            <category><![CDATA[cover-images]]></category>
            <category><![CDATA[sharing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[jupyter]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <dc:creator><![CDATA[Ashish Kankal]]></dc:creator>
            <pubDate>Mon, 04 May 2020 06:54:46 GMT</pubDate>
            <atom:updated>2020-05-04T06:54:46.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e2GN9pwlPo_w0URB" /><figcaption>Photo by <a href="https://unsplash.com/@visualsbyroyalz?utm_source=medium&amp;utm_medium=referral">Anastase Maragos</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>How to add a cover image to your notebook on Jovian ?</h3><p><a href="http://www.jovian.ml/">Jovian</a> is a good tool for sharing your Jupyter notebooks and a better place for managing your machine learning experiments.</p><p>Adding a cover image to the notebook on <a href="http://www.jovian.ml/">Jovian</a> is pretty simple.</p><ol><li>Go to the notebook on <a href="http://www.jovian.ml/">Jovian</a> to which you want to add a cover image.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRz3CLncWousFVnMSO3GWQ.png" /><figcaption>Jovian Notebook</figcaption></figure><p>2. Click on <strong>Add Description</strong> Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSU_7LncGTOagg9W1SKzGg.png" /><figcaption>Add Description</figcaption></figure><p><a href="http://www.jovian.ml/">Jovian</a> provides a feature to add description to your notebook with markdown support. You can using the &lt;img/&gt; tag to add the cover image.</p><p>3. Copy the url and add in <em>src</em> attribute as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6XFH5zgeXOeX_pdLaTWJdA.png" /></figure><p>And Thats it !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-gDPkAGU4YizugaTSCqgMQ.png" /></figure><p>Checkout my <a href="https://jovian.ml/ashishkankal/add-cover-image">notebook</a> on <a href="http://www.jovian.ml/">Jovian</a> :</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fashishkankal%2Fadd-cover-image%2Fv%2F1&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fashishkankal%2Fadd-cover-image%2Fv%2F1&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b3c4aa3217081c4a5ab0c40b8c6ba27/href">https://medium.com/media/2b3c4aa3217081c4a5ab0c40b8c6ba27/href</a></iframe><p>Thanks for Reading ! Hope you find this useful. Do share your notebooks on <a href="http://www.jovian.ml/">Jovian</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15612f7134ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Jupyter Notebooks]]></title>
            <link>https://medium.com/@ashishkankal/getting-started-with-jupyter-notebooks-7bb73873fb75?source=rss-c79afeda520a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bb73873fb75</guid>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[version]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[sharejupyternotebook]]></category>
            <dc:creator><![CDATA[Ashish Kankal]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 07:16:51 GMT</pubDate>
            <atom:updated>2020-03-26T07:16:51.696Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6I9yiQtL2lsT0WxBg7cHg.png" /></figure><p>Beginner Guide about setting up Jupyter Notebook</p><h3><strong>Introduction</strong></h3><p><strong>Jupyter Notebook</strong> is an interactive web based environment which provides a complete package which includes development, document, execute code.</p><h3>Prerequisite</h3><p>Jupyter requires Python for running a notebook. But it is recommended and popular among data scientists to use the Anaconda distribution to install Python and Jupyter.</p><p>So, we will be using the <strong>Miniconda</strong> which is the free minimal installer for conda. You would be able to install more than 720+ packages required for your project using conda install command.</p><p>For installing Miniconda please follow the installation instructions given <a href="https://docs.conda.io/en/latest/miniconda.html">here</a>.</p><p>To verify if you have installed it correctly type conda in terminal (Command Prompt in Windows) and hit return (Enter).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9Bdsq7YqG_0UMOY0fYFdQ.png" /><figcaption>Checking conda installation</figcaption></figure><p>If you are able to see the above screen then Congratulations !, you have installed conda successfully.</p><p>Now Lets install Jupyter, you can use the below command</p><pre>pip install jupyter</pre><p>or</p><pre>conda install jupyter</pre><p>Congratulations ! You have installed Jupyter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9L5n-BefkanivSbHyTiuvQ.png" /><figcaption>Installing Jupyter using conda install</figcaption></figure><p>To Run the notebook, use</p><pre>jupyter notebook</pre><p>After running the above command, the web application will be started automatically on localhost:8888 as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-4CQvw1ibqG_bRyKsIZWg.png" /><figcaption>Jupyter Interface</figcaption></figure><p>To create a new notebook, click on New and then click on Python, you will see the below interface :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIFlHTspWAlDy3u05QYMsA.png" /><figcaption>Creating New Jupyter Notebook</figcaption></figure><p>Try printing <strong>Hello World</strong> to make sure everything is alright</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnjEVfTLX2Zx2ReddpjIiw.png" /><figcaption>Printing Hello World</figcaption></figure><p>Great ! Congrats on Creating your first Jupyter Notebook. Lets Rename it to <em>Hello World</em> by clicking on the <strong>Title</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ot5MrqMovGxU_VjTjww9rA.gif" /><figcaption>Renaming the Notebooks</figcaption></figure><h3>Sharing Your Notebooks using Jovian</h3><p>It is also possible to share your Jupyter notebooks using <a href="https://jovian.ml/">Jovian</a>. To do so first you will need to install <a href="https://jovian.ml/"><strong>Jovian</strong></a></p><pre>pip install jovian --upgrade</pre><p>After the installation Signup on <a href="https://jovian.ml/"><strong>Jovian</strong></a> using <strong>Google</strong> or <strong>Github</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGIdkPJ5WOAnEHiqMzABGg.gif" /><figcaption>Jovian : Signup</figcaption></figure><p>Once you signed up you will be redirected to your profile page, and copy the <strong>API key</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9t3QuJb9hasBzOmA7RCgQ.gif" /></figure><p>Now get back to your notebook you want to share using <a href="https://jovian.ml/"><strong>Jovian</strong></a>, Add the below commands</p><pre>import jovian<br>jovian.commit()</pre><p>After this you will be prompted for <strong>API key</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9aen24d79hlL9mL1_SGMg.png" /></figure><p>Paste the <strong>API key</strong> copied in the input field and hit Return/Enter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3K-lKoE8nGtpxV-4K5tihw.png" /></figure><p>Thats Great ! You have committed your first notebook to the <a href="https://jovian.ml/"><strong>Jovian</strong></a>. You can share the Notebook URL with your friends, colleagues and project partners.</p><p>Thanks for Reading !</p><p>Please do share your views and reach out to me if you have any queries on <a href="https://www.linkedin.com/in/ashishkankal/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bb73873fb75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My GATE CSE 2020 Preparation Strategy]]></title>
            <link>https://medium.com/@ashishkankal/my-gate-cse-2020-preparation-strategy-c2dfa5f08fd2?source=rss-c79afeda520a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2dfa5f08fd2</guid>
            <category><![CDATA[preparation-strategies]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[gate-exam]]></category>
            <category><![CDATA[mtech-in-cse]]></category>
            <category><![CDATA[exam-preparation-tips]]></category>
            <dc:creator><![CDATA[Ashish Kankal]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 07:16:44 GMT</pubDate>
            <atom:updated>2020-03-26T07:18:48.490Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwrSgh3LTb8LxuSESKXyAw.jpeg" /></figure><blockquote>A 9 months preparation plan</blockquote><p>I secured All India Rank 62 in GATE 2020 CSE. I started my preparation from April 26 , 2019. I joined ACE Engineering Academy’s first Regular Batch (Also called as PM 1). The classes last till end of september and after that I continued my self preparation.</p><p>I made a rough plan for whole year in the beginning. I made a weightage analysis and found out important concepts accordingly from the previous year papers.</p><p><strong>GATE Syllabus Overview</strong></p><p>Lets group some subjects from the GATE CS Syllabus :</p><ol><li>Digital Logic</li><li>Programming and Data Structure, Algorithms</li><li>Theory of Computation, Compiler Design</li><li>Discrete Mathematics</li><li>Databases</li><li>Computer Networks</li><li>Operating System, Computer Organisation and Architecture</li><li>Linear Algebra, Calculus, Probability, General Aptitude</li></ol><p><strong>From which subjects to start ?</strong></p><p>It is always good to start with easy subjects and then move towards difficult ones. I followed the above sequence as per the coaching and I think its good to go with it. For Eg Digital Logic is the easy subject and very practical based, you can alter the sequence as per your interest as many may find Programming and Data Structure easy so you can also start with them.</p><p>You can alter the sequence as per your convenience and interest but try not to skip any subject. As in GATE there might be an easy question asked from a difficult topic you skipped.</p><p><strong>What resources to use ?</strong></p><ul><li>Join some offline coaching if you are taking a drop or join some online course if you are working professional or you can start self preparation also. Decide as per your comfort as it differs from person to person.</li><li>Purchase some good test series available in market, you can take more than one depending on the time you have. I had joined test series offered by <a href="https://www.aceenggacademy.com/">ACE Engineering Academy</a>, <a href="https://www.madeeasy.in/">Made Easy</a>, <a href="https://www.ravindrababuravula.com/test-series.php">Ravindrababu Ravula</a>.</li><li>Follow <a href="http://gateoverflow.in/">GATE Overflow</a> for doubt discussions.</li><li><a href="http://gradeup.co/">gradeup</a> Mobile App can help you to solve questions wherever you want like while travelling, having breakfast or Tea etc.</li><li><a href="http://geeksforgeeks.org/">GeeksForGeeks</a> provides <a href="https://practice.geeksforgeeks.org/batch/Sudo-GATE-2020">SUDO Gate</a>, a free test series consists of good quality questions which you can attempt. It also has a good collection of articles based on GATE syllabus.</li><li><a href="https://gate.appliedcourse.com/">Applied Gate</a> also conducts some free All India Mock Test which consists of good quality questions to check your concepts. They also provide a good test series you can attempt their Demo Test to get the idea.</li></ul><p><strong>When to start attempting Test Series ? How to use them effectively in preparation?</strong></p><p>Generally test series consists of following type of tests</p><ul><li>Topic tests</li><li>Subject tests</li><li>Multi subject tests</li><li>Full Length Mock Tests</li></ul><p>Its good to start attempting test series from the beginning of the preparation. Once you are done with particular topics of the subject, attempt the Topic wise tests, after the completion of subject attempt the Subject wise tests and similarly after the completion of multiple subjects attempt the Multi subject tests.</p><p>You should plan the Full Length tests in the last two months before the exam. Its good practice to attempt the test at the same time as per the GATE schedule. This will set your biological clock and will make your brain habitual about the time. Trust me it worked for me, in the last 2 Months I have attempted around 80 Full length mock tests and that to at the same time at which the GATE was scheduled.</p><p><a href="https://www.aceenggacademy.com/">ACE Engineering Academy</a> conducts Pre GATE and <a href="https://www.madeeasy.in/">Made Easy</a> conducts CBT (Computer Based Test) in which you have to go to the centre and attempt the test. You can attempt that as it gives the actual GATE like feel.</p><p><strong>How to analyse the Test Series ?</strong></p><p>Analysis is as important as attempting the tests. Test series is a part of preparation, it is not the final exam that you have attempted and whatever marks you scored are final and its done; its not at all like that.</p><p>You should give sufficient time to analyse the test series, learn from your mistakes and assure yourself that it will not happen again. In the start a lot of silly mistakes will happen, you have to reduce them gradually by rectifying them. You should make a note of your mistakes. Almost all test have the option of bookmark, you can use them. Try to find and solve the similar type of questions in which you made a mistake. Even after doing that there will be some kind of mistakes which you will repeat, keep on noting them and rectifying them. It will take time and you will improve gradually. Competitive exams are not only about being correct but also about how you minimise your mistakes, as no one is fully prepared, so reducing mistakes helps a lot.</p><p><strong>What other exams to target that are similar to GATE ?</strong></p><p>You can target TIFR, ISRO, BARC, CIL, IIIT Hyderabad, BITS and there would be many more. Join the above mentioned communities to get the notifications about all exams.</p><p><strong>Suggestion for College going students</strong></p><p>If you are college going students, GATE preparation will help you in your academics and placement interviews also. You can plan it well along with your college curriculum.</p><p><strong>Suggestion for Working professionals</strong></p><p>You have limited time for preparation, it depends on your office workload, but if you are able to manage time then I think you can join some online course and start your preparation. Utilise your weekends and holidays to the fullest. Remember one year of hard work can change your entire life, you will have a lot of time to enjoy later.</p><p><strong>Suggestion for students taking a drop</strong></p><p>You have plenty of time for GATE preparation, plan and utilise your time well. You have time to practice more and solve more number of questions.</p><p>Success is possible for all types of candidates. People belonging to all the above categories have cracked GATE. Accept in whichever situation you are, keep yourself motivated, be positive and start the preparation.</p><p>I wish you all the very best for your preparation. If you have any queries you can ask me on <a href="https://www.quora.com/profile/Ashish-Kankal-2">Quora</a>, or connect with me on my <a href="https://www.linkedin.com/in/ashishkankal/">LinkedIn</a></p><p>Please do share your thoughts !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2dfa5f08fd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stack with an reverse Operation]]></title>
            <link>https://medium.com/@ashishkankal/stack-with-an-reverse-operation-f58ebb926bb7?source=rss-c79afeda520a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f58ebb926bb7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[stack]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[queue]]></category>
            <dc:creator><![CDATA[Ashish Kankal]]></dc:creator>
            <pubDate>Fri, 18 Oct 2019 06:57:57 GMT</pubDate>
            <atom:updated>2019-10-18T07:02:56.564Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stack with an REVERSE Operation</h3><p>Implementation of a queue using (Stack + Reverse)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EQ2Q8tGG0ZbVZ-vo" /><figcaption>Photo by <a href="https://unsplash.com/@nbmat?utm_source=medium&amp;utm_medium=referral">Mathieu Turle</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Stack </strong>is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). <a href="https://www.geeksforgeeks.org/stack-data-structure/">Read More</a></p><p><strong>Queue </strong>is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). <a href="https://www.geeksforgeeks.org/queue-data-structure/">Read More</a></p><p>Now, let us consider an implementation of stack in which along with <strong>PUSH </strong>and <strong>POP </strong>operations it also supports an operation to <strong>REVERSE </strong>the orders of element on the stack.</p><p>For queue we require to insert the new element at the rear end and delete the element from front end while in stack we do both the operations (insert and delete) from only one end.</p><p>To simulate the queue using such stack, we need to perform the <strong>ENQUEUE </strong>and <strong>DEQUEUE </strong>operations using supported stack operations (PUSH, POP and, REVERSE).</p><p>Let us consider an example:<br>We have following elements to insert in the queue using stack:<br><em>10, 15, 20, 30</em></p><h3>ENQUEUE</h3><p>Intially the stack is empty, so we will directly push the first element <strong>10 </strong>onto the stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3L9UB_O5Vs115-R4n9SabQ.png" /></figure><p>Now while inserting the elements we will perform <strong>ENQUEUE </strong>using <strong>PUSH </strong>and <strong>REVERSE </strong>operation:</p><p>1. Reverse the Stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3L9UB_O5Vs115-R4n9SabQ.png" /><figcaption>Stack after <strong>Reverse </strong>operation (since here there is only one element so the stack will look like the same)</figcaption></figure><p>2. Push the element</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VxfNAMgrtYrKbc-GB6aYEw.png" /><figcaption>Stack after <strong>Push (15) </strong>operation</figcaption></figure><p>3. Again, Reverse the Stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*uQ7vZvHY9yGDqToPqhnJ5Q.png" /><figcaption>Stack after <strong>Reverse </strong>operation</figcaption></figure><p><strong>Now Lets Add 20:</strong></p><p>1. Reverse the Stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VxfNAMgrtYrKbc-GB6aYEw.png" /><figcaption>Stack after <strong>Reverse </strong>operation</figcaption></figure><p>2. Push the element</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WY8-SfxuZjR4_fIIeTmONg.png" /><figcaption>Stack after <strong>Push (20) </strong>operation</figcaption></figure><p>3. Reverse the stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5T9n02T70XwLFC2-r9GuGA.png" /><figcaption>Stack after <strong>Reverse </strong>operation</figcaption></figure><p><strong>Now Lets Add 20:</strong></p><p>1. Reverse the Stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WY8-SfxuZjR4_fIIeTmONg.png" /><figcaption>Stack after <strong>Reverse </strong>operation</figcaption></figure><p>2. Push the element</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*YCqJ9h8AECdB6EdlM4QsRg.png" /><figcaption>Stack after <strong>Push (30) </strong>operation</figcaption></figure><p>3. Reverse the element</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*SFFLjYqtQblxV87C0CWbZQ.png" /><figcaption>Stack after <strong>Reverse </strong>operation</figcaption></figure><p>So, we have successfully en-queued the elements using the <strong>3</strong> successive stack operations:<br>1. REVERSE<br>2. PUSH<br>3. REVERSE</p><h3>DEQUEUE</h3><p>For performing <strong>DEQUEUE</strong>, we can simply <strong>POP </strong>the element as we have already reversed the stack in the <strong>ENQUEUE</strong>, due to which the first inserted element always remains on the top of the stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*e0-ZeeDZ8WdrFaXc4X4ZeA.png" /><figcaption>10 (First inserted element is on the top)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f58ebb926bb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>