<?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 Aditya Tiwari on Medium]]></title>
        <description><![CDATA[Stories by Aditya Tiwari on Medium]]></description>
        <link>https://medium.com/@adityatiwari527?source=rss-ad9e78739591------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*aF6N_upmvxS4dWIAmIsz1w.jpeg</url>
            <title>Stories by Aditya Tiwari on Medium</title>
            <link>https://medium.com/@adityatiwari527?source=rss-ad9e78739591------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 11:51:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityatiwari527/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[Take a peek at Deep Reinforcement Learning for NLP]]></title>
            <link>https://medium.com/analytics-vidhya/take-a-peek-at-deep-reinforcement-learning-for-nlp-a8e37fbd7640?source=rss-ad9e78739591------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e37fbd7640</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[deep-q-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Aditya Tiwari]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 23:01:50 GMT</pubDate>
            <atom:updated>2019-09-29T14:07:54.839Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HpKh-MGZIq-GyRAiqEUnSw.png" /></figure><p><em>This blog will focus on developing a basic understanding of architecture for deep neural networks designed to handle state and action spaces characterized by natural language. The experimental results of this blog are referenced by the Microsoft Research work on </em><a href="https://arxiv.org/pdf/1511.04636v5.pdf"><em>Deep Reinforcement Learning with a Natural Language Action Space</em></a><em>.</em></p><h3>What is Reinforcement Learning?</h3><p>So as always this blog of mine too will start from scratch, we’ll start by understanding what is Reinforcement Learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*QVsnwatDVz8wcqJUsLJejw.png" /></figure><p>Reinforcement Learning is an area of <em>Machine Learning</em>, and thereby also a branch of <em>Artificial Intelligence</em>. It allows machines and software agents to automatically determine the ideal behavior within a specific context, in order to maximize its performance. Simple reward feedback is required for the agent to learn its behavior, this is known as the reinforcement signal.</p><p>It is just how humans started to learn things, how we evolved by knowing what is right and what is wrong. Take an example of a newly born baby, he has no clue what is going on? what to do? he might burn down the whole house and think it’s fun, only if he could :p. As he grows, his parents stop him from doing things that are not meant to be done, he receives negative feedback from his mother when he pees on the couch. He receives positive feedback when he greets the guests. That is what reinforcement learning is!!</p><p>The kid is Agent and his parents are the environment. The Agent performs a task and receives a reward corresponding to it (either negative or positive). The idea is to train machines such that they think and behave like a human.</p><p>Reinforcement Learning allows the machine or software agent to learn its behavior based on feedback from the environment. This behavior can be learned once and for all, or keep on adapting as time goes by. If the problem is modeled with care, some Reinforcement Learning algorithms can converge to the global optimum; this is the ideal behavior that maximizes the reward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*ofRVirC98HxduA5Mcl_0jQ.png" /></figure><h4>Reinforcement learning model:</h4><ul><li>environment state set: S</li><li>Action set: A</li><li>rules of transition between states</li><li>rules that determine the immediate reward for the state transition</li><li>rules that describe what the agent observes</li></ul><h4>Q-Learning:</h4><ul><li>It is used to Learn the policy for Reinforcement Learning.</li><li>Policy: a rule that the agent should follow to select actions given the current state.</li><li>Q-Learning: find the optimal policy for the decision process.</li><li>Approach: learning an action-value function, a.k.a. Q function, that computes the expected utility of taking an action in a state after training converges.</li><li>Q-function[Q(s,a)]: returns Q-value for action a at state s.</li></ul><h4>Q-Value:</h4><p>In statistical hypothesis testing, specifically multiple hypothesis testing, the <strong><em>q</em>-value</strong> provides a means to control the positive false discovery rate(pFDR). Just as the <em>p</em>-value gives the expected false positive rate obtained by rejecting the null hypothesis for any result with an equal or smaller <em>p</em>-value, the <em>q</em>-value gives the expected pFDR obtained by rejecting the null hypothesis for any result with an equal or smaller <em>q</em>-value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndqY3G90iUeIzwcwWL-9Cw.png" /></figure><p>I am pretty sure some of you have heard of the game “AlphaGo”, or must have heard about some bot beats the world champions. All credits to the Deep-Q-Network.</p><p>Now, the thing to understand is when training the learner for games like AlphaGo and Chess, the agent has a very small action space, but large state space. For example, in the game of chess, the state space is the whole 20X20 board, but the action space is small like a pawn can move only in 1–2 directions. Deep-Q-Network has been proven to be very effective.</p><p>But what if we talk about Reinforcement Learning for language understanding?</p><h3>Reinforcement Learning for language understanding</h3><h4>Sequential decision-making problem for text understanding:</h4><ul><li>E.g., Conversation, task-completion, text-based games…</li><li>Agent observes state as a string of text at a time t, e.g., state-text s(t).</li><li>Agent also knows a set of possible actions, each describes as a string text, e.g, action-texts</li><li>Agent tries to understand the “state text” and all possible “action texts”, and takes to right action — right means maximizing the long term reward.</li><li>Then, the environment state transits to a new state, agent receives an immediate reward.</li></ul><h4>Unbounded action space in RL for NLP:</h4><p>Not only the state space is huge, but the action space is also huge too. Action is characterized by unbounded natural language descriptions. For example, if say to the model “Hey! how are you doing? I was just waiting for F.R.I.E.N.D.S to stream but the power is gone”. Well, this input text from me is the state-space for the model(quite heavy), and the action space is every text combination available(or infinity). This problem for such a huge action space was still the problem in Deep-Q-Network. Then Deep Reinforcement Relevance Network(DRRN) got proposed.</p><h4>Deep Reinforcement Relevance Network(DRRN):</h4><p>The idea of DRRN is to project both the state and action into a continuous space(as vectors). Q-function is a relevance function of the state vector and action vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lV0CDDv-a4Up1phxlhUSlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cbR1YiI74tvRsI4caXnLAQ.png" /></figure><p>Figure 2 illustrates learning with an inner product interaction function(application of DRRN). We used Principal Component Analysis (PCA) to project the 100- dimension last hidden layer representation (before the inner product) to a 2-D plane. The vector embeddings start with small values, and after 600 episodes of experience-replay training, the embeddings are very close to the converged embedding (4000 episodes). The embedding vector of the optimal action (Action 1) converges to a positive inner product with the state embedding vector, while Action 2 converges to a negative inner product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpcxTUIb5-MrjsCszc8nvw.png" /></figure><p>The Figure above shows the learning curves of different models, where the dimension of the hidden layers in the DQNs and DRRN are all set to 100. After around 4000 episodes of experience-replay training, all methods converge. The DRRN converges much faster than the other three baselines and achieves a higher average reward. We hypothesize this is because the DRRN architecture is better at capturing relevance between state text and action text. The faster convergence for “Saving John” may be due to the smaller observation space and or the deterministic nature of its state transitions.</p><h4>Things we discussed:</h4><ul><li>We discussed about Reinforcement Learning and how Deep-Q-Network(DQN) performed extremely well in tasks with small action space(AlphaGo).</li><li>Why and How Deep Reinforcement Learning for NLP(e.g. text-based games) is different than a regular game with small action space.</li><li>Discussed about unbounded action space in Reinforcement Learning for NLP and how Deep Reinforcement Relevance Network(DRRN) converged faster in the experiments done on two text-based games(Saving John and Machine of Death).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e37fbd7640" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/take-a-peek-at-deep-reinforcement-learning-for-nlp-a8e37fbd7640">Take a peek at Deep Reinforcement Learning for NLP</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[P-Value in Statistics]]></title>
            <link>https://medium.com/@adityatiwari527/p-value-in-statistics-384ee86a32e7?source=rss-ad9e78739591------2</link>
            <guid isPermaLink="false">https://medium.com/p/384ee86a32e7</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Aditya Tiwari]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 13:07:04 GMT</pubDate>
            <atom:updated>2019-09-28T00:25:57.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*NICGOcVUC5_LhM9h_S-GKA.jpeg" /></figure><p>If you are reading this, you might have heard of phrases like “if the p-value is less than 0.05, we reject the null hypothesis.” What? Seriously? Why? Getting over this is very important as hypothesis testing is the holding pole of statistical modeling.</p><p><em>In statistical hypothesis testing, the </em><strong>p<em>-value</em></strong><em> or </em><strong><em>probability value</em></strong><em> is, for a given statistical model, the probability that, when the null hypothesis is true, the statistical summary (such as the absolute value of the sample mean difference between two compared groups) would be greater than or equal to the actual observed results.</em></p><p>Now, this is the definition I looked up at and didn’t really end up understanding what it actually meant. Now after reading this article, you’ll probably have a clear understanding of it. You’ll start appreciating statistics, quite a bit if not more.</p><h3>Hypothesis Testing</h3><p>Now, before diving into the p-value, we really need to get why are we using it? The reason is <strong>Hypothesis Testing</strong>. Let’s start by understanding what Hypothesis Testing is:</p><p>In statistics, when we wish to start asking questions about the data and interpret the results, we use statistical methods that provide confidence or likelihood about the answers. In general, this class of methods is called statistical hypothesis testing, or significance tests.</p><p>In statistics, a hypothesis test calculates some quantity under a given assumption. The result of the test allows us to interpret whether the assumption holds or whether the assumption has been violated.</p><p>The assumption of a statistical test is called the null hypothesis, or Hypothesis 0 (H0 for short). The assumption for no change.</p><p>A violation of the test’s assumption is often called the alternate hypothesis, hypothesis or H1 for short.</p><p>Now, the goal of running a hypothesis test is whether our assumption(null hypothesis) is going to be rejected or not. This measure is given by the P-value.</p><h3>Example</h3><p>Consider we are a candy manufacturing company, we used to sell candies for a year now. There have been ups and downs in the sales of the candies. Now, we planned to increase the sugar content in the candies in order to increase sales. Here we need to statistically test if sales are really increasing by increasing the sugar content in the candies.</p><p>Now, we run a hypothesis test. Our null hypothesis(H0) being — “No change in sales.”</p><p>The alternate hypothesis(H1) — “Significant change in sales.”</p><p>Our goal is to test whether we can reject our null hypothesis and approve the alternate hypothesis.</p><p>So what is the simple layman’s definition of p-value? <strong>The p-value is the probability that the null hypothesis is true</strong>. That’s it.</p><ul><li>If the value of the p-value is 0.25, then there is a 25% probability that there is no real increase or decrease in sales as a result of the new marketing strategy.</li><li>If the value of the p-value is 0.04 then there is a 4% probability that there is no real increase or decrease in sales as a result of the new marketing campaign.</li></ul><p>As you can surmise, the lower the p-value, the more confident we are that the alternate hypothesis is true, which, in this case, means that the new marketing strategy causes an increase or decrease in sales.</p><h3>Significance level</h3><p>The term <strong>significance level (α)</strong> is used to refer to a pre-chosen probability and the term “P-value” is used to indicate a probability that you calculate after a given study.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*ZUS53aGlzWM7S4N3L9bxkQ.jpeg" /></figure><p>Let&#39;s start by looking at an example: I would like to estimate the most loved candies(with different amount of sugar content) of an individual living in Delhi, I walk around Delhi and ask 100 people (my sample size is 100) about there choice and compute the average, Do you think this average is the correct answer? If I were to ask another 100 will I be getting the exact answer? Most likely not.</p><p>Confidence interval is used to address our uncertainty in the average sugar content we estimated, the 95% confidence interval in layman terms means if I were to repeat my survey 100 times the answer I will be getting in 95 times is bounded by my confidence interval.</p><p>If your P-value is less than the chosen significance level then you reject the null hypothesis i.e. accept that your sample gives reasonable evidence to support the alternative hypothesis. It does NOT imply a “meaningful” or “important” difference; that is for you to decide when considering the real-world relevance of your result.</p><p>Here comes the question that at what should be the significance level? Well, that depends on what standard you want to set/follow. In most fields, acceptable p-values should be under 0.05 while in other fields a p-value of under 0.01 is required. This cut-off number is known in statistics as the <strong>alpha</strong>, and results from experiments with p-values below this threshold are considered to be statistically significant.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=384ee86a32e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Overfitting and Underfitting in Machine Learning]]></title>
            <link>https://medium.com/analytics-vidhya/understanding-overfitting-and-underfitting-in-machine-learning-2a2f3577fb27?source=rss-ad9e78739591------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a2f3577fb27</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[overfitting]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[underfitting]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Aditya Tiwari]]></dc:creator>
            <pubDate>Fri, 06 Sep 2019 14:37:12 GMT</pubDate>
            <atom:updated>2019-09-20T05:06:32.205Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are just a “new one” in the field of Machine Learning, and you hear someone say “The model ain’t generalizing data well” Whoops! This is one of most important things we should Understand, and it is quite easy if we try to look at it Practically.</p><h3>What does it say?</h3><blockquote>In machine learning, generalization usually refers to the ability of an algorithm to be effective across a range of inputs and applications.</blockquote><p>Suppose that we are designing a machine learning model. How a model is said to be a good machine learning model? -&gt; By checking if it generalizes any new input data from the problem domain in a proper way. This helps us to make predictions in the future data, that data model has never seen.</p><p>Now, suppose we want to check how well our machine learning model learns and generalizes to the new data. For that we have overfitting and underfitting, which are majorly responsible for the poor performances of the machine learning algorithms.</p><blockquote>A model is good if it neither Underfits or Overfits.</blockquote><p>It is okay if it is going over your head, we will slowly make it go into your head.</p><p>The basic Overview of how Machine Learning works is that we have the data, the data contains number of features(information) which are being used by models to predict the future. We train the model using the train data so it gets ready for predicting the future instances.</p><h3>Underfitting</h3><p>A statistical model is said to have underfitting when it cannot capture the underlying trend of the data. It’s like, what if I send a 3rd grade kid to a Differential Calculus Class, the kid is only familiar with the basic arithmetic operations. That is what it is! If the data contains too much information that the model cannot take, the model is going to underfit for sure.</p><p>It usually happens if we have less data to train our model, but quite high amount of features, Or when we try to build a linear model with a non-linear data. In such cases the rules of the machine learning model are too easy and flexible to be applied on such a minimal data and therefore the model will probably make a lot of wrong predictions.</p><p>Specifically, underfitting occurs if the model or algorithm shows <strong>low variance</strong> but <strong>high bias</strong>. Underfitting is often a result of an excessively simple model.</p><p>To understand what bias and variance is, refer to <a href="https://machinelearningmastery.com/gentle-introduction-to-the-bias-variance-trade-off-in-machine-learning/">https://machinelearningmastery.com/gentle-introduction-to-the-bias-variance-trade-off-in-machine-learning/</a></p><p>Understanding of bias and variance will make your concepts more clear.</p><h3>Overfitting</h3><p>Overfitting occurs when a statistical model or machine learning algorithm captures the noise of the data. Intuitively, overfitting occurs when the model or the algorithm fits the data too well. Specifically, overfitting occurs if the model or algorithm shows <strong>low bias</strong> but <strong>high variance</strong>. Overfitting is often a result of an excessively complicated model applied to a not so complicated dataset.</p><p>Let us take an example of a Regression model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7OPgojau8hkiPUiHoGK_w.png" /></figure><p>The pictures clearly shows the different ways the models are capturing the trend of the data, we can see that the underfitted model looks like it does not care where the data points are going, he just wants to go straight, don’t know where 😐. This is what happens when we apply a linear model to a non-linear data. It will not perform well neither perform good on the train data nor on the test data.</p><p>The overfitted model took the trend too seriously, it captured each and everything that is in the train data and fitting tremendously well. But, it does not mean it generalizes well, because it also captured the noise i.e., the information which does not tell us about the target function. It will give high accuracy on the train data, but that’s not what we want. It will collapse on the test data.</p><p>I think there is nothing to say about the Robust model picture we have 😃, this what a well generalized model looks like.</p><p>Same thing we can see on classification models:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*FT0RuzNMH9zP4LrAHbpgcQ.png" /></figure><h3>How to avoid them?</h3><p>Well, Underfitting is quite simple to overcome, it can be avoided by using more data and also reducing the features by feature selection.</p><p>But when it comes to Overfitting, we can either try to build a simpler model with more bias or there are various methods used, some of the common methodologies are:</p><h4>Cross-validation</h4><p>Cross-validation is a powerful preventative measure against overfitting.</p><p>The idea is clever: Use your initial training data to generate multiple mini train-test splits. Use these splits to tune your model.</p><p>In standard k-fold cross-validation, we partition the data into k subsets, called folds. Then, we iteratively train the algorithm on k-1 folds while using the remaining fold as the test set (called the “holdout fold”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*77s2vmtzfosBGyC_hlNuLA.jpeg" /></figure><p>Cross-validation allows you to tune hyperparameters with only your original training set. This allows you to keep your test set as a truly unseen dataset for selecting your final model.</p><h4>Train with more data</h4><p>It won’t work every time, but training with more data can help algorithms detect the signal better. Of course, that’s not always the case. If we just add more noisy data, this technique won’t help. That’s why you should always ensure your data is clean and relevant.</p><h4>Remove features</h4><p>You can manually improve their generalizability by removing irrelevant input features.</p><h4>Early stopping</h4><p>When you’re <a href="https://elitedatascience.com/machine-learning-iteration#model">t</a>raining a learning algorithm iteratively, you can measure how well each iteration of the model performs.</p><p>Up until a certain number of iterations, new iterations improve the model. After that point, however, the model’s ability to generalize can weaken as it begins to overfit the training data.</p><p>Early stopping refers stopping the training process before the learner passes that point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*k-o16mTJxRgfiEhQyXvzEg.png" /></figure><p>Epoch refers to the the number of iteration the model have been trained through. this technique is mostly used in deep learning while other techniques (e.g. regularization) are preferred for classical machine learning.</p><h4>Regularization</h4><p>Regularization refers to a broad range of techniques for artificially forcing your model to be simpler.</p><p>The method will depend on the type of learner you’re using. For example, you could prune a decision tree, use dropout on a neural network, or add a penalty parameter to the cost function in regression.</p><p><strong>Don’t get scared if you don’t know the terms we talked about in the “How to avoid?” section, you will become familiar with them eventually when you’ll learn the intuition behind more and more machine learning algorithms, just let it go for now.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a2f3577fb27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/understanding-overfitting-and-underfitting-in-machine-learning-2a2f3577fb27">Understanding Overfitting and Underfitting in Machine Learning</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>