<?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 Lakshya on Medium]]></title>
        <description><![CDATA[Stories by Lakshya on Medium]]></description>
        <link>https://medium.com/@laksh-daksha09?source=rss-9de54bae8ed4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UqKRQy5QXkk163pahE2SxA.jpeg</url>
            <title>Stories by Lakshya on Medium</title>
            <link>https://medium.com/@laksh-daksha09?source=rss-9de54bae8ed4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:19:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@laksh-daksha09/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[Mathematical Understanding of Bias Variance Tradeoff]]></title>
            <link>https://medium.com/data-science/mathematical-understanding-of-bias-variance-tradeoff-9366dbc8439a?source=rss-9de54bae8ed4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9366dbc8439a</guid>
            <category><![CDATA[bias-variance-tradeoff]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematical]]></category>
            <dc:creator><![CDATA[Lakshya]]></dc:creator>
            <pubDate>Tue, 19 Oct 2021 18:59:17 GMT</pubDate>
            <atom:updated>2021-10-19T18:59:17.427Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding Bias-Variance Tradeoff from the equation</h4><p>Many of us have read about the Bias and Variance at various places in the AI literature but still many people struggle to explain it with respect to mathematical equation. People always comment about bias-variance whenever they build a model in order to figure out whether the model can be used or not in the real world and how good its performance will be. In this article, we will focus on the mathematical equation depicting Bias-Variance and try to understand different parts of this equation from a mathematical perspective. Let me first highlight some of the assumptions that are essential in order to understand the equation:</p><h4>Assumptions</h4><ol><li>There is a Hypothesis set H that we are using while training a model.</li><li>There is an actual target function f that we try to approximate using the learning algorithm and the dataset D. This function f is always unknown.</li><li>When we take a dataset D and apply a learning algorithm over it, we will get a prediction function g, that tries to approximate the actual target function f.</li><li>There is a datapoint x that belongs to the dataset D.</li></ol><p>We will be using above assumptions in the equation below.</p><p>As the main focus of this article is to understand the bias-variance equation from mathematical perspective, we will directly look at the equation without going into the derivation behind it(Please check the references, if you want to understand the derivation).</p><p>Before delving into the explanation, let’s first look at the equation of Bias and Variance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbWd-4156MX_j_OuIAURkg.jpeg" /><figcaption>Image by Author</figcaption></figure><h4>Explanation</h4><p>In the above equation, we assume that we are looking at a data point x and finding out the error. Now in order to understand the right hand side, we use the above mentioned assumptions. Let’s say we have a hypothesis set H(which indicates the class of functions that we can probably go over while training). Now let’s say we apply the learning algorithm by taking the dataset D and running empirical risk minimization(training a model using an optimization algorithm to minimize empirical loss) over the same to get a predictor function g. In the above equation the g^D(x) indicates that g is explicitly attached to the dataset D because with different realizations of a dataset D, we will get different predictor functions. For example: let’s say we have 10 different realizations of a dataset D as: D1, D2, D3,…..,D10. Now when we take each of them and run empirical risk minimization, we will get different predictors as g1, g2, g3, ……,g10 respectively. Note that I have taken only 10 datasets and corresponding to that there are 10 different predictors just for the sake of explaining but there can be infinitely many realizations.</p><p>Now imagine we have many different predictors indicated by g_i and we take the average of them to get g^bar(x). Mathematically speaking g^bar(x) can be shown to be somewhat better as compared to other learned predictors and is more closer to the actual target function f. Now the first part of the right hand side in above equation simply indicates the variance of predictor function g^D(x). With the single realization of dataset D(which simply means that the dataset which we explicitly have with us or is given to us) we will get some predictor g^D(x) and we measure the spread of different predictors around the average predictor g^bar(x) that simply indicates the variance.</p><p>Understanding the second part of the above equation is quite simple, we are trying to measure how far the prediction of our best average predictor g^bar(x) is with respect to the actual target function f(x). This difference indicates the bias in our prediction for a datapoint x.</p><p>Now practically speaking while we train a model and measure the error, we never have access to this average predictor as well as the actual target function, what we have is some dataset that we are trying to use to train the model and some hypothesis set based upon our modelling decisions. let’s say we choose hypothesis set as neural networks to train over the given dataset. After training, we will get some predictor function g^D(i.e., a neural network) using which we can measure the error over the datapoints in our test set. And theoretically whatever error we will measure will have some portion of it that will be attributed to bias and some portion to variance and also there is some irreducible error that is not shown in the above equation.</p><p>After looking at the above equation, we can quickly relate the concepts like overfitting in which whenever we see that the training error is very low but test error is high, we quickly say that it is overfitting and it is a case of low bias and high variance. Here low bias indicates that the average predictor is very close to the actual target function f. And high variance is indicative of the fact that predictors in our hypothesis set are too much spread out with respect to the average predictor, i.e., g^bar(x) meaning with different dataset I will obtain different predictor and they are not close to each other. So, in order to resolve such a situation we quickly start applying regularization techniques which theoretically reduces the size of the hypothesis set by putting constraints(try to relate L1 and L2 regularization formulation ) over the model parameters. Intuitively speaking, due to these constraints as the hypothesis set gets reduced the variance start getting reduced but again the bias starts getting increased. And the reason for an increased bias is the fact that since we have a restricted hypothesis set, the average predictor will now change and will depend only on those predictors that are present in the reduced hypothesis set due to which its closeness with respect to actual target function f might decrease which will result in increased bias.</p><h4>Note</h4><p>When you see the bias-variance equation in the literature there is another expectation over the data points x which simply indicates that we report the expected error over all the data points in the test set but in this article we simply tried understanding the equation with respect to one data point.</p><p>If you want to deep dive further and see how the equation is derived, feel free to look at the references:</p><h4>References</h4><p><a href="https://www.youtube.com/watch?v=zrEyxfl2-a8&amp;list=PLD63A284B7615313A&amp;index=8">https://www.youtube.com/watch?v=zrEyxfl2-a8&amp;list=PLD63A284B7615313A&amp;index=8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9366dbc8439a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/mathematical-understanding-of-bias-variance-tradeoff-9366dbc8439a">Mathematical Understanding of Bias Variance Tradeoff</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 Set Sequence]]></title>
            <link>https://laksh-daksha09.medium.com/the-set-sequence-978313f85982?source=rss-9de54bae8ed4------2</link>
            <guid isPermaLink="false">https://medium.com/p/978313f85982</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[perspective]]></category>
            <category><![CDATA[optimism]]></category>
            <category><![CDATA[mindset-shift]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Lakshya]]></dc:creator>
            <pubDate>Wed, 24 Feb 2021 18:11:05 GMT</pubDate>
            <atom:updated>2021-02-24T18:11:05.028Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes very simple and everyday happening things tells you a lot about life. It’s one’s perspective that shapes our vision and decides the future actions. This post will not going to be boring, I would rather first show the images clicked recently by me and then I’ll start writing :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMj6_1SQ7E6D_jZleJ77mQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZDN8jitPFBOA7m9YxqoPLQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHSSSmIouA9ya0M6T10_Ew.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Lpy_KYwLTBMSTog22yAAA.jpeg" /></figure><p>The above images are elegant and beautiful and I bet everyone of us will definitely enjoy this beauty. I recently traveled and clicked these images of beautiful sunset over a beach. I really enjoyed and wondered while I was sitting over the beach that even if the next immediate event after this will be dark night we still focus on this beautiful sunset. There are lot of things that we appreciate like waves emerging out from the water, cool breeze, clouds and of course different shaped clouds with various colors due to sun’s light, splash of water that comes due to high waves and the big Sun, different gradients that are emerging in the sky etc etc. We find so many ways, so many different angles to find the beauty in this sunset. Just after the sunset quickly the dark night comes and everyone focus on their daily work as well as taking rest from their routine and prepare themselves for the very next day in order to see the beautiful sun rise :).</p><p>Now think about the above situation from life’s perspective. In life, we face difficult situations or about to face difficult times and in those times we think really hard about bad aspects, bad memories and naturally the focus becomes really negative. Even if something positive happens, we try to see negative because our attention is on the dark side of the situation. We even forget the fact that this phase, the difficult phase is just one transitional phase of life, its a phase that will pass and we should embrace the fact that this current situation came in order to make us more stronger, much better version of ourselves and emerge out to be really tough to fight all odds of life. If we learn to appreciate the difficult times, if we learn to see the beauty present in them like we do when sun sets even if the darkness is about to come, we will find ourselves to be more energetic, optimistic, confident and all these will help us to behave like a warrior in those times :)</p><p>So the takeaway is “learn to change the perspective whenever you find the situation is difficult. Perhaps the slight change in perspective will ease your mental burden and will give you a positive energy to come out as winner in tough times”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=978313f85982" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural Data Augmentation]]></title>
            <link>https://laksh-daksha09.medium.com/neural-data-augmentation-2330318e8430?source=rss-9de54bae8ed4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2330318e8430</guid>
            <category><![CDATA[data-augmentation]]></category>
            <category><![CDATA[relation-extraction]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[seq2seq]]></category>
            <dc:creator><![CDATA[Lakshya]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 07:40:12 GMT</pubDate>
            <atom:updated>2021-02-12T11:06:08.103Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog post gives a glimpse of recently published research work by Google on Neural Data Augmentation using Text-to-Text Transfer Transformer(<a href="https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html">T5</a>) model. Data Augmentation is something that is required in every area either it be NLP, Computer Vision or any other field. Data, if available in large amounts or can be generated in large amounts will always help the deep learning models to learn the patterns better and generalize over the unseen dataset well. Also Data augmentation is a popular solution for biased or imbalanced data, which can be approached either by duplicating examples or using heuristics to synthesize new examples.</p><p>Recently, Google published this paper titled: <strong><em>“Neural Data Augmentation via Example Extrapolation” (</em></strong><a href="https://arxiv.org/pdf/2102.01335.pdf">https://arxiv.org/pdf/2102.01335.pdf</a><strong><em>) </em></strong>which talks about how synthetic examples can be generated for under-represented slices of the data and shows better performance as compared to other techniques like up-sampling the under-represented data slice or any other method over relation extraction (<a href="https://github.com/thunlp/FewRel">FewRel</a>) and intent classification/slot-filling tasks (<a href="https://archive.ics.uci.edu/ml/datasets/CLINC150">CLINC150</a> and <a href="https://paperswithcode.com/dataset/snips">SNIPS</a>) and shows improvements over the state-of-the-art. They call this model as Example Extrapolation(Ex2). Cool!! let’s first look at below images before diving into more theory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*6HNkzhxfaSoJTlBhk16b7Q.png" /><figcaption>Figure 1 from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.</figcaption></figure><p>Looking at above figure, we will get a complete idea about how this approach goes and trains a seq2seq model in order to generate data for under-represented slices. Ok, so first the point is to find the under-represented slices in the data and first of all before that what is a data slice?. According to the paper, a slice could be the set of all examples sharing a given label, or all examples in a particular language, or with a particular syntactic construction.</p><p>Their model which they call as Example Extrapolation(Ex2) makes no assumption about how the data is sliced and it is totally up to the practitioner to slice the data in a way that exposes important but under-represented slices, which Ex2 can then target for data augmentation. So, the flow for end-to-end process goes as follows:</p><ol><li>Divide Dataset into slices.</li><li>Train an example extrapolator using data from those slices.</li><li>Use the example extrapolator to generate new synthetic data for under-represented slices of the dataset.</li><li>Train a model on the union of the synthetic data and real data.</li></ol><h4>Task Formulation</h4><p>As underrepresented slices have only a few examples each, so paper refer to these as few-shot slices<strong>(denoted as F)</strong>and for these slices data augmentation is performed. The remaining slices of the data are called many-shot slices<strong>(denote as M)</strong> and these have enough data and will not receive data augmentation. The example extrapolator(Ex2) is trained with <strong>M</strong> only and used to infer new examples in <strong>F</strong> despite never having seen any examples in F during training. Its a very cool idea :). Also the term <strong>“few-shot”</strong> here means that there are slices of the data within the task that have very few examples. The other notion of <strong>“few-shot” </strong>which indicates there are overall few examples for the entire task, is outside the scope of this paper.</p><p>Let’s say a practitioner defines the list of S slicing functions where each func-tion slice_s(e) is a Boolean function indicating whether example belongs in slice_s(potentially overlapping with other slice functions). So overall it looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*esQa16kOKQS_a2v1_Mcvnw.png" /><figcaption>Defining slices over Dataset for Training seq2seq model (above figure from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.)</figcaption></figure><h4>Training Procedure</h4><p>The training procedure of T5 Transformer model over slices denoted with <strong>M </strong>containing many examples can be understood with the below snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*KOAERVbuKNuG3xEvwR9FmA.png" /><figcaption>Training objective formulation for T5 model training (above figure from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.)</figcaption></figure><blockquote>To optimize this above objective, training procedure iterate over all training slices <strong>(s∈M)</strong>, and every example <strong>(e^∗)</strong> in each slice. For each example, the procedure sample K other examples (<strong>e_1:K)</strong> from the same slice, excluding <strong>e_∗</strong> itself. Training procedure then optimize the log-likelihood of <strong>e_∗ </strong>as output given <strong>e_1:K</strong> as input.</blockquote><h4>Model Used</h4><p>The authors used T5 transformer model, which is a <strong>T</strong>ext-<strong>T</strong>o-<strong>T</strong>ext <strong>T</strong>ransfer <strong>T</strong>ransformer Model that was pre-trained on a large text corpus. This pre-training provides the network with a large amount of world knowledge, which is crucial for the model’s ability to extrapolate beyond the given examples. You can read more about T5 from this<a href="https://towardsdatascience.com/t5-text-to-text-transfer-transformer-643f89e8905e"> blog</a> and from the official <a href="https://arxiv.org/pdf/1910.10683.pdf">paper</a> as well.</p><h4>Evaluation over standard benchmark datasets</h4><p>The author evaluated their strategy using standard tasks like classification, slot filling, relation extraction with the respective standard benchmark datasets . They compared their model with <strong>baseline techniques</strong> and another strategy for data augmentation called <strong>up-sampling</strong>(samples from “few-shot” slices are up-sampled to match the median frequency of the many-shot slices in order to remove the imbalance and improve training.) Some of the results are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*Ywado4u1PR0nBtMZF9-Nrg.png" /><figcaption><a href="https://archive.ics.uci.edu/ml/datasets/CLINC150">CLINC150</a> Dataset(above figure from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*he94fi2hpml-P6be9cRJOg.png" /><figcaption><a href="https://paperswithcode.com/dataset/snips">SNIPS</a> Dataset (above figure from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*I105KFb-QqWPvRlRXEsbrQ.png" /><figcaption><a href="https://github.com/thunlp/FewRel">Few-rel</a> Dataset (above figure from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.)</figcaption></figure><h4><strong>Examples generated using Ex2</strong></h4><p>The authors show some examples generated by Ex2 after training over CLINC150 dataset. Also in the paper they called the model which they train in order to generate examples for few-shot slices as <strong>Teacher model</strong> and the downstream model which is trained using both the actual data and the augmented data is called as <strong>Student model</strong>. This is an analogy to distillation where an already trained bigger teacher model is used to train a smaller student model or where a “teacher” is used to label a large number of unlabeled inputs (x’s) to be consumed by a “student”. The Ex2 approach is similar, except that the teacher does not label pre-existing x’s and instead synthesizes completely new(x,y)pairs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnfCp6x7onhrXo2AvqheqQ.png" /><figcaption>Table 9 from “Neural Data Augmentation via Example Extrapolation” by Kenton Lee et al.</figcaption></figure><h4>Conclusion</h4><p>This paper titled “<strong><em>Neural Data Augmentation via Example Extrapolation</em></strong>” proposes a very novel idea to do data augmentation using neural models that are already pre-trained on a very large corpus and have world knowledge present in them. Also these models are able to generalize well on new/unseen examples and generate new examples that follows similar distribution corresponding to example distribution in few-shot slices of the data. This techniques shows improvement over baselines and standard methods to do data augmentation like up-sampling.</p><h4><strong>References</strong></h4><ol><li><a href="https://arxiv.org/pdf/2102.01335.pdf">https://arxiv.org/pdf/2102.01335.pdf</a> (<strong><em>Neural Data Augmentation via Example Extrapolation</em></strong>)</li><li><a href="https://arxiv.org/pdf/1910.10683.pdf">https://arxiv.org/pdf/1910.10683.pdf</a> (<strong><em>T5 paper</em></strong>)</li><li><a href="https://towardsdatascience.com/t5-text-to-text-transfer-transformer-643f89e8905e">https://towardsdatascience.com/t5-text-to-text-transfer-transformer-643f89e8905e</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2330318e8430" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>