<?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 Kaustubh on Medium]]></title>
        <description><![CDATA[Stories by Kaustubh on Medium]]></description>
        <link>https://medium.com/@kaustubh-q?source=rss-c0f461fe5681------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oJcfz0ZBfQxFetOK</url>
            <title>Stories by Kaustubh on Medium</title>
            <link>https://medium.com/@kaustubh-q?source=rss-c0f461fe5681------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:50:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kaustubh-q/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[Can a Machine Prove Fermat’s Last Theorem?]]></title>
            <link>https://kaustubh-q.medium.com/can-a-machine-prove-fermats-last-theorem-e1ede73f25e3?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1ede73f25e3</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[number-theory]]></category>
            <category><![CDATA[fermat]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[proof]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Sun, 04 Jul 2021 07:36:06 GMT</pubDate>
            <atom:updated>2021-07-17T09:11:45.152Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*1e-oOSqi7XPWgiKD.png" /></figure><h4>Introduction</h4><p>Fermat’s Last Theorem might just be the most famous theorem in mathematics, apart from the features in The Simpsons, this theorem has quite an interesting story behind it. This theorem(conjecture) was first proposed as a scribble on a copy of <em>Arithmetica</em> by Diophantus. For the proof, we got a convenient,</p><blockquote>Cubum autem in duos cubos, aut quadrato-quadratum in duos quadrato-quadratos, et generaliter nullam in infinitum ultra quadratum potestatem in duos eiusdem nominis fas est dividere cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet</blockquote><p>which loosely translates to “It is impossible for a cube to be the sum of two cubes, a fourth power to be the sum of two fourth powers, or in general for any number that is a power greater than the second to be the sum of two like powers. I have discovered a truly marvelous demonstration of this proposition that this margin is too narrow to contain”.</p><p>After his passing his son published all his footnotes and margin notes from the book and Fermat did have the proof, but only for a special case(we will see this later). Since then there have been multiple tries to form cogent proofs for this theorem and there were none until Wiles’s 150 proof which showed that the theorem holds true. Although Wiles’s proof has to do with elliptic curves, we will try to get to that point through intuitive steps.</p><h4>Fermat’s Conjecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*1UR_2tnswzMNO-ZkX8XV6Q.png" /></figure><p>At first glance, it doesn’t seem as tedious and scary. One variation of Fermat’s is Euler’s sum of powers conjecture(E-SOP). E-SOP states that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*U98L4dJ_BYoIbhlMuazGJg.png" /></figure><p>So some examples of this would be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*_Y5pGJDLQERqoSc_ZlmEuw.png" /></figure><p>E-SOP, though got disproved through the shortest paper in mathematics which just gave a counterexample. And this was done through the use of one of the first supercomputers CDC-6600.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*TcmWjXTMIccNx5ZTT4plAA.png" /></figure><p>But can we prove Fermat’s this way, using a computer?</p><h4>Some Random Ideas</h4><p>When I saw Fermat’s for the first time the first instinct was to take log on both sides, though useless, there is no harm in trying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*Lg4xDh7olwwkw6-bnqut_w.png" /></figure><p>The other thing is that (a,b,c) is a set also called Fermat’s Set, this also implies no two elements of the subset can be equal. This can be shown quite easily as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*yL5PDGtHive4ECkzczXQ7A.png" /></figure><p>The nth root of 2 is irrational and the division of integers is rational hence this equality doesn’t hold. So we know that taking log won’t work and so wouldn’t assume any of the two values being equal, but how do we prove this now.</p><h4>The Halting Problem</h4><p>Can we definitively say that a program will terminate? The Halting Problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. So for example,</p><pre>#PYTHON<br>#finding pythagorean triplets<br>n = 2<br>for i in range(1,100):<br>        for j in range(1,100):<br>            for k in range(1,100):<br>                if(pow(i,n)+pow(j,n) == pow(k,n)):<br>                    print(i,j,k,&quot;\n&quot;)<br>                else:<br>                    continue</pre><p>So this program will halt, as we know of many triplets exist between 1 and 100 but what if we give n =3, it will terminate without a solution but if we remove the boundary condition of 100 and give am infinite search space, would it terminate, if it doesn’t then how do we represent it.</p><pre>#PYTHON<br>import sys<br>n = 3<br>while n:<br>        for i in range(1,sys.maxint):<br>                for j in range(1,sys.maxint):<br>                    for k in range(1,sys.maxint):<br>                        if(pow(i,n)+pow(j,n) == pow(k,n)):<br>                            break<br>                        else:<br>                            continue<br>    n +=1<br>                <br>fermats_3(n)<br>#bad programming, use while for reducing complexity.</pre><p>Is there any way this problem would terminate, in Python? The short answer is NO but there is no way to show this using Python. So instead we use Coq.</p><h4>Coq</h4><p>Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms, and theorems together with an environment for semi-interactive development of machine-checked proofs. A little intuition for Coq could be understood by the following snippet.</p><pre>(*COQ*)<br>(*Defining the function add*)<br>Fixpoint add(a b:nat) : nat :=<br>  match a with<br>  | O =&gt; b<br>  | S n =&gt; S(add n b)<br>  end.<br>(*Proof For Associativity of Addition<br>using induction*)<br>Theorem add_associ: forall (a b c: nat),<br>  (add a (add b c)) = (add (add a b) c).<br>Proof.<br>  intros a b c.<br>  induction a.<br>  simpl.<br>  reflexivity.<br>  simpl.<br>  rewrite -&gt; IHa.<br>  reflexivity.<br>Qed.</pre><p>Coq is quite intuitive in itself because everything we input to the compiler is based on empirical mathematical operations. For example, reflexivity in the previous example. But how does this help us avert the halting problem? To demonstrate that, we can look into proving if the square root of any number is irrational. This again would bring out the halting problem as we will have to find a set (p,q) such that the division gives the rooted number as displayed in the program below. A very intuitive tutorial on the same is given <a href="https://www.dazhuanlan.com/2019/08/17/5d576b62344dd/">here</a>. But the notion is to prove the following.</p><pre>#PYTHON<br>def irr(n):<br>    p = 1<br>    while(p):<br>        for q in range(1,p+1):<br>            if(p//q == pow(n,0.5)):<br>                 print(&quot;Yes we are in the matrix&quot;)<br>            else:<br>                print(&quot;Umm not yet&quot;)<br>        p +=1</pre><pre>irr(2)</pre><p>The same problem in Coq.</p><pre>(*COQ*)<br>Definition irrational (x : R) : Prop :=   ~ exists p q : Z, (q &gt; 0)%Z / (IZR p / IZR q)%R = x.</pre><pre>(*In natural language we may read this as: Given an x which is a real number(R) there exists no set (p,q) in the interger and q is always greater than 0 such that the injection from Z to R of p and q divided yeilds x.*)</pre><h4>Fermat’s Last Theorem in Coq</h4><p>It’s almost impossible to build down a 200 page proof to well any number of lines of code, but a systematic procedure for doing the same can provide partial proof. Solving for the entire proof is a mammoth task and it is also one of the 10 challenging problems given by Prof. Dr. Jan Bergstra stated as:</p><blockquote>Formalize and verify by computer a proof of Fermat’s Last Theorem, as proved by A. Wiles in 1995. This problem is in the spirit of a long and strong Dutch tradition</blockquote><p>The sketch of the proof given by Stevens, consists of 7 sub theorems that need to be proved individually to arrive at the final proof. The first 4 are quite easy(to understand) but the final theorems <strong>require</strong> a solid knowledge of Number Theory, Galois Theory and so much more and proving those computationally is still a big reach problem. For my proof, I have proved the first theorem the rest of the 3 out of 4 were taken as empirical as that can be shown true quite easily on pen and paper. Here are the theorems:</p><p><strong>Theorem 1</strong>: If there is a Fermat triple for exponent n, there is a Fermat triple (a,b,c) for exponent n with a and b coprime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*i-HYTv5wDKm22AYznlGByg.png" /></figure><p><strong>Theorem 2: </strong>There is no Fermat Triple for n = 4. <em>(Emperical in my proof)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*psR0ABx_VIuyluPslox4kA.png" /></figure><p><strong>Theorem 3: </strong>There is no Fermat Triplet for n =3. <em>(Emperical in my proof)</em></p><p>Fermat himse gave the proof for this, it’s relatively simple to understand. Follow this <a href="https://en.wikipedia.org/wiki/Proof_of_Fermat%27s_Last_Theorem_for_specific_exponents#:~:text=Fermat%20sent%20the,48%5D%20and%20Duarte">link</a>.</p><p><strong>Theorem 4: </strong>If there is a Fermat triple for an exponent &gt; 4, then there is a Fermat triple for an exponent which is a prime number &gt; 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*SM907Wo41NH0B9D3298PDQ.png" /></figure><p><strong>Theorem 5:</strong> Let (a,b,c) be a Fermat triple for an exponent which is prime number p &gt; 4. Assume that a and b are coprime, that b is even, and that a-3 is a multiple of 4. Then the projective curve given by the equation y² = x(x-a^p)(x+b^p) is elliptic and semistable and remarkable.</p><p><strong>Theorem 6: </strong>A <em>remarkable elliptic curve</em> cannot be <em>modular</em>.</p><p><strong>Theorem 7:</strong> Every <em>semistable elliptic curve</em> is <em>modular</em>.</p><blockquote>The proofs for the last three theorems are available in the original paper, <a href="http://scienzamedia.uniroma2.it/~eal/Wiles-Fermat.pdf">here</a>.</blockquote><p>We assume in the first four theorems that (a,b,c) is a Fermat Set and a and b are coprime, which means that a and b can’t both be even. If a and b are both odd then c has to be even, the minimum of one of the triplets has to be even. We can permute this, by keeping a and c odd and b as even. Then (a-1) or (a-3) has to be a multiple of 4. If (a-1) is a multiple of 4 we arrange (a-3) by changing all signs(remarkable elliptical and semistable). With Theorem 6 we know that this is not modular, but gets contradicted by Theorem 7, making our assumption of (a,b,c) being a Fermat Triplet wrong. Hence, by contradiction, Fermat’s Last Theorem is Proved.</p><h4>Conclusion</h4><p>Proving Fermat’s computationally is extremely hard after the first four theorems and require more features from the underlying language and skill too. My proof for the first 4 is still incomplete and I’m working on it.</p><h4>Resources</h4><p><a href="https://coq.inria.fr/">More about Coq</a></p><p><a href="https://github.com/kaustubherttre/coq-proofs/blob/master/some-coq-proofs/intro.v">Intro to Basic Coq Programming</a></p><p><a href="https://en.wikipedia.org/wiki/Fermat%27s_Last_Theorem#:~:text=In%20number%20theory%2C%20Fermat&#39;s%20Last,of%20n%20greater%20than%202.">Fermat’s Last Theorem Introduction</a></p><p><a href="https://en.wikipedia.org/wiki/Euler%27s_sum_of_powers_conjecture">Euler’s Conjecture</a></p><p><a href="https://www.math.toronto.edu/mathnet/questionCorner/fermat4.html">Fermat’s Case for n =4</a></p><p><a href="https://en.wikipedia.org/wiki/Proof_of_Fermat%27s_Last_Theorem_for_specific_exponents#:~:text=Fermat%20sent%20the,48%5D%20and%20Duarte">Fermat’s Case for n =3</a></p><p><a href="http://scienzamedia.uniroma2.it/~eal/Wiles-Fermat.pdf">Fermat’s Full Proof</a></p><p><a href="https://ui.adsabs.harvard.edu/abs/2005cs.......10011D/abstract">Infinite Descent</a></p><p><a href="http://www.cs.rug.nl/~wim/fermat/wilesEnglish.html#a3">Proving Fermat’s Computationally</a> (Perfect Explaination)</p><p><a href="https://github.com/kaustubherttre/coq-proofs/blob/master/some-coq-proofs/fermat-last-theorem.v">My Incomplete Proof</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1ede73f25e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pension Schemes and Behaviors]]></title>
            <link>https://kaustubh-q.medium.com/pension-schemes-and-behaviors-8ae89761c60a?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ae89761c60a</guid>
            <category><![CDATA[game-theory]]></category>
            <category><![CDATA[behavioral-science]]></category>
            <category><![CDATA[behavioral-economics]]></category>
            <category><![CDATA[psychology]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Fri, 25 Jun 2021 21:53:19 GMT</pubDate>
            <atom:updated>2021-06-25T21:53:19.203Z</atom:updated>
            <content:encoded><![CDATA[<h4>A behavioral perspective on National Pension Scheme and Atal Pension Yojana</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kcsw_3ViPL-YlSAx" /><figcaption>Photo by <a href="https://unsplash.com/@carolinehdz?utm_source=medium&amp;utm_medium=referral">Caroline Hernandez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To articulate the reasons for the untowardness in the participation in Pension Schemes we need to identify the problem type, pension schemes are long-term investments where a certain amount of money gets locked for a period of 20–25 years and sufficient returns only happen later on. A very generalized answer to the skepticism with long-term investment for an irrational agent could be explained by very basic behavioral economics concepts.</p><ol><li><strong>Intertemporal Choices with no immediate utility: </strong>While people save for their retirements, they are sacrificing some amount of consumption and the utility associated with it. The intertemporality lies in the fact that the choice made will have consequences throughout and as said by Adam Smith in Theory of Moral Sentiments, “passion” and “greed” get in the way of intertemporal choices without immediate gratification and leads to myopic behavior instead of farsighted impartiality. The “willpower” of an agent plays a key role here, as they are aware that whatever choice they make the outcome will be apparent much later. And this is also a reason why people tend to delay saving for retirement. Educating only seems to move intentions for example in [1] after taking a seminar on retirement 100% of the participants agreed that they would invest in the retirement policy at their company yet only 14% actually did.</li><li><strong>Complexity and Abundance of Choice: </strong>Traditional Economics poses “the more choice the better” (implicit assumption being that agents are rational) but it’s anything but. The abundance of choice is discouraging because the agent has to choose one, where there’s a cloud of uncertainty over the utility. This also instills the notion of “no opportunity to learn” especially with pension schemes that provide no scope for it, all of this creates a “paralyzing effect” with increased choices. This effect of reduced participation with increased choices was explained clearly in [2]. With NPS, there are two tiers and the investment is diversified over equity and bonds. There are more than 9 banks that provide NPS services, with returns very similar to one another, this creates a state of confusion.</li><li><strong>Passivity in Choice: </strong>Due to the abundance of choices people tend to rely on the default. The choice of the masses and a social norm of sorts. It seems the safest as the effect of loss is normalized if there are more people facing it. Passivity in the context of Pension Schemes comes along with the amount invested and the interest rates. The default choice with NPS is usually SBI as there exists “trust” which does get faded with the envious higher interest rates by private banks. For APY, the amount of return is the question, there is a trade-off between return and the monthly investment, more return equates to more investment, this decision is extremely hard for people of the middle and lower-income class for which the scheme is devised for as the “default” choice my not be the right choice for them.</li><li><strong>Competitive Choices: </strong>Possibly the biggest competition to long-term Pension schemes are Mutual Funds. MFs are based on the same premise of long-term returns the only difference is that they are based upon the stock market rather than the bond market. MFs can provide a sufficiently higher rate of return than Pension schemes and are marketed in a way that implies risk aversion which is why they are the popular choice when it comes to long-term investment.</li></ol><p>The aforementioned effects have substantial ramifications on the choices made by buyers. And while devising an attractive policy both parties need to be incentivized. So for that reason, we cannot really increase/decrease the rate of interest nor the time period. Some improvements that could be beneficial for NPS are:</p><ol><li><strong>Regularisation of Choices</strong>: The number of choices can be reduced through partnerships that are based on swaps so both partner companies get awarded the utility and the limited choice incentivized people to invest in the same. Partnerships will also increase the rate of return because the default risk would reduce due to added diversification.</li><li><strong>Removal of Tier 1 and Tier 2:</strong> This would reduce the complexity for the investor and the provider can keep a certain fraction of the asset as security or escrow. This will also relax the restrictions that come with NPS.</li><li><strong>Comparative with MFs: </strong>As pension schemes mostly rely on bonds they are hedged from company defaults which MFs are not. There will always be the risk of inflation but the summation of risk will be lower for Pension Schemes and this fact should be highlighted.</li><li><strong>Investment in Commodities: </strong>Commodities and especially gold is a great investment for inflation hedging, companies in addition to bonds bank can provide gold futures which will one, diversify the portfolio and create an exit mechanism in governmental collapse.</li></ol><p>As for the APY which geared towards the lower and middle-income class the scheme is entirely governmental and there is always skepticism with that. APY especially faces passivity of choice mainly due to the knowledge deficit of the buyer and if the provider doesn’t disclose the needful this contract will become heavily tainted because in the case of default the money would go to the provider. Here are some pointers that can improve the scheme:</p><ol><li><strong>Default estimations: </strong>There should be a mechanism that can project the probability of default and with that what plan should suit them and lead to the lowest default risk. The scheme should also allow for the users to increase or decrease their returns. In other words, the scheme should relax the stringent constraints.</li><li><strong>Commodity Backing: </strong>As most of the customers would be related to the contingencies of an environmental phenomenon they should be provided aversion in case of droughts, floods, etc through easing the early withdrawal policy.</li></ol><p>The application of the following improvements might nudge them into investing.</p><p><strong>References</strong></p><p>[1] Choi, James, David Laibson, and Brigitte C. Madrian (2005) “Are Empowerment and Education Enough? Under-Diversification in 401(k) Plans” Brookings Papers on Economic Activity Volume 2, pp. 151–198.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ae89761c60a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Among Us and Game Theory]]></title>
            <link>https://kaustubh-q.medium.com/among-us-and-game-theory-f74c8ac9f05?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/f74c8ac9f05</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[game-theory]]></category>
            <category><![CDATA[among-us]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Tue, 20 Oct 2020 07:35:35 GMT</pubDate>
            <atom:updated>2020-10-25T04:52:14.328Z</atom:updated>
            <content:encoded><![CDATA[<h4>A game-theoretic explanation for Among Us</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J65pEonuazWL2_7_ROm8Ww.jpeg" /></figure><p>Gamer or Not a gamer you’d know the incredibly popular mobile/PC game Among Us. The game has a sheer monopoly over the YouTube gamer community, at the time of writing this, 8 out of 10 trending videos in the gaming subsections of YouTube feature Among Us. The biggest creators on platforms like Twitch and YouTube have jumped on the Among Us bandwagon, playing with their fellow creators in turn skyrocketing the game’s popularity. Even mainstream creators like James Charles, KSI, and many more have sought to capitalize on this movement. One of the reasons for its popularity is that the ideology behind it is quite novel, a player has to use strategy more than skills, which doesn’t require long hours, so getting the grasp of the game and being quite decent at it wouldn’t take as much time as other competitive games such as CounterStrike or Fortnite. Most of the games that have survived the test of time are incredibly strategic and require the use of the mind more than tactile agility like Chess, Go, Uno, Poker, etc. Coincidently most of these games use Game Theory or can be explained by game-theoretic tools, the focus of this piece is the same, explaining the game Among Us using Game Theory. The article itself is divided into sections, the first, a brief overview of the game itself, second, a refresher on game-theory, and finally Among Us with Game Theory.</p><h3>How Does Among Us Work?</h3><p>This one is for the misanthropes of 2020, the game starts in a lobby of ideally 10 players, the players get divided into 2 categories randomly: crewmates and imposters. The population of crewmates is larger than the population of the imposters which range from 1 to 3 in a game. The host of the game gets the liberty of choosing the overall structure of the game (this is important, we’ll circle back to this) which includes tasks, player movement, kill distance, and much more. Anyways, just before the game starts you’ll get to know which group you belong to crewmate or imposter. Initially, all players start in the <em>Cafeteria, </em>which contains a red button for emergency meetings which can be triggered only a limited number of times in the entirety of the game. Now, for the Crewmates to win they have two options, first, to repair the ship or to figure out the imposters, as for the imposters they can win only by killing the entire crewmate team. This is the initial premise of the game, an assist for the imposter team is the “sabotage” feature, where they can sabotage different parts of the ship just to create distractions and adding more repairs for the crewmates team. Hence the team that achieves their goal first wins. The game itself has some tidbits that assist either of the teams, the players can view the locations of fellow players using the admin map but they wouldn’t know exactly who it is, an imposter can hide or travel to certain locations using vents.</p><p>As you can probably see that advantage to a group is balanced with either with a disadvantage to the same group or a similar advantage to the other group so as to make the competition fair. Also, the visuals of the game work on the principle of ray-casting, which restricts the vision of a player making it more realistic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/27/0*yXcczeWHnQ-cW18l" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*MJAtvOau7SB80std" /></figure><p>Now when an imposter kills a crewmate, a fellow crewmate can report the body to call for a vote where all the players collectively decide who the impostor is and eliminating the same, an imposter after killing also has a choice of reporting himself, the motive behind the same is deception as other players first tend to listen to the person who called in the vote and if the imposter is able to make a compelling argument here they are virtually safe from elimination. The voting part of the game itself can be considered as a game (subgame, this will come in the Game Theory part), this is the chance for the crewmate team to eliminate one of the alleged imposters, the decision of elimination is ideally discussed through discord or built-in message exchange, the discussion entails pointing fingers on suspects and those suspects trying to deflect or deny the accusations made. Once the vote is cast, the person who gets the most amount of votes as a suspect gets eliminated, and the next round starts and goes on until the whole imposter team has been eliminated or the crewmates have finished their task or the imposter team has killed off the entire crewmate team. This was the gist of the game, we will get into the nitty gritties in due time.</p><h3>Basics of Game Theory</h3><p>If you are a movie fanatic you might remember Game Theory from the Russel Crowe movie “A Beautiful Mind”, if you haven’t watched it I highly recommend it, great cinema. It’s a biography on mathematician <a href="https://en.wikipedia.org/wiki/John_Forbes_Nash_Jr.">John Nash</a> one of the greatest minds of the 20th century, but he wasn’t the one at the birth of this field. It started with Plato when he described the Battle Of Delium in his piece <a href="https://en.wikipedia.org/wiki/Laches_(dialogue)">Laches</a>, the first mathematical formulation was done by John von Neuman, where non-mathematically speaking we can always find an equilibrium in a finite two-player game(I will define all these buzzwords, don’t worry) and John Nash who proved that equilibrium exists even in an n-player game. In this article, our focus will be on John Nash’s contributions as Among Us is a multiplayer game, we will also look into groups and game theory. I wouldn’t dive very deep into the mathematics of things as I want to keep this interesting for readers who have a high school mathematics background. And there is no way anyone can fit even the basics of Game Theory in an article, but I’ll try my best not to deviate from the topic and keep it short. So let’s start with some very basic definitions:</p><p><strong>A Game</strong></p><p><em>A game in a very “non-gamer” sense is a situation whose results depend on the actions of the parties involved.</em></p><p>Let’s break it down. The parties involved are called <strong>players</strong>, these are the entities that take <strong>actions </strong>that affect the state of the game. Now, why are players even interested in taking an action, well they’ll get a <strong>reward </strong>if they take an action that benefits himself/herself. This reward is defined by a <strong>utility function or payoff function</strong>, which is just a mapping of the actions of a player to a real number. So a finite n-person game is a tuple with <em>(N, A,u) </em>where <em>N</em> is the number of players, <em>A</em> is the action set(the set of all actions that will be taken by any player, you can also call it action space) and <em>u</em> which is the utility function. Mathematically this can be expressed as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/27/0*IZyqBrpKYUkUZEDr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*SC74vxLpM3ItDJmA" /></figure><p>I’m borrowing this from one of my previous articles: <a href="https://medium.com/cantors-paradise/implications-of-cheating-in-a-relative-grading-system-6435163be88b">here</a></p><p>Now that we have a naive understanding let’s look at the things that actually matter. We know that a player gets a reward for playing a good strategy, so the goal is to maximize the utility function by using the actions available in the action space, now if I know or have some intuition on what the other players will do, I can tailor my actions in order to get the highest utility, this is known as <strong>Best Response,</strong> which basically is the means that the reward I will get by playing the best response action is will be greater than any other possible set of actions. So, to understand this in a more mathematical sense,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/27/0*J52sbveopg4wfcGe" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/0*tSj3H2OprFn52mLW" /></figure><p>Please don’t get intimidated by the symbols</p><p>If every player plays his/her best response, we achieve a <strong>Nash Equilibria. </strong>Another common phrase in Game Theory is a <strong>zero-sum game</strong>, which basically means that the benefit of one group corresponds to the loss of the other group.<strong> </strong>Now that we have some sense of the words of Game Theory let’s make sentences.</p><p>If we do a high-level glance on Among Us, there are groups in place of individuals: imposters and crewmates, but individuality exists between the crewmates, by this statement I mean that crewmates do not know any information about the other players hence for them the situation would count as an <strong>imperfect-information game</strong>. But for the imposter group, it is a <strong>perfect information game</strong>.</p><p>Let’s now look at multiplayer games, these games are just an extension of two-player games for example the prisoner’s dilemma is an example of a two-player game, in which the players either cooperate(snitch on the other player) or defect. Visually the matrix looks like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/27/0*9aay8GHx1HBs-eXd" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/0*kloGeGs_4c7-Xfay" /></figure><p>The numbers in the matrix represent the years each player has to spend in prison, if we look at Bob, if he decides to cooperate, he can either 3 years or zero years rather than 5 and 1 year if he decides to defect, hence he will choose to confess same goes for Alice as the matrix is symmetric, hence the Nash Equilibrium in this situation is for both the player to confess and the dilemma here is that both could’ve gotten a shorter sentence if they both defect, but that state would be more unstable that the confession state. This is a very small-scale example and there are only two players. Hence we need to generalize our definitions for n-players who are divided into two groups.</p><p>Before we do that there we need to investigate more into the concept of cooperators and defectors, especially in an n-player game. Also, we need to redefine Equilibria, as with the increase in the number of players it gets harder and harder to find a Nash Equilibria also games with infinitely many strategies might not even have an Equilibrium, and Among Us is one of those games where there are a lot of strategies both at an individualistic level and at the group level.</p><p><strong>A Viable Nash Equilibrium</strong></p><p>It’s quite trivial to state this but for most economic problems finding a viable equilibrium is more important than finding equilibria at all. But what does a viable equilibria mean?</p><blockquote>The Equilibria should be focal amongst the players ie. with experience they know if they adopt the strategies that this equilibrium entails they might win.</blockquote><p>Hence if a new equilibrium is introduced in the game, it should pass 2 tests, one the <em>sustainability test</em>, in which while adopting the new equilibrium strategy the players of both groups have equal chances to win, and second the <em>formation test</em>, equilibrium should have a realistic chance to be a focal strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*tYBtsbvBr9-p025u" /></figure><p>Here n is the total number of players, this means a player either deflects or follows an underlying strategy. This is very important for understanding why players might deflect from the herd mentality.</p><h3>Game-theoretic explanation for Among Us</h3><p>In order to avoid chaos in this section, I will divide this into 3parts, first will be about the two teams crewmates and impostors, the second will be about the voting subgame and finally, the third would be my very generalized closing arguments. Before we start, I’m just putting it out there, Among Us is a zero-sum game, and I encourage you to figure out why.</p><h3>Crewmates and Impostors</h3><p>Crewmates have the monopoly when it comes to population, in a vanilla game(10 players, 3 imposters, 7 crewmates), if you are a crewmate the probability of a random player being a fellow crewmate is 0.66 which is high but not quite. For now, we’ll ignore the individuality of the players and look at crewmates as a team, let’s first figure out the payoff matrix as we saw earlier in Prisoner’s dilemma.</p><p>Before conjuring a matrix, I would like you to give some pointers on how the matrix is logically sound:</p><ol><li>The matrix has two teams crewmates(left) and impostors(top), the crewmates can either do a task(Tsk) or try to figure out who the impostor is (Imp) and the imposter team can either kill crewmates(Kill) or sabotage to create distractions or win(Sbt).</li><li>The payoff of the crewmate team on finding the impostor when the impostor team is out to sabotage is 2 and 5 when the impostor team is out to kill, the reason for this distribution is that it is easier to find someone red-handed when they aren’t creating distractions opposed to catching someone amidst the chaos.</li><li>The payoff for the crewmate on doing a task while the impostor team is just focussed on sabotaging is 6 and 2 when the impostor team is explicitly out to kill, again the reason is that completing a task while murderers are at loose is harder.</li><li>Similarly for the impostors, killing while the crewmate team is trying to complete tasks gives a payoff of 5 and a payoff of 3 when the crewmate team is out on the lookout for killers.</li><li>And finally, the payoff for sabotaging when crewmates are doing their tasks is 4 and 5 when they are out on the lookout, as when the crewmate team is already doing tasks, adding one more task won’t put them underpressure compared to sabotaging when they are out on the lookout.</li></ol><p>Hence the matrix would finally look like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/27/0*fCmcuAsDXFpc7T4d" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/0*TmaI6V-yieXlUuK9" /></figure><p>The numbers are just arbitrary, the easier the job higher the payoff.</p><p>Now, let’s try to find the dominant strategy for the crewmate team, if the crewmate team does the tasks their payoff can either be 6 or 2, but if they investigate to find the impostors their payoff will be significantly higher, ie. 2 or 5 hence the<strong> dominant strategy for the crewmate team</strong> will be in completing their tasks. Similarly, let’s look at the impostor team if they just sabotage their payoff will either 4 or 5 but if they kill their payoff would be somewhat smaller ie. 5 and 3, hence the <strong>dominant strategy for impostors</strong> is to win by sabotaging. Making the top left column our <strong>Nash Equilibria</strong>. But if you’ve played the game how boring both of them are, yet it even holds good when some of the crewmate members have died, and we haven’t even looked at individualistic decisions yet. This is what causes the deviations in this game, individualistic benefit rather than group benefit. The individualistic goal being not to die for the crewmates and finding the impostor and killing for the impostors, both deviating from the Nash Equilibrium. The individualistic goal isn’t for winning but for keeping things “interesting”.</p><p>We can look at this problem from a different angle too if we assume that all players were to play a strategy π which yields the win for the crewmate team. The people who are destined to lose if they deviate from π would be the crewmate team, hence D(π) = 7 and from equation 1, we get F(π) = 3. Now in our game, we can assume the rate of decay for D(π) is greater than the rate of decay for F(π). For the sake of a simplistic discussion we’ll look into 2 cases:</p><ol><li>The rate of decay for F(π) is 0, ie the number of impostors don’t change over time, this means that either impostors are good at killing or both impostors and crewmates are living in harmony(this is boring and extremely unstable) or impostors are good in putting the blame on someone. So as impostors start killing off the value of D(π) will depreciate which means the ability to sustain the π-equilibrium will fall, and the game will switch to let’s say π’, which is the winning strategy for the impostor team. Makes sense right if the impostors kill, the game will switch to their favor.</li><li>Now let’s say the rate of decay for D(π) is 0, ie. the number of crewmates don’t change, here the things get interesting, this might be because they are either very good at pointing out who the impostors are(reducing F(π)) or they move in groups making it hard for impostors to kill or even majority of members of the crewmate teams are skipping their votes leading to ties(we’ll come back to this). If crewmates are good at spotting the killers they are essentially depreciating the value of F(π), which would make the strategy π even stronger.</li><li>But realistically things aren’t as vanilla, we’d usually have a tradeoff between the two, and the one which is higher, in the end, might win. Also, this brings out the concept of a <strong>mixed strategy</strong>, where a group regularly changes their strategy in order to fool the opponent, making a probabilistic distribution, this means that in one round the impostors might be out to kill and sometimes they might focus on sabotaging. We will not indulge in this, it will only complicate things more.</li></ol><h3>The Voting Subgame</h3><p>Voting is possibly the most important part of the game, the reason I say this after proving that for both groups are better off doing their in-game tasks(tasks for crewmates and sabotaging for impostors), is that this is the only way the crewmate team can have a speedy victory. For the crewmate team, this is the second hurdle, first being not to get killed by the impostor team, but for impostors, this is the only hurdle, this is the only way they can be eliminated so the stakes are high for both the teams. Voting itself has a very simple premise, a player can either vote to kick a player or skip their vote. Voting can be called only if someone has reported the body or pressed the emergency button. In order to make this discussion uniform, we’ll first consider voting when a body gets reported.</p><p>Let’s see a payoff matrix, this one is quite different from the ones we saw above but this is actually more clearer as it involves only 1 group at a time.</p><ol><li>This is the payoff matrix for an individual of the crewmate team. So, in the first call to vote after someone’s death, the probability of a fellow player being an impostor is 0.375 (3/8), so if the crewmate, we’ll call him Bob, votes and the person was the impostor he and the whole team gets a payoff of 2, for successfully eliminating an impostor, but Bob votes and it turns out they eliminated crewmate, it’s going to cost them as they reduced their own population and an impostor managed to bypass a voting round. The same goes for skipping the vote. If we just look at probabilities Bob’s guess at finding the impostor would be right almost 40% of the time. But it’s not just a game of probabilities, players converse and everyone has a chance to explain who they think is the impostor.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/0*EzceUDK4KwEvBfLe" /></figure><p>2. The payoff matrix for the impostors is very simple, they already know who the crewmates and the impostors are, hence their only job here is to divert the players from attacking their team. Hence if they convince players to vote against someone who is not an impostor they get a payoff of 2, as they have successfully eliminated a member of the other team, but if the skip then it wouldn’t affect them at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*A334zmJvrtdtVu1x" /></figure><p>3. I hope the above 2 matrices made sense, if we combine the two, the <strong>dominant strategy for the Impostor</strong>, would be to vote, though for the crewmate team the dominant strategy is to <strong>skip</strong> as they incur less of a loss. But <strong>no Nash Equilibria exists</strong>. So crewmates should skip voting but only till the point impostors can’t caste the majority vote.</p><p>Though I can get more into the voting part, I feel like this is more based on human interactions than game theory, we already know the dominant strategy for both the teams but, they would just yield an infinite game, here is where the individualism comes into play. The crewmates are not playing a team, so they are unaware of what other players are doing, this uncertainty brings out the selfish side, all the crewmates want is to survive and play the next round, which might make them gullible and prone to fictitious play. So my advice to the crewmate team would be to play your dominant strategy till you have substantial certainty.</p><h3>Closing Statements</h3><p>Some things that I skipped over but play an important role in the game,</p><ol><li>The complexity of the crewmate task.</li><li>The Admin Map for the Crewmaes aid.</li><li>Vents for the impostors.</li><li>The significance of the emergency button.</li><li>The hierarchy of the sabotage moves.</li></ol><p>One of the most interesting things, in the game settings, is the “Confirm Eject” feature, if this is checked at the beginning of the game, after every round of the game if someone is ejected, the players get to know whether that player was an impostor or a crewmate, now if this feature is enabled, an individual crewmate has some knowledge about the probabilities, but if this feature is disabled, the crewmates virtually have no knowledge and the probabilities mentioned would just be valid for the first round, and then will become stochastic themselves, this is way out of scope for this article.</p><p>Finally, if you like it or not these are the dominant strategies for the players. These were derived assuming that players behave as a group rather than individuals.</p><h3>During Gameplay</h3><ol><li>Crewmate: Finish all tasks rather than trying to find the impostor.</li><li>Impostor: Winning by sabotage.</li></ol><h3>While Voting</h3><ol><li>Crewmate: Skipping Votes(till certainty).</li><li>Impostor: Voting for a random Crewmate(no skipping and definitely not voting for a fellow impostor)</li></ol><h3>References</h3><ol><li><a href="https://econ.biu.ac.il/files/economics/seminars/viable_nash_oct_10_19.pdf">https://econ.biu.ac.il/files/economics/seminars/viable_nash_oct_10_19.pdf</a></li><li><a href="https://link.springer.com/chapter/10.1007/3-540-44683-4_3">https://link.springer.com/chapter/10.1007/3-540-44683-4_3</a></li><li><a href="https://d1wqtxts1xzle7.cloudfront.net/43598110/hobbits-sg.pdf?1457645574=&amp;response-content-disposition=inline%3B+filename%3DCollaborative_games_Lessons_learned_from.pdf&amp;Expires=1603121327&amp;Signature=LR9frOtfzD2OjGYC143tc-2E3AR0BwHDPLy61wLSeGGcdnhRvKMCqz0YJysiZ0vi~fSbt2IpWRkm4hBABP8Lyw4BnxGCLo3mzPxbPrrVckXk04tAieKbIBZfdIsbeJ6i4K9m7NQswH0sqyetknihsQ0BsGplLJKHHZ~OCJdyANWgRmhRMcTJseLQrbvdhbPyjWWX6ITJJjUCvMMhT4ZbyhVq0roIRVHauIBzCZ7hcgMxfaWHKYwAvbYYUzi50eDzBaBMVTNHa4FbEW2zbY2Hyz2zIT9KKt4LRzDA2-wJyNNbenz-x3vY-NQVrgRle3M92UY0Q4b8cMvirDy-XEsVWg__&amp;Key-Pair-Id=APKAJLOHF5GGSLRBV4ZA">Collaborative Games</a></li><li><a href="https://journals.sagepub.com/doi/abs/10.1177/002224378502200303">https://journals.sagepub.com/doi/abs/10.1177/002224378502200303</a></li><li><a href="https://journals.sagepub.com/doi/abs/10.1177/002224379603300301?journalCode=mrja">https://journals.sagepub.com/doi/abs/10.1177/002224379603300301?journalCode=mrja</a></li><li><a href="https://www.nobelprize.org/uploads/2018/06/nash-lecture.pdf">https://www.nobelprize.org/uploads/2018/06/nash-lecture.pdf</a></li><li>An online tool to find out Nash Equilibria in a 2x2 payoff matrix, <a href="https://mindyourdecisions.com/GameSolver.html">here</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f74c8ac9f05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability and Borel Sets]]></title>
            <link>https://www.cantorsparadise.com/probability-and-a-little-of-borel-sets-a9bdcd7be26c?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9bdcd7be26c</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[math]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Sun, 30 Aug 2020 05:17:10 GMT</pubDate>
            <atom:updated>2020-08-30T10:11:42.116Z</atom:updated>
            <content:encoded><![CDATA[<h4>On the modern definition of probability</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qWgRk64Kv8oNqmGn" /><figcaption>Photo by <a href="https://unsplash.com/@mparzuchowski?utm_source=medium&amp;utm_medium=referral">Michał Parzuchowski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>There are a lot of reasons why I’m writing this, one of them is I could never understand Borel Sets, I got introduced to them on day one of my adventures in Probability Theory, there was something about the way it was portrayed, it didn’t make sense to me, like at all. So I broke it down into subconcepts, which I tried to tackle, but still nothing. There was nothing intuitive about them, or at least I couldn&#39;t see it. So, I skipped over it, which by the way you shouldn’t do, but it&#39;s almost helpful sometimes. But, I came across it again, sometime back when I was reading about Joint Probability Density Functions, so I investigated it. A couple of pointers before reading, you will need a good knowledge of probability at least high-school probability, a good grasp on set-notations. I apologize for switching to LaTEX quite often, it’s just easier to write math there also grammar mistakes, sorry about that.</p><h3>What Is Probability?</h3><p>If you read any literature on probability theory with the definition of probability you learned in high-school, you won’t get anywhere just because it is way too simple and shallow, to encapsulate the actual meaning of probability, now I’m not saying it’s wrong or anything, but with the definition which I will provide in this section, we can easily generalize it to anything you want.</p><p>So let’s start, for now, forget the definition of probability you know, we will start from the basics, which are made up of two things a Sample Space and an Event Space.</p><p><strong>Sample Space</strong>: It is a collection of sets containing all the possible outcomes of an experiment. It can be finite(tossing a coin 2 times) or infinite(tossing a coin till a head shows up).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*SdPd7QZc9w1ZMCA91FwWng.png" /></figure><p>Now, these were examples of a discrete sample space, and surely you can imagine a continuous sample space as well but continuous here means that there is a range of possible outcomes, but an outcome can only be one. For example, the height of human beings, so as much as data you collect height of a human can only have a feasible range, like from 2 feet to 8 feet. But for this piece, you just need to understand discrete Sample spaces, that’s it.</p><p><strong>An Event:</strong> It is the subset of the sample space, to which we assign a probability measure, I know I haven&#39;t defined a “probability measure” so for now, we will define an event as an outcome that we are interested in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*4HaVGlZMxcAmZeImTXDXDQ.png" /></figure><p>Now that we have some knowledge about the things we are working on, we can introduce some entities that will aid us in understanding the space we are working in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*9GF0C1qclBRkgXZBdtv3TA.png" /></figure><p>This is called an algebra, I know very misleading, but it’s formally called that so can’t do anything, but you can see we are describing these rules for a new collection. So let&#39;s formally define an algebra.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*xSX4l0Wev1e4OHy0pqOEbQ.png" /></figure><p>So we can call an arbitrary collection is an algebra if it follows the above three rules. And there are a lot of inferences that you can gather from these rules, one of them is that the algebra is closed under finite union and intersection, and I encourage you to think about why that is true. But just defining an algebra isn’t adequate, let’s take the second example, we cannot define the event A, which is the set that contains even number of tails preceding the head just by performing finite union or complements, we need to scale the union from finite to infinite. This introduces the notion of a σ-algebra. The description of a σ-algebra is the same as the definition of algebra, but with one key difference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*RVzz0jyqvD1s2ZD2mDWGlw.png" /></figure><p>Also in rule 3, the number of A’s should be finite, only then we say σ-algebra is closed under countable infinite union.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*ysC4d94AnAka4d1uQRAooQ.png" /></figure><p>So now if we have a power set, and Ω is countably finite or countably infinite we can assign a measure to each ω the belongs to the events, an example of countably finite power set is tossing of coins, and an example of an un-countably infinite set is the range of [0,1]. Read <a href="https://en.wikipedia.org/wiki/Countable_set">this</a> for more information on countable sets.</p><p>So now that we know we can assign a measure on a countably finite set, so let’s do that. But before we do that we need to look into some measure theory. I won’t go into much depth on this because it is out of scope for the article and frankly I don’t know a whole lot about it. So the only thing we require here is the notion of a measurable space. The definition of a measurable space stems from σ-algebra itself, so a pair (X, F) is called a measurable space if X is a set and F is the σ-algebra of the subsets of X. In our case, (Ω, F) is a measurable space, hence we can define measures on it. So the definition of a measure is as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*fAYpdE4y-Ra8TRKYGx9K2g.png" /></figure><p>Now if you look closely, we are mapping our σ-algebra to the Real number line, and it satisfies the given two rules. Another observation is that this looks very similar to the rules of probability you might have studied. But before we jump to that, let’s break the above statements down. So it is evident, f(ϕ) = 0, so it is only fair to ask what will f(Ω) be, and it might be anything finite or infinite, we can’t make an assumption on that.</p><p><strong>But if f(Ω)=1 we can say that now our function maps our “interesting” subsets to the domain [0,1] and “f” is now termed as a probability measure</strong>.</p><p>So now let us formally devise the probability measure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*YTQDf_SOwnsZGxA5mNhOXQ.png" /></figure><p>This is the actual definition of probability by the modern probability theory. After identifying these rules we can go on deriving other <a href="https://www.rapidtables.com/math/probability/basic_probability.html">inferences</a>. Now that we have formalized the actual definition of probability, we can actually move on to the cream of this article.</p><p>Let’s talk a little bit about discrete probability spaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*xqcq-qwVI_cYkJ7rQmQ8Qw.png" /></figure><p>Assigning probability measures on discrete probability spaces is quite simple, for example, we will look at two cases, one of finite Ω and the other of countably infinite Ω.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*ONnZuACRxXzFjWo2a-qTbA.png" /></figure><h3>Borel Sets and Modern Probability Theory</h3><p>But for uncountable Ω, it’s not as simple. So the classical example of an uncountable set is the interval of [0,1], which hs infinitely many points within it. Also, it was proved by Cantor’s Theorem that the cardinality of the elements between 0,1 is much greater than the number of natural numbers. This is the reason why we cannot assign a probability measure to singleton, as it will always tend to zero, and even if we want the probability of [1/2,1] that’s impossible too as we can only take union under a countable set.</p><p>So as to define a uniform probability measure over [0,1], we just assign probabilities to the subsets of Ω we find interesting instead of assigning probabilities to singletons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*9Zt-cPHI3w73OWvigELKMA.png" /><figcaption><a href="https://arxiv.org/pdf/1703.08101.pdf#:~:text=The%20probability%20measure%20%CE%BB%20on,points%20of%20the%20action%20%CF%84).">Link for transitional invariance</a></figcaption></figure><p>So as stated through impossibility theorem, we need to somehow shorten our sigma-algebra, so as to define probability measure on an uncountable Ω. We do this by assigning a probability to the sub-intervals of [0,1] which can be closed, open, open-closed, etc but this won’t form a sigma-algebra as it wouldn&#39;t be closed under complementation.</p><p>So now our goal is to generate a sigma-algebra, that contains the intervals we are interested in and is the smallest possible sigma-algebra. So,sigma-algebra containing all open intervals is termed as <strong>Borel Sigma Algebra </strong>and the elements of algebra are called <strong>Borel Sets. </strong>We can prove that Borel Sigma Algebra is the smallest possible algebra containing the sets we want. Hence Borel sets and Borel sigma-algebra have extreme utility when it comes to uncountable sample space.</p><h3>Conclusions</h3><ol><li>Probability theory is a special case of measure theory</li><li>Probability is a function that projects events onto a number line</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9bdcd7be26c" width="1" height="1" alt=""><hr><p><a href="https://www.cantorsparadise.com/probability-and-a-little-of-borel-sets-a9bdcd7be26c">Probability and Borel Sets</a> was originally published in <a href="https://www.cantorsparadise.com/">Cantor’s Paradise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implications Of Cheating In a Relative Grading System]]></title>
            <link>https://www.cantorsparadise.com/implications-of-cheating-in-a-relative-grading-system-6435163be88b?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/6435163be88b</guid>
            <category><![CDATA[game-theory]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[grading]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Thu, 20 Aug 2020 00:13:55 GMT</pubDate>
            <atom:updated>2020-08-25T10:07:53.261Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Distributions and Game Theory</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PMKeoCMSpE4rn0Xo" /><figcaption>Photo by <a href="https://unsplash.com/@aleksdorohovich?utm_source=medium&amp;utm_medium=referral">Aleks Dorohovich</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A couple of things before we start, I’m not writing this as an attack, these are just personal view based on some facts. I’ll be using a little bit of math in the part of Game Theory nothing too crazy, I think if you have studied class 12th math you’ll understand it. And finally, please ignore the typos(yes I did use Grammarly).</p><h3>What is Relative Grading?</h3><p>The concept of Relative Grading is quite an old one, not sure when it was actually introduced but the papers referencing it go back to the 1970s <a href="https://eric.ed.gov/?id=ED136436">here</a>. There are quite some reasons why it exists, one of them you might have thought of is the growth of the student population, which correlates to either having bigger classes or having multiple sections for the same course, which would require more teachers, and teachers have different metrics and strategies for grading an answer, which leads to unfairness between the different sections of the same course, relative grading will normalize the variations and put everyone at plain-level field. Another reason is the incentives and the competition, I will go into some depth with this word “incentive ” but to explain it in simple terms, relative grading induces a competition, in the sense that to get a good grade, you’d need a “good” overall score and be better than rest of the class.</p><p>Let’s look at an example, now these data points do not represent a real scenario, but they capture what the distribution of marks would look like. Now if you know a bit of statistics, this looks like normal distribution and it is, the most common type there is. If you need a refresher on distributions <a href="https://www.krigolsonteaching.com/uploads/4/3/8/4/43848243/lyon-normal_distributions.pdf">this </a>is a really good resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*ajMsa2b8odo80YT9l63F2A.png" /><figcaption>The X-axis represents the scores of a sample of 500. Mean = 15, Standard Deviation= 6</figcaption></figure><p>Now the reason why I personally used a normal distribution is that they sum up the situation really well, right? You have some people who score really well and some who score really bad and the rest are kind of in the middle.</p><blockquote>The running assumption in this article is that the tests are fair, which means that there are no errors in the questions and the teacher grades the papers without any bias.</blockquote><p>Let’s say, we were to give a grade based just based on this performance. And I will be using the Relative Grading System. The formula for calculating a relative grade is quite straight forward, it only differs in what <a href="https://en.wikipedia.org/wiki/Academic_grading_in_Japan">grading system </a>you are using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*bL-oS7crL9JIzq0hJ7u73A.png" /><figcaption>So if you are in a Japan grading system A+ translates to S, A translate to A, and so on.</figcaption></figure><p>Now let’s see how our program based students performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*tOp48EWhdSZW1MhUncUT7w.png" /></figure><p>I’d say pretty good right, the majority got A and B, and then we have the 20 or so super nerds who got the S, remember this is out of 500, so if you assume the class size to be 60, the people who got an S will be in the range of 3–6 and so will be the F’s. Now, this does prove that in order to get the best grade you have to be better than the rest but the data in practice isn’t as beautifully distributed, it would probably be a skew-normal distribution which would look like this because believe it or not scoring below 10 on a 30 mark exam whose average is 23, is pretty hard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*hjLkWLvX7OEM5O7qFRaM0A.png" /><figcaption>Mean: 23 and Standard Deviation: 5</figcaption></figure><p>And here are the grades.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*C7NFG7H63TD-U8BXb-xiBg.png" /></figure><p>So it is quite apparent that as the mean increases the number of S grades decreases and the distribution becomes more centered to B. And it&#39;s this result which directs the sentiment behind this article.</p><h3>Game Theory And Exams</h3><p>Game Theory, if you are a movie fanatic, you might have watched Russel Crowe’s “A Beautiful Mind”, which good film but modern cinema has this thing that a story has to be dramatic to be good, so for the people who haven&#39;t watched it now you know what to expect. A little about the field itself: It started with Plato when he described the Battle Of Delium in his piece <a href="https://en.wikipedia.org/wiki/Laches_(dialogue)">Laches</a>, the first mathematical formulation was done by John von Neuman, where non-mathematically speaking we can always find an equilibrium in a finite two-player game(I will define all these buzzwords, don’t worry) and John Nash who proved that equilibrium exists even in an n-player game. In this section, I wouldn’t dive very deep into mathematics(some), we’ll keep it philosophical and the field of Game Theory is extensive, there is no end, mathematically and definitely not philosophically, so I encourage you to read more about it, and appreciate it’s beauty in mathematically addressing human psychology.</p><p><strong>What is a Game?</strong></p><blockquote>A game in a very “non-gamer” sense is a situation whose results depend on the actions of the parties involved.</blockquote><p>Let’s break it down. The parties involved are called <strong>players</strong>, these are the entities that take <strong>actions </strong>that affect the state of the game. Now, why are players even interested in taking an action, well they’ll get a <strong>reward </strong>if they take an action that benefits himself/herself. This reward is defined by a <strong>utility function or payoff function</strong>, which is just a mapping of the actions of a player to a real number. So a finite n-person game is a tuple with <em>(N, A,u) </em>where <em>N</em> is the number of players, <em>A</em> is the action set(the set of all actions that will be taken by any player, you can also call it action space) and <em>u</em> which is the utility function. So let’s formulate them mathematically</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*8tt3vdNqsoPEDhlWQJuLZg.png" /><figcaption>I have no idea how to type these here so I had to type it in LaTEX and paste them here.</figcaption></figure><p>Now that we have a naive understanding let’s look at the things that actually matter. We know that a player gets a reward for playing a good strategy, so the goal is to maximize the utility function by using the actions available in the action space, now if I know or have some intuition on what the other players will do, I can tailor my actions in order to get the highest utility, this is known as <strong>Best Response,</strong> which basically is the means that the reward I will get by playing the best response action is will be greater than any other possible set of actions. So, to understand this in a more mathematical sense,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*346JP98ca8JdopGXSK-GOQ.png" /></figure><p>I hope you are still with me, it’s all philosophy from now on I promise.</p><p>If every player plays his/her best response, we achieve a <strong>Nash Equilibria. </strong>Ok, if you paid attention till now you can probably imagine how Nash equilibria can be used to define human behavior in competitive environments. Although Nash Equilibrium has lead to tremendous success in economics specifically in <a href="http://web.mit.edu/6.454/www/www_fall_2004/gametheory/VettaNashEquilibria.pdf">competitive markets</a> and auctions, it is not limited to that we can see the use of game theory even in <a href="http://www.ens-lyon.fr/DI/wp-content/uploads/2009/07/Chapter-28-Game-theory-and-evolutionary-biology.pdf">biology</a> and <a href="https://www.sciencedirect.com/science/article/abs/pii/S0360131510000527">education</a> which we will discuss in the next subsection.</p><h4>Exams</h4><p>As we saw game theory can be used in a competitive environment, so let’s start and break down exams, into the components we saw in the previous section.</p><ol><li>Players: You are a player, I&#39;m a player and other students in the class are players</li><li>Reward: Marks, Marks, Marks***</li><li>Action: Marking an answer.</li></ol><p>Now this feels very ambiguous right? Marking answers will help me score well but how me marking an answer is affecting the other student, and where does the concept of best response fit into this. Well, first-off this will only be valid for a relative system(I will explain the absolute system as well) so if the majority of the players mark A as the answer but the correct answer is B and you mark B then this is your best response, but in this case, you don’t know what the other players are doing and thinking, so you have to play for yourself without the knowledge of the strategies of other players, and there is a term for this but if you think hard about it, you can assign a positive probability to the possible set of answers, this is also called <strong>Pure Strategy. </strong>So now that we have formalized exams that are relatively graded are games let’s see how rewards and incentives work.</p><blockquote>In an absolute graded system, the players are independent and the actions of one player don’t affect the state of the game or any other players.</blockquote><p>Now the goal of every player is to perform its best to reach the Nash Equilibria, in an exam if everyone performs for the maximum utility the mean of the class would by 30 and the standard deviation would be 0 and the whole class will get an F.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*czTU0XTTyPy7i96HiLnE3w.png" /><figcaption>Of course, the utility here is Marks and not the grade</figcaption></figure><p>And just in case you are wondering it is impossible that a whole class gets an S, I encourage you to work it out. So one inference you can make the incentive to perform isn&#39;t marks, its grades.</p><h4>Cheater Cheater!!</h4><p>Again I’m not writing this because I’m pissed about people cheating like crazy in a 30 marks MCQ test, I just want to enlighten them about the repercussions of their actions.</p><p>So let’s say you got the question paper and you start solving it and you are pretty confident about your capabilities so you know the answers you marked are correct. In the last 20min of the quiz you open telegram or WhatsApp where people have shared their answers, now you know exactly what other players are doing, and your task is the give the best response which is the correct answer. By now, one of thee things is happening:</p><ol><li>Your answers exactly match with the answers of other players</li><li>Your answers somewhat match the answers of the other players</li><li>Your answers are totally different from the answers of other players</li></ol><p>If you are in the first situation, you wouldn&#39;t change your answers because of the <a href="https://en.wikipedia.org/wiki/Bandwagon_effect">Bandwagon effect</a>. In the rest, you might. So in order to give what you saw was the best response you change your answers. Again two things happen,</p><ol><li>The answers were right and you get 30 on 30</li><li>The answers were wrong and you lost marks</li></ol><p>If you analyze the first situation it is pretty bad as well, almost like the fruit of a poisonous tree. And you know why because the mean would shift very close to 30 and the standard deviation would be low as well and hence you will get a graph like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DGHp4ZU75yFenpak0D1AEQ.png" /></figure><p>And the curve for the grades will look like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*PFJHvgqUkRtrOvgpg8-6TA.png" /></figure><p>Looks seeming normal right, except it’s not. To get an S you absolutely have to get a 30 and to get an A, your score should be between 28.5 and 29.5 but its MCQ right so you gotta round that, so having a score between 29 and 30 will get you an A.</p><p>If it is the other way round, you marked the wrong answers and even the other players did, the damage wouldn&#39;t be as significant But if you marked the wrong answers and other players didn’t such that the difference between you and the average is of 5 marks, you’ll either get a C or a D.</p><p><strong>Think about this for a second.</strong></p><p>If you are aware, and you know if you cheat this could happen you’d never cheat right? But as humans, (it’s about to get 100% philosophical now) we would be in a situation where we score more regardless of the performance of others, and here lies that<strong> incentive to cheat</strong>. To make up for the uncertainty we believe anything presented to us. Also if you don&#39;t cheat and everyone else is cheating, after some time even you might succumb to it. This is what the modern education system has done, there is so much focus on marks that we have taken a tangent from actually being open to learning to cramming on a constrained syllabus. But let’s say nobody cheats, the curve would look like Figure 2, and we wouldn&#39;t have the crazy numbers as we saw in the last paragraph and the grading would actually be fair.</p><h3><strong>Conclusion</strong></h3><ol><li>After discussing game theory and statistics I hope you now know what drastic impact would cheating on a test create.</li><li>The education system today is very “marks-centric” that is you can’t get that far if your scores aren’t on point and of course, there are exceptions. But this has created this longing of marks rather than knowledge.</li><li>Cheating on a test, that is relatively graded has disastrous implications, and it&#39;s better not to do it.</li></ol><h3>References</h3><p>All the references are added as links. The code will be provided on request.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6435163be88b" width="1" height="1" alt=""><hr><p><a href="https://www.cantorsparadise.com/implications-of-cheating-in-a-relative-grading-system-6435163be88b">Implications Of Cheating In a Relative Grading System</a> was originally published in <a href="https://www.cantorsparadise.com/">Cantor’s Paradise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discrete and Fast Fourier Transforms]]></title>
            <link>https://www.cantorsparadise.com/discrete-and-fast-fourier-transform-e7f1039c9c14?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7f1039c9c14</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Tue, 14 Apr 2020 00:51:35 GMT</pubDate>
            <atom:updated>2020-04-21T07:10:09.223Z</atom:updated>
            <content:encoded><![CDATA[<h4>Visually and mathematically</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/0*nboQMRcfFX0NZ4SO.png" /></figure><p>I recently started doing some work on audio files and signal processing most of what relies upon the Fourier Series. Now if you’ve taken a Calculus course you’d probably dealt with this. But I think people don’t appreciate Fourier Transform as much it is capable of, although this post will get you started in the right direction for Audio Signal Processing I first want to talk a little more about the power of the Fourier series especially in drawing things because that’s the coolest and then move onto Discrete Fourier Transform (DFT) and Fast Fourier Transform (FFT).</p><h3>Drawing pretty much anything.</h3><p>Well yeah! You can draw pretty much anything when it comes to Fourier Series. So Fourier Series is given by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*mLoSMDVZ5KXH-9zvxRDfOg.png" /><figcaption>Here the interval is 0 to 1 but in books, it’s towards positive infinity from negative infinity</figcaption></figure><p>As you can see that this formula has a complex term <em>j, </em>now most of the formulas you must have seen regarding the Fourier Series are simple (as no complex terms), that&#39;s usually a choice, you can write this equation in terms of sine and cosine but you’ll have to calculate the integral twice rather here you just need one integral but with a complex term so it’s sort of a trade-off. But after reading about Fourier, mostly the complex form is preferred over the simple form and we will be working on this form of the equation only. Now, how do you go from that monstrous (actually elegant) formula to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*HdjntGO9DX3C00Tr.png" /><figcaption>Source</figcaption></figure><p>It’s quite challenging to imagine these things but I’ll try my best to explain, if you are still confused by this I urge you to watch a video by <a href="https://www.youtube.com/watch?v=r6sGWTCMz2k&amp;t=">3Blue1Brown </a>which does a classy job in giving a very detailed description with a stunning visualization. So if you chose to stick with me here we go, imagine a pendulum now if we take the bob from its equilibrium position and raise it keeping the string fully stretched we are giving it potential energy and when we release it&#39;s converting that potential energy to kinetic energy. Simple right! Now imagine a double pendulum, when we had a single pendulum the track of movement was defined but in the double pendulum, it’s totally random. Here the theta is the angle between the principle and the string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*LDLXIu3AJRRafrkZ.gif" /><figcaption><a href="https://www.google.com/imgres?imgurl=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F6b%2F67%2F59%2F6b67598c328c476f536d9749641d4b37.gif&amp;imgrefurl=https%3A%2F%2Fwww.pinterest.com%2Fpin%2F311381761709784307%2F&amp;tbnid=A93Qx-NRF6Am6M&amp;vet=12ahUKEwiYt4L55PfoAhWALLcAHdzsA7QQMygJegUIARDiAg..i&amp;docid=UOwxxTPQpTf2zM&amp;w=550&amp;h=188&amp;q=double%20pendulum%20gif&amp;ved=2ahUKEwiYt4L55PfoAhWALLcAHdzsA7QQMygJegUIARDiAg">Source</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*Cl_Sc5s7ipQMiI68nFr4dw.png" /></figure><p>Now, when it comes to Fourier Series we can represent it as the sum of individual elements. The exponential part describes the rotation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*FvVZj9VYnX-PwEkL.gif" /><figcaption><a href="https://i.gifer.com/P8E.gif">Source</a></figcaption></figure><p>Now these individual elements are just vectors and <em>y </em>are the positions so y(0) will decide the position in accordance with the origin. These vectors join each other head to tail to produce a wave that can be controlled by setting different values for the exponential and the <em>y </em>term.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*J4sHyMj3ZM6jc755.gif" /><figcaption><a href="https://raw.githubusercontent.com/ansnoussi/FourierDraw/master/image.gif">Source</a></figcaption></figure><h3>Discrete Fourier Transform</h3><p>Now let’s talk about the other application of Fourier Series, which is the conversions from the time domain to the frequency domain. The reason we do this is that when we plot amplitude vs the time it looks kinda complex and when we do it against frequency it&#39;s more interpretable. Here look at white noise for example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*Kh7e5xjqNx1NG7NbMbgTcQ.png" /><figcaption>The first plot shows amplitude vs time and the second is amplitude vs frequency</figcaption></figure><p>But who cares about white noise, let’s get some Passionfruit by Drake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*8M6VYz7SNZ9XCaY3RTNiTw.png" /><figcaption>The code for this available here in the repo linked at the end</figcaption></figure><p>So you see, with a plot between amplitude vs frequency is more interpretable than the time chart. This was done through DFT. So let’s see how that worked. Fourier Transform can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*Cf1-ZP72yCz1PlzFnfJo0g.png" /></figure><p>Now the limits are from infinity to infinity which is kind of impossible to calculate. So instead we represent it as a sum of the terms, so it’s easier to compute, which is the discrete method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*DFkbt_mlRzsNT2tkn_11OA.png" /></figure><p>And we can further shorten the equation by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*yReRSbxEmGF-v3XihLXizQ.png" /></figure><p>And we can represent the full series by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*ieX-RnCk3FfKaTmQUV6oZw.png" /></figure><p>Now there is no point in using this because it has an exponential and a complex term so it’s of no use unless you have a lot of time, but let’s be smart here. One thing we can use to reduce the exponential to <em>cosine</em> and <em>sin</em> by Euler’s Formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*Lmf2qSfB2cYjgFlwitBlEQ.png" /></figure><p>After using this rule we can make of the previous equation as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/138/1*jkh8ZIlkuxy10Vm7iOp59g.png" /></figure><p>And get the magnitude using L2, and the phase using theta. But the problem it’s not continuous and we get breaks in our result and if we miss one point our result would be off, but to get a continuous result we would have to use infinite as the limit. One more problem is that is method is super slow if you see closely it take O(n*n) time complexity. Now if you see this table O(n*n) is really bad as the value of n grows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*AxI9NQ9chVAz6z_U.png" /><figcaption><a href="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTYjbWLBH1_7McF8SYwm3ys06eK8ozPzYDtNXlYWzIoSrSyG7V2&amp;usqp=CAU">Source</a></figcaption></figure><p>Now the next method we will see has the complexity of O(n*logn) so let’s go. Also, the graph can be plotted using this magnitude. One of the most important concepts in signals is the Nyquist Limit in which limit is the sampling frequency/2 and we ignore every frequency above the limit and doubling every frequency below the limit.</p><h3>Fast Fourier Transform</h3><p>Now let’s talk about the Faster algorithm, we first start by redefining some constants so let’s go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*KH9Hv8MS6HihMmxOq6V7oA.png" /></figure><p>Now we will divide the set into two parts odd and even set. So the even index can be represented 2r and odd index is given by 2r+1 where r is 0,1,2…N/2 -1 but why? Well you can also do other things like bitwise swapping or reversing the index the key is just to get a random sequence but it should be possible to trace it backwards. After that, we can represent our series as even and odd parts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*VEM3yZdwQTmjrDBgKPDoFA.png" /><figcaption>We can further reduce form as following</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*13qnHRF4Y0iRlLYlJkQdzw.png" /></figure><p>Now the parts under the summation are the same but they represent two separate parts of the one odd and another even. And hence we can summarize the equation as the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/1*sCrCfGf5xP9Dlc1ikj6wSg.png" /></figure><p>Now we need to calculate X[k] which are our magnitudes, so first as we did earlier we will divide the entries into sets of odd and even index and then we will get the DFT of the sets, so as we know from the Nyquist Limit the output will be only the first half so if the sampling frequency is 8 for both odd and even we will get the first four entry and then we proceed to multiply it with the corresponding odd and even values given by the following diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*CZJIlw4-JW9zzKZF.png" /><figcaption>Here E represents even and O represents Odd (<a href="https://www.google.com/imgres?imgurl=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fc%2Fcb%2FDIT-FFT-butterfly.png%2F1200px-DIT-FFT-butterfly.png&amp;imgrefurl=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFast_Fourier_transform&amp;tbnid=P1_MqxlUCtzhfM&amp;vet=12ahUKEwjFwobP5vfoAhU-DLcAHeybDokQMygEegUIARCZAg..i&amp;docid=aDSMugX9X0C_MM&amp;w=1200&amp;h=976&amp;q=fast%20fourier%20transform&amp;ved=2ahUKEwjFwobP5vfoAhU-DLcAHeybDokQMygEegUIARCZAg">Source</a>)</figcaption></figure><p>Now the outputs can be plotted wrt the frequency to get an optimized solution.</p><h3>Additional Links</h3><p>Code for the visualization(it hasn’t been uploaded yet but I’ll make some more tweaks and upload ASAP): <a href="https://github.com/kaustubherttre/fourier-transform">https://github.com/kaustubherttre/fourier-transform</a></p><p><a href="https://mathworld.wolfram.com/FastFourierTransform.html">Fast Fourier Transform</a></p><p>Visualizing Fourier Transform: <a href="https://youtu.be/r6sGWTCMz2k">https://youtu.be/r6sGWTCMz2k</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7f1039c9c14" width="1" height="1" alt=""><hr><p><a href="https://www.cantorsparadise.com/discrete-and-fast-fourier-transform-e7f1039c9c14">Discrete and Fast Fourier Transforms</a> was originally published in <a href="https://www.cantorsparadise.com/">Cantor’s Paradise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Word Vectors and decoding Autoencoder for Dimensionality Reduction]]></title>
            <link>https://medium.com/data-science/word-vectors-and-decoding-autoencoder-for-dimensionality-reduction-407815ead4b7?source=rss-c0f461fe5681------2</link>
            <guid isPermaLink="false">https://medium.com/p/407815ead4b7</guid>
            <category><![CDATA[conversational-ui]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <dc:creator><![CDATA[Kaustubh]]></dc:creator>
            <pubDate>Thu, 09 Apr 2020 02:45:20 GMT</pubDate>
            <atom:updated>2020-04-22T13:39:36.435Z</atom:updated>
            <content:encoded><![CDATA[<h3>Word Vectors and Dimensionality Reduction</h3><h4>Converting high dimensional data to lower dimensions and getting started with Autoencoders</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tMemZ-s2LN_iW6AyVcF_GA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>So this is my first medium article, and I’m writing this to take a break from my adventures in researching in the field of Natural Language Processing mostly Aspect Based Sentiment Analysis (ABSA) and Machine Translation so today you’ll read about one of the most fundamental concepts in Natural Language Understanding which is Word Vector and Dimensionality Reduction (DR), we’ll focus mostly on DR and then discuss Autoencoders as these are quite popular and the current systems are somewhat based on the same ideology.<em> </em>First, we’ll dive into some history then progressively move to the matter itself.</p><h3><strong>A Brief History of Words and Semantics</strong></h3><p>So if you have read a bit about words and grammar you’d probably have come across this famous quote “<em>You shall know a word by the company it keeps</em>” by Firth, 1957 and this is what most of our knowledge of Natural language is based on, quite logical as well. A word when used should have a relationship with the ones surrounding it. At a higher level, we can see that while doing semantic and syntax analysis, where certain parts of speech follow certain parts of speech like in the sentence “She promised to pay the bill” where the following represents the POS tags, and it is often you see this structure where the preposition follows the verb and the verb follows determiner. But this is totally based on the sentence and our language is more ambiguous than the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*qBgrEyKdqsTHomgP65ofXw.png" /><figcaption>A sample sentence marked with its POS tags</figcaption></figure><p>So a better strategy to represent a word in a sentence was a form of a vector, so one of the vectors which can easily be intuited is “one-hot encoding” where we put a 1 at the occurrence of the word, so it is a long n X 1 vector where n is the size of the sentence. So this vector would be extremely sparse and huge and it will be impractical to move forward with this. So we usually use two types of vector, term-document matrix, and a term context matrix which we shall discuss in the next section.</p><h3><strong>Matrix Reloaded</strong></h3><p>So let’s start with the term-document matrix, so this is quite similar to our one-hot encoding but it&#39;s short in the sense we only look at the word important to us. So the following matrix shows the count vector of the word in the columns and the document in the row.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*45ey5ttghg38t5nvO8r5bQ.png" /><figcaption>The highlighted part shows the count of the words in the play “As you like it”.</figcaption></figure><p>So now if we infer this table there is a good idea we’ll have of the similarity between the words. The idea is that if the words are similar if their counts are close enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*BXB3Ln_2w8rA-HDTSH0UzQ.png" /><figcaption>This shows that Fool and Clown are close to each other and so is battle and soldier</figcaption></figure><p>Now I don’t have anything against the clowns but these are just the facts. But this model is not really practical as scooping words and creating such a matrix from a huge dataset would take a lot of time and wouldn&#39;t be as practical. The other matrix that I mentioned was the term-context matrix. Now instead of taking a full document, we take some paragraphs that define some context for the words. Here is our “corpus”.</p><p><em>1. An equal amount of sugar, a sliced lemon, a tablespoonful of </em><strong>apricot</strong><em> preserve or jam, a pinch each of clove and nutmeg.</em></p><p><em>2.Onboard for their enjoyment. Cautiously she sampled her first </em><strong>pineapple</strong><em> and another fruit whose taste she likened to that of.</em></p><p><em>3.Of a recursive type well suited to programming on the </em><strong>digital</strong><em> computer. In finding the optimal R-stage policy from that of.</em></p><p><em>4. Substantially affect commerce, for the purpose of gathering data and </em><strong>information</strong><em> necessary for the study authorized in the first section of this</em>.</p><p>The words in bold are our so targets and we have to find similar words. So let&#39;s make a matrix with the contexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*5TMxeDH5vxEs3n-GsVDOfg.png" /></figure><p>Here we can immediately see that apricot and pineapple similar makes sense right, but how will this make sense to a machine and how are we gonna scale it for a bigger set. So now we have to use PMI (Pointwise Mutation Information) to get the similarity between the words :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*--E_rA3Hyr0LA-pR4ld2Xg.png" /><figcaption>This gives the probability of the words occurring together rather.</figcaption></figure><p>Now what this function is doing is that it’s getting the probability of the word existing with the context divided with the probability of the words occurring independently. But why? Well because this will give out the true essence of the similarity that is if the number of individual occurrences is lower and the together are comparatively higher than the then the term inside of the log bigger and the PMI will be higher and the similarity will be higher. The mysterious log function wraps that inverse probability. There is another variation of the PMI that is the PPMI which replaces the negative values of the PMI with zero. Another variation we can make is the add- K Laplace smoothing which won’t lead to negative or insignificant values. We can go one step further and calculate the distance between these words which is calculated by the cosine distance, which is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*qqRAbCs6JXxZUVbWWqE6rA.png" /><figcaption>Here Vi is the PMI of the word V in the context of W</figcaption></figure><p>Now this will tell us the final similarity.</p><h3><strong>Dimensions and Why Reduce Them</strong></h3><p>So we humans are complex but we don&#39;t imagine more than 3 dimensions if you want to read more on this <a href="https://science.howstuffworks.com/science-vs-myth/everyday-myths/see-the-fourth-dimension.htm">click here</a> I just think it&#39;s so cool but Avatar gives a pretty good idea as well. So let’s talk about these dimensions when we talk about structure it means an x,y, z-axis but here we don’t have any physical structure, here we have data and a high dimension in data means that there is some information that is not directly visible. So that&#39;s why we reduce it to get direct dependencies and smaller matrices. Although this is mostly and widely studied in the field of Applied Linear Algebra it is quite important in the field of NLP and Machine Learning in general.</p><blockquote>A little disclaimer, with this article I hope to give you some intuition behind Autoencoders but if you want to learn more about the mathematics of dimensionality reduction refer to this <a href="https://ieeexplore.ieee.org/document/9036908/authors#authors"><strong>paper</strong></a> by one of my professors.</blockquote><h3><strong>Latent Semantic Analysis (LSA)</strong></h3><p>In this section, I’ll try to provide a little intuition behind the LSA which is a kind of a stepping stone into autoencoders. So LSA is based on a truncated SVD (Single Value Decomposition) which if you know are widely used in Recommender Systems. If you don&#39;t here is the idea behind them so you take a matrix and you covert it into 3 different matrices each giving some information on the initial matrix so, here you see I&#39;m literally breaking my matrix to understand it more intuitively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*CqEy-39myE0HLA_q.jpg" /><figcaption><a href="https://images.app.goo.gl/n6f4HXUtKDiHmkqn6">Source</a></figcaption></figure><p>A fact about these matrices is that they are hierarchically arranged meaning that they are in order with the most important at the beginning. So why do we need this? To answer this we’ll use our previous example given for the term-context method. So if we calculate the SVD for that we will get these matrices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*k5hE0WQXnqoC3yGjz_sh4g.png" /><figcaption>a,b,c correspond to the values of U, S, V^T respectively</figcaption></figure><p>Now if we truncate and just look at the first 2 columns and all the rows for the first matrix the first 2 x 2 submatrix of b and we multiply it we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*NpyP7mbkqgHei1ISvlhUag.png" /></figure><p>Now what exactly those values tell us is the similarity so if you take a close look the first two rows are the same that means that my first two words are similar and the last two are as well as they yield a positive value. Now there are two things that raise a question here how did I choose 2 as for truncating and how do we get distant values as -1.4142 and 1.7486 are close but the two words don’t seem to be similar. The answer to the first question is that you can have any value instead of two it only depends on the size of your matrix, you can also try plotting the performance to get the best value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*oKbkb4OXpVWelnL18D4oSg.png" /><figcaption>Here we can see two cases so it’s probably best to use hit and trial for this.</figcaption></figure><p>Now to answer the second question we should actually be using the PMI matrix we talked about earlier to get a better result.</p><p><strong>Finally Decoding our Autoencoder</strong></p><p>Let’s look at our first deep learning dimensionality reduction method. A really cool thing about this autoencoder is that it works on the principle of unsupervised learning, we’ll get to that in some time. So autoencoder has 2 layers and encoder(duh) and a decoder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6Z6i1_2EJn13jVEsAOkRQ.png" /><figcaption>This kinda looks like a bottleneck (<a href="https://miro.medium.com/max/3148/1*44eDEuZBEsmG_TCAKRI3Kw@2x.png">source</a>).</figcaption></figure><p>So with this model, we can see we input our count vector and do a series of operations and get a value that has the same dimension as our vector. So what actually happens is that these layers you see are basically operations that are minimizing my original count vector that is they are encoding and the decoding layers try to recreate that original input using the bottleneck. The only way to recreate is by using back prop as we move from the bottleneck to the decoding layer. A boost to this method would be in performing LDA to essentially compress that input vector.</p><h3>Conclusion:</h3><p>Although here we discussed more on the Natural Language side of things Dimensionality reduction is also an issue in Computer Vision(<a href="https://towardsdatascience.com/dimensionality-reduction-for-machine-learning-80a46c2ebb7e">here</a>) and Autoencoders still come into play there (more <a href="https://www.analyticsvidhya.com/blog/2018/06/unsupervised-deep-learning-computer-vision/">info</a>). I hope this article has provided a good sense of how dimensionality works and why it’s required to reduce dimensions but this is just a mere step in the direction. There is more to the mathematics of Dimensionality Reduction which is not really needed for working with Autoencoders. To know more about Autoencoders check the acknowledgments section.</p><p><strong>Acknowledgments :</strong></p><ul><li><a href="https://ieeexplore.ieee.org/document/9036908">Analysis of Dimensionality Reduction Techniques on Big Data - IEEE Journals &amp; Magazine</a></li><li><a href="http://ufldl.stanford.edu/tutorial/unsupervised/Autoencoders/">Unsupervised Feature Learning and Deep Learning Tutorial</a></li></ul><p><a href="http://proceedings.mlr.press/v27/baldi12a/baldi12a.pdf">http://proceedings.mlr.press/v27/baldi12a/baldi12a.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=407815ead4b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/word-vectors-and-decoding-autoencoder-for-dimensionality-reduction-407815ead4b7">Word Vectors and decoding Autoencoder for Dimensionality Reduction</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>
    </channel>
</rss>