<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Mehndiratta on Medium]]></title>
        <description><![CDATA[Stories by Aditya Mehndiratta on Medium]]></description>
        <link>https://medium.com/@adityamehndiratta?source=rss-b8923f712051------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xVyiHCsB3fWN3Rg6.</url>
            <title>Stories by Aditya Mehndiratta on Medium</title>
            <link>https://medium.com/@adityamehndiratta?source=rss-b8923f712051------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:44:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityamehndiratta/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[The genius of Rick and Morty]]></title>
            <link>https://medium.com/@adityamehndiratta/the-genius-of-rick-and-morty-612aad98e0c7?source=rss-b8923f712051------2</link>
            <guid isPermaLink="false">https://medium.com/p/612aad98e0c7</guid>
            <category><![CDATA[rick-and-morty]]></category>
            <category><![CDATA[morality]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[existence]]></category>
            <dc:creator><![CDATA[Aditya Mehndiratta]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 10:12:36 GMT</pubDate>
            <atom:updated>2020-02-23T20:06:26.054Z</atom:updated>
            <content:encoded><![CDATA[<p>I can’t remember a show that was as engaging as Rick and Morty! While I find the content super smart and entertaining there are few central ideas, some subtle some not so much that I believe together form the genius <strong>that is Rick and Morty!</strong></p><h3><strong>The Embrace of Nihilism</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*0yedZm0d6TQfOYgEeglmRw.png" /></figure><p>Rick is the smartest man in the universe and that is also his biggest curse. Infinite universes infinite possibilities is his thing!!</p><p><strong>Nihilism is the point of view, or philosophy, antithetical to the reputedly meaningful aspects of life and that it is without objective meaning, purpose, or intrinsic value</strong>.</p><p>Moral nihilists assert that morality does not exist at all… Sounds familiar enough??</p><p>Think about religion especially abrahamic religions exfoliates a belief of our special status in the universe.The show repeatedly shows how inconsequential earth and our life really is….Which is quite scary to say the least!</p><p>Some people aka Jerry are are inconsiderate and even content with their existence.</p><h3><strong>The disregard for Authorities and the Government</strong></h3><p>We see multiple times how Rick dissed governments, hell he even proved quite successfully to Morty the absolute hypocrisy of superheros! Why this special hatred?</p><p>Governments are great for a population of averages…. for a population of Jerry’s but they just stifle the smartest and most competent! How many times have we seen movies where the smartest kid also has issues with authority? Governments and superheros create a facade of safety and security and we pay for it unseen ways… We pay for it by giving up control, giving up choice and giving up free will! Some may argue that it is for the greater good but not Rick who being a control freak himself can’t imagine less smarter people than him telling him what to do!</p><h3><strong>Why choose Morty as a companion?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9JzhR4QtdbEe_gEC0remYg.jpeg" /><figcaption>Rick and Morty for a hundred years!</figcaption></figure><p>This question has really troubled me? I mean aren’t Morty and Rick completely different personalities.. Rick the eccentric genius and Morty the cautious child who struggles in school and is not unlike most of us …. In one episode he even says that an adventure is incomplete without Morty. So what makes this relationship special?Here are my two cents about this..</p><p>Rick actually does not like the person he is… He wants to show affection show care… Wants to find a purpose and enjoy normal life just like Morty..<strong>How many times do we like a person just because they are a version of ourselves that we can’t be but would want to.</strong></p><p><strong>Morty and Rick are like the proverbial Yin and Yan</strong>….different but inseparable.</p><p>Morty does things which make the adventure an adventure…I mean it would not amount to something exciting if someone doesn’t screw up,right? Rick could probably save the day himself but it isn’t worth much if there is no one to say bravo at the end of it!</p><h3><strong>What is Right and Wrong?</strong></h3><h4>Freedom and Democracy?</h4><p>We all have grown up to the quintessential idea of freedom and democracy as the ultimate victories of humankind… But the show attacks this idea at its core. On a planet whose minds are controlled by a single powerful being Summer(Morty’s sister) is horrified at the idea of their lack of individuality and freedom but she ends up worsening the situation after triggering a civil war among the different races…. Don’t get me wrong I am still a supporter of democracy but the very fact that the show could tackle an idea which has become so central and the absolute truth today, was challenged!</p><h4>The Purge?</h4><p>Rick and Morty end up on a planet that is completely peaceful albeit a festival where everyone is allowed to kill anyone without any consequence. Is this justified ? Morty does everything to save a girl from getting killed but the end result is fruitless as the people resort back to the purge practice as soon as they leave…</p><h4>Having a micro universe slave away for you?</h4><p>This is one of my favourite episodes! Rick creates a micro universe that powers his car battery. A problem causes him and Morty to shrink and enter the micro universe to investigate… There Rick is considered an alien god but little do they know that they exist to merely power the battery of Rick and Rick actually isn&#39;t a saviour! Morty is appalled at this and questions Rick but he says that it is for their own good….The episode then has a massive twist when a genius scientist not unlike Rick makes a micro universe within a micro universe… Wow that’s a quite a lot to take in?</p><p>The question is did Rick do a right thing? I mean was it for their good…. Are we also part of a micro universe? Pretty heavy stuff? I mean the concept of God was shown to be a mere eyewash!</p><h3><strong>Is is fruitful to find meaning?</strong></h3><p>We all are trying to find the one thing that keeps us going, that wakes us up on a Monday morning,<strong> </strong>makes us do things we sometimes hate…<strong> It may be money,fame but almost everyone finds or at least tries to find something…</strong></p><p>But what if you realise all that is bullshit… I mean actually understand it by being the smartest man in the universe aka Rick! Sure enough you stop giving two hoots about anything… That is Rick but not completely there is a part albeit small that loves adventure, loves his family… Rick struggles to embrace this side of his…<strong>how can love mean anything in a world of infinite possibilities and infinite realities right??</strong></p><p>But maybe just maybe the entire concept of finding meaning is tireless? Why does life have to mean anything to be successful?</p><h3><strong>The beauty of absurdity</strong></h3><p>Remember the time when you just enjoyed saying stuff which does not make sense? Or doing crazy stuff when no one was looking? Come on… don’t feel shy admit it!</p><p>Imagine you are travelling to another universe for a marriage of a friend and your only concern is that you don’t have something to wear? Or what if your parents wish you all the best for an interstellar adventure that could kill you but only ask you to be back before dinner….Absurd right?</p><p><strong>That’s exactly why it is so engaging! I guess in Rick and Morty if anything is absurd it is only because we lack the imagination!!</strong></p><h3>Conclusion</h3><p>The long wait for season 4 episode 6 is what inspired me to write this post! Rick and Morty is deliciously original and it would be interesting to see new ideas emerge…Morty can be seen as becoming more assertive as the show progresses.. What about Rick?? His character development will also be something to look forward too!</p><p>What do you guys think? Would love to hear your thoughts. New ideas and feedback are most welcome …also be sure to applaud if you could relate to this analysis of the show!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=612aad98e0c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Variational Autoencoders]]></title>
            <link>https://medium.com/iitg-ai/variational-autoencoders-c780c4acaf4f?source=rss-b8923f712051------2</link>
            <guid isPermaLink="false">https://medium.com/p/c780c4acaf4f</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[variational-autoencoder]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[generative-model]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Aditya Mehndiratta]]></dc:creator>
            <pubDate>Wed, 09 Oct 2019 20:53:10 GMT</pubDate>
            <atom:updated>2019-10-10T06:38:06.857Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Variational Autoencoder</h3><p>This is the first article in the series of ‘Generative Models’ that try to decode the technology that makes machines do the things that were considered exclusive human endeavours like drawing, painting, writing, music etc. Can we teach machines these abilities?</p><p>So lets begin…Perhaps the most basic and fundamental of of all generative networks is the variational autoencoder. But before we begin we must first understand what an autoencoder really is?</p><h3><strong>The Autoencoder</strong></h3><p>The autoencoder is a neural network architecture made up of 2 sub structures</p><h4><strong>The Encoder:</strong></h4><p>The encoder is responsible for converting the large dimension input data into a lower dimension representation vector.</p><h4>The Decoder:</h4><p>The decoders job is to take the lower dimension representation vector and convert it back into the input image domain.The output image is known as the reconstructed image. The closer the output image is to the input the better!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I5MVGIrROrAnD3U_2Jm1Ng.png" /><figcaption>The Autoencoder Structure</figcaption></figure><p>The network is trained well if it learns weights that minimises the loss between reconstructed image and original image.Now consider this amazing idea suppose our lower dimension representation vector was the 2D plane. If we pick any random point from the 2D plane and pass it through a decoder we should get an output image which may or may not be in the original set! <strong>Wolah there you have your first generative model!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*FfUASdgIItCdaIfy13EnAA.jpeg" /></figure><p>Let us also understand it in code in Pytorch. The entire code can be found using the Github links at the end of article. The outline of the model is shown feel free to clone the repository and play around with the parameters. Also I initially worked with convolution layers but found out that fully connected layers work better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*fGYFxZlaGh3n7CfPksB14Q.png" /><figcaption>The Model Outline</figcaption></figure><p>The model dimensions of the simple end to end fully connected model is shown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*gmjuTUNjhMKQL5G0XL7MtA.png" /><figcaption>Model Dimensions</figcaption></figure><p>The model is trained on the MNIST dataset and the representation vector is in the 2D plane. The Autoencoder output of the 64 digits generated from random normal distribution is shown. I encourage you to try out various points and pass it through the decoder and see the results!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*58g9vup_2jEvRqevteYQ8w.png" /><figcaption>Generated images from Autoencoder</figcaption></figure><p>Further there is another interesting plot on the test set where a scatter plotter of the output representation vector’s x and y co-ordinates is shown… (remember the output dimension of the encoder is 2D). Also each colour represents the label of the image.</p><p><strong>The fascinating thing is that the plot is made for the test data and the labels are unseen yet a pattern emerges with similar digits clustered together!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*1whjGoZ1xz_70VcUoEFjkg.png" /></figure><p><strong>What is unwanted however is</strong></p><ul><li><strong>The high degree of overlap</strong></li><li><strong>The low level of continuity in space i.e suppose we select a point (x,y) as say digit 5 then a point neighbouring x,y must also be a image similar to 5.</strong></li><li><strong>As a generative model the spread of the digits must also be nearly uniform so if we go about sampling a point randomly it is more likely to be a 5 than a 8!</strong></li></ul><p>We have chosen only two dimensions to represent the representation space but this problem is greater in larger dimensions when we have to encode data like faces.. <strong>This is the motivation for studying a better architecture the Variational Autoencoder!</strong></p><h3><strong>The Variational Autoencoder</strong></h3><p>Let us now make a few important changes. <strong>We need to incentivize our model to group similar images together. </strong>The solution is as follows instead of the encoder output representing a single point in the 2D plane we will now match it to a multivariate normal probability distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rABo8XywciOGf0WFK5xY2Q.png" /><figcaption>6 is encoded with the help of a normal distribution</figcaption></figure><p>Remember that we <strong>do not assume any correlation between the two dimensions. </strong>So essentially a VAE will take a input image and map it to to two vectors i.e the mean vector(mu) and the logarithm of variance(log_var)…we don’t have a covariance term as it is assumed to be 0!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*vad8GeQy53g7laWw-MGeXQ.png" /></figure><p>Also instead of variance we use the log of variance because the variance is only positive and we would rather prefer a value from (-inf,+inf) which is the natural output range of neural network.</p><p><strong>Since our encoder now outputs 2 vectors mu(mean vector) and log_var(variance matrix which is diagonal considering co-variance between dimensions is 0) how do we represent the image on a 2D plane?</strong></p><p>We map it to a point <strong>z = mu + sigma * epsilon (sigma=exp(log_var/2) (epsilon is a point sampled from a normal distribution)</strong></p><p><strong>So why are we doing this?</strong> Remember our autoencoder case we realised that there is no incentive for our model to the make the space continuous but here since we are sampling a random point around mu the reconstruction loss ensures that even if we sample a point around the <strong>original data point we should get a similar reconstructed image!!</strong></p><p>Lets get down to some code!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*uA7h6sou_GaQaNC6yocnBw.png" /><figcaption>VAE model outline</figcaption></figure><p><strong>Notice the additions we have now… we also have defined a function ‘sampling’ that takes output from the encoder and returns a point z in the 2D latent space using the formula discussed above</strong></p><h3><strong>The Loss Function</strong></h3><p>The decoder is same as it is even in the case of the VAE and we have already seen the changes in the encoder the other difference from the vanilla autoencoder case is the loss function.Previously the loss function was the binary cross entropy loss between the the individual pixels of the reconstructed and input image now in addition we have an additional loss known as Kullback–Leibler (KL) divergence loss. In a nutshell the KL divergence loss is a measure of how different two probability distributions are. In our case we want to measure how different our distribution is from the standard distribution hence KL divergence loss takes the form(Interested ones can refer <a href="https://www.countbayesie.com/blog/2017/5/9/kullback-leibler-divergence-explained">this article</a> of KL divergence for a more rigorous explanation)</p><p><strong>kl_loss = -0.5 * sum(1 + log_var — mu ^ 2 — exp(log_var))</strong></p><p><strong>Observe that when log_var=0 and mu=0 our distribution is identical to standard normal and the kl_loss is 0! Hence the total loss function is a sum of both reconstruction loss and KL divergence loss</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab9d432080c95b6aa540d8fdac9468fc/href">https://medium.com/media/ab9d432080c95b6aa540d8fdac9468fc/href</a></iframe><p>Similarly as in our previous case we will now try to represent the outputs of the VAE on the test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*FMmgZFHNFEMALvMP5Wgf5g.png" /><figcaption>VAE output</figcaption></figure><p>Unimpressed? Wait up! Let us represent the encoder output which after sampling gave us a point in the 2D plane…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*3wP-eqewClER9tm0fEUsfg.png" /><figcaption>The VAE output</figcaption></figure><p>This is much better! The distribution is much more closely spaced also more uniform i.e one digits isn’t spread too much in comparison to another. <strong>Remember the main role of a generative network should be to give good output representations i.e that is similar to the input domain,second it should give us a reliable way to sample new points so that we can in advance get an idea of whatever we are trying to generate! i.e a new point close to say image 1 should be similar to 1 only.</strong></p><p>Thus we have now found a way to make the space more continuous also we have found a reliable of sampling i.e from a normal distribution (see above for the formula for z vector where epsilon was taken from a standard normal distribution).</p><p>Here we have focused on the neural network approach characterised by encoder,decoder and loss function however I would recommend <a href="https://jaan.io/what-is-variational-autoencoder-vae-tutorial/">this link</a> if one wants to really understand why it is called a ‘variational’ autoencoder in the first place.The idea covered are part of <strong>the probability model perspective </strong>and currently out of scope of this article.</p><p>The real benefit of VAE can be further exemplified by taking a more complex dataset perhaps the celebrities face dataset is a good exercise. Since we have only used a 2D plane for the representation vector for easy visualisation we may not get the best resolution images but feel free to try increasing the representation vector dimension I would love to hear about these experiments in the comments. Also don’t forget to clap if you found the article helpful and follow IITG.ai for more articles and updates.</p><h3>Links and References:</h3><ul><li>The models code can be found at: <a href="https://github.com/IITGuwahati-AI/Generative-Models">https://github.com/IITGuwahati-AI/Generative-Models</a></li><li>David Foster: Generative Deep Learning</li><li>VAE code: <a href="https://github.com/lyeoni/pytorch-mnist-VAE">https://github.com/lyeoni/pytorch-mnist-VAE</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c780c4acaf4f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/iitg-ai/variational-autoencoders-c780c4acaf4f">Variational Autoencoders</a> was originally published in <a href="https://medium.com/iitg-ai">IITG.ai</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>