<?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 Siddharth Sham on Medium]]></title>
        <description><![CDATA[Stories by Siddharth Sham on Medium]]></description>
        <link>https://medium.com/@siddhsham?source=rss-2241b742b8a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*7eGIxE4Pt8Wy51ILjD1wIA.jpeg</url>
            <title>Stories by Siddharth Sham on Medium</title>
            <link>https://medium.com/@siddhsham?source=rss-2241b742b8a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 17:36:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@siddhsham/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[Using Deep Learning to reconstruct fingerprints —  With Keras ]]></title>
            <link>https://medium.com/analytics-vidhya/using-deep-learning-to-reconstruct-fingerprints-with-keras-daf44881b812?source=rss-2241b742b8a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/daf44881b812</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Siddharth Sham]]></dc:creator>
            <pubDate>Sun, 29 Mar 2020 07:01:17 GMT</pubDate>
            <atom:updated>2020-04-01T10:22:49.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqUblW8KrMcGFa5JjDCmhg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@luferlex?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lukenn Sabellano</a> on <a href="https://unsplash.com/s/photos/fingerprint?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Using Deep Learning to reconstruct fingerprints — With Keras</h3><h4>Spoiler Alert: Autoencoders are awesome</h4><p>Fingerprints are an important facet of biometric security techniques — they are unique, hard to steal and every person on Earth is born with one. (Almost everyone, see: <a href="https://en.wikipedia.org/wiki/Adermatoglyphia"><strong>Adermatoglyphia</strong></a>)</p><p>They form the basis of many criminal investigations, and are also used as proof of identity around the world. Unfortunately, what happens often is that fingerprints tend to get corrupted — partially erased, obscured by ink, missing, et al.</p><p>To this end, I wanted to test the plausibility of imputing missing/deformed fingerprint data from existing data. And thus began my foray into fingerprint reconstruction.</p><h3>Problem Statement</h3><blockquote>Given an incomplete, or noisy sample of a fingerprint image, leverage the power of autoencoders to automatically reconstruct the complete fingerprint details.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LoNOdtN5ma2TwQBVFEqKIQ.png" /><figcaption>Anatomy of a fingerprint. Source: <a href="https://www.google.com/url?sa=i&amp;url=http%3A%2F%2Fsyhrl.blogspot.com%2F2012%2F04%2F036-fyp-minutiae.html&amp;psig=AOvVaw2a7Nxxu3ELUQWqK41Sf3hR&amp;ust=1585547079140000&amp;source=images&amp;cd=vfe&amp;ved=0CA0QjhxqFwoTCJi19qX9vugCFQAAAAAdAAAAABAD">Google Images</a></figcaption></figure><p>My first step was to look for existing work, of course. I found a <a href="https://ieeexplore.ieee.org/document/6928426">few papers</a> which used statistical methods to reconstruct minutiae points and the ridges. However, deep learning approaches to this problem seemed sparse.</p><p>But I did discover two tutorials which dealt with exactly this problem — using convolutional autoencoders: one from <a href="https://www.datacamp.com/community/tutorials/fingerprint-deep-learning">Datacamp</a> and another from <a href="https://www.kdnuggets.com/2020/03/recreating-fingerprints-using-convolutional-autoencoders.html">KDNuggets</a>. These helped me formulate the solution architecture itself.</p><p>Armed with this knowledge, I moved onto finding a dataset.</p><h3>Dataset</h3><p>A little poking about on the Internet lead me to the <a href="https://www.kaggle.com/ruizgara/socofing">Sokoto Coventry Fingerprint Dataset</a> (SOCOFing) on Kaggle. By the description on Kaggle:</p><blockquote>This dataset consists of of 6,000 fingerprint images from 600 African subjects and contains unique attributes such as labels for gender, hand and finger name as well as synthetically altered versions with three different levels of alteration for obliteration, central rotation, and z-cut. For a complete formal description and usage policy please refer to the following paper: <a href="https://arxiv.org/abs/1807.10609">https://arxiv.org/abs/1807.10609</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*VdeZH3rkcGe2sWtqnOboLg.png" /><figcaption>Sample of a fingerprint from the SOCOfing dataset</figcaption></figure><p>As part of preprocessing, we rescaled the images to be 100x100 and eliminated blank space around the fingerprint itself. We also experimented with using different filters on the image to improve the deep learning model’s understanding of the structure, but we are yet to find a suitable filter.</p><h3>Convolutional Autoencoder</h3><p>That’s a rather intimidating word, huh? Fret not, it’s easier than it sounds. Let&#39;s go through this one word at a time.</p><h4>Convolution</h4><p>According to Wikipedia:</p><blockquote>In mathematics (in particular, functional analysis) convolution is a mathematical operation on two functions (f and g) that produces a third function expressing how the shape of one is modified by the other.</blockquote><p>Let’s see if we can understand it in simpler terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulfFYH5HbWpLTIfuebj5mQ.gif" /><figcaption>Convolution in a nutshell. Source: <a href="https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1">towardsdatascience</a></figcaption></figure><p>In <strong>2D convolution</strong>, the process is simple. We have a matrix of data (read: pixels of an image), and we wish to extract the features in it. So we choose a smaller matrix called the <strong>kernel/filter</strong>, and <em>slide</em> it over the larger matrix, applying a multiplication operation at each step. The way the output of multiplication is combined into one is called <strong>“pooling”</strong>, and can be done in a variety of ways, depending on our goal.</p><p>Different aspects of this algorithm can be customised, like the kernel, the pooling, the stride, the padding, et al. For a deeper dive into this topic, see this wonderful article by T<a href="https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1">owards Data Science</a>.</p><h4>Autoencoders</h4><p>An autoencoder is a neural network architecture used to efficiently learn data representation in an unsupervised manner. This architecture has many uses, such as <strong>dimensionality reduction</strong> and <strong>data denoising</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*P7aFcjaMGLwzTvjW3sD-5Q.jpeg" /><figcaption>Autoencoder Schema. Source: <a href="https://blog.keras.io/building-autoencoders-in-keras.html">Keras Blog</a></figcaption></figure><p>Let’s write a simple Convolutional Autoencoder in Keras:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/743a0f43744bc0724d2eb490e0ccef74/href">https://medium.com/media/743a0f43744bc0724d2eb490e0ccef74/href</a></iframe><p>And that’s it! This model takes in a 100x100x1 array (100px *100px, 1 color channel), and outputs an array of the same shape.</p><p>The hyperparameters for this model have not been tuned, but are the result of arbitrary choices and trial-and-error. As you can see, the model is simply a series of <strong>Conv2D</strong> and <strong>MaxPooling</strong> layers, followed by <strong>Conv2D</strong> and <strong>UpSampling2D</strong> layers. Upsampling is simply the <em>inverse</em> of Pooling, since it increases the matrix dimensions by performing matrix multiplications.</p><h4>Results</h4><p>Upon training this model on the SOCOfing dataset with the <strong>Adam</strong> optimiser and <strong>Binary Cross-entropy </strong>as the loss function of choice, we saw impressive results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4FrUNWo_3yAiqAGeZyTvA.png" /><figcaption>Reconstructed image (left) vs Original Image (right)</figcaption></figure><p>Apologies for the terrible picture quality — there is only so much that a 100x100 image can do. The autoencoder has clearly removed the distortion present in the original image with a likely approximation of what should be there.</p><h4>Drawbacks</h4><p>Clearly, the entire image suffers a loss of quality when put through the autoencoder. An interesting alternative would be to create another model which can identify which part of the image has been distorted, and selectively apply reconstruction. Such an approach will reduce the loss of quality dramatically. However, due to the lack of a readily available dataset, we haven’t done this yet.</p><h3>Conclusion</h3><p>Clearly, this is a very simple approach to a very complex problem. I intend to continue working on this particular problem, while trying out different approaches. If I happen to make substantial progress, rest assured that I will update this page. Cheerio! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=daf44881b812" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/using-deep-learning-to-reconstruct-fingerprints-with-keras-daf44881b812">Using Deep Learning to reconstruct fingerprints —  With Keras 💖</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I designed and built a website for my University]]></title>
            <link>https://medium.com/@siddhsham/how-i-designed-and-built-a-website-for-my-university-a9a7a5aa2674?source=rss-2241b742b8a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9a7a5aa2674</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-develpoment]]></category>
            <category><![CDATA[college]]></category>
            <dc:creator><![CDATA[Siddharth Sham]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 15:37:42 GMT</pubDate>
            <atom:updated>2020-03-25T15:37:42.865Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Spoiler Alert: It took a lot more effort than expected</em></h4><figure><img alt="Anokha 2020 Landing Page" src="https://cdn-images-1.medium.com/max/1024/1*tBCSaYlR2QISmI7h1L9gcA.jpeg" /><figcaption>Anokha 2020 Landing Page. Heavily inspired by <a href="https://hackinout.co/">https://hackinout.co/</a></figcaption></figure><h4>How it all Started ✨</h4><p>Every year, my college conducts a national level techfest, as many colleges in India do. Christened <strong>Anokha, </strong>it’s easily the biggest event that we host. It attracts thousands of eyeballs, and lakhs of rupees in funding. Clearly, an event of such scale needed a website to go along with it, and that’s where I come in.</p><p>While I’d been dabbling in Web Development for the greater part of two years, I’d only taken on a handful of projects that weren’t my own. And this was certainly the first project of such <em>large</em> <em>scale. </em>A full-fledged production level application, with all it’s complex necessities, plus the pandering to the whims and wants of various stakeholders. This project was the first one to show me what working in a team actually means — to be pushed and pulled by the various facets of an organisation, all while maintaining your own standards.</p><p>My initiation into the team —<strong> Web, Multimedia &amp; Development </strong>was rather simple — a stand-up meeting on-campus. And just like that, work started in the November of 2019.</p><h4>Design 🎨</h4><p>I knew this was going to be my creative outlet — the best place for me to showcase my skill in design and development. I spent a good amount of time doodling wireframes in the back of my lab notebooks during class, contemplating issues of <strong><em>accessibility, browser support </em></strong>and<strong><em> responsiveness</em></strong> with more seriousness than I had ever given them.</p><figure><img alt="Hand-drawn wireframes for desktop and mobile, side by side" src="https://cdn-images-1.medium.com/max/720/1*JJLYVZ12L008EPd1it2eLA.jpeg" /><figcaption>Hand-drawn wireframes for both desktop and mobile</figcaption></figure><p>The team reviewed the wireframes, and provided helpful inputs and insights, but were mostly happy with it.</p><p>The final changes were few and easy to implement, and so we moved on to development.</p><p>The tech stack I chose was simple. The back-end had already been written in <strong>Laravel</strong>, and was mostly complete by the time I started work on the front-end. It was beautifully documented using <strong>Swagger</strong>, and I experienced very few hiccups in using it.</p><p>For the front-end, I decided early on that I wanted a high-performance, lightweight PWA (Progressive Web App). Owing to my dislike of React, I went for a <strong>Vue</strong>-based alternative. The final choice was <strong>Nuxt.js</strong>.</p><p>Nuxt is incredibly developer friendly, allowing one to setup a PWA Universal/Single-Page Application with the push of a button. I chose <strong>axios </strong>for asynchronous communication between the client and server, and <strong>bulma </strong>as the CSS framework. I’m a huge fan of these libraries, and my experience during this project only served to reinforce that.</p><h4>Development 💻</h4><p>We didn’t follow any particular development process, though one could say that our method resembled the Agile methodology. We had deadlines, and a small backlog of tasks to complete. There also existed a larger product backlog, which we put off looking at until we had to. We worked at the same table, since we were a small team. It was generally two or three devs working alongside half a dozen graphic designers, so this made communication simple.</p><p>However, Anokha itself was a University level event. Which meant there were multiple teams coordinating the different aspects of the event — Communication, Transportation, Hospitality, etc. There were faculty coordinators for each team, and student heads, co-heads and whatnot.</p><figure><img alt="Commit frequency" src="https://cdn-images-1.medium.com/max/545/1*I9QnvhLXWc353MyG4uAySQ.png" /><figcaption>My contributions to the development</figcaption></figure><p>Coordinating between all these teams sure proved to be a challenge. There was also the long development period — almost four months of work, with academic work and a daily four-hour commute robbing me of time.</p><p>However, with a steady pace of work and clever prioritizing, we managed to deliver on time. We didn’t miss any of the deadlines, and the quality of the work surpassed expectations.😄</p><blockquote>PS: Since the code is in a private repository, I won’t be releasing it here.</blockquote><h4>Difficulties 😓</h4><p>While developing, I used the <strong>Pixel 2</strong> as a reference to check for responsiveness. This generally worked well, as I was certain that my design could scale up well. Turns out, the <strong>iPhone SE</strong> is an exception — my design didn’t scale <em>down, </em>it instead became very cramped and user-unfriendly. Fortunately, a bit of <em>fluid typography</em> helped me avoid a complete redesign. This particular issue plagued me throughout the project.</p><blockquote>Turns out, the iPhone SE is an exception — my design didn’t scale <em>down</em>.</blockquote><p>The second major hurdle came in the form of color schemes. I’d meant for the entire application to be light pastel shades, but annual tradition expected me to implement a dark theme. In order to compromise, I decided to implement a theme toggle, and let the default color be dark pastel shades. The end result was pretty, but it was a hard won victory. My solution was probably not the most optimal; simply one I managed to implement.</p><h4>The Experience 🔥</h4><p>In all, the experience was worth it. I learnt how to work in a fast-paced environment with pressure from multiple stakeholders, I learnt to collaborate with a team effectively, I learnt a whole lot about Web Development itself. Let’s just end it with saying “I learnt a lot”.</p><h4>Conclusion 👋</h4><blockquote>Being self-quarantined at home does give one a lot of time. I find writing to be a good release of energy, so expect more from this channel. Till then, sayonara!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9a7a5aa2674" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Putting up Trees for New Year’s, 2020]]></title>
            <link>https://medium.com/@siddhsham/putting-up-trees-for-new-years-2020-fd4b016d1cbd?source=rss-2241b742b8a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd4b016d1cbd</guid>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[new-year]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[trees]]></category>
            <dc:creator><![CDATA[Siddharth Sham]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 06:18:53 GMT</pubDate>
            <atom:updated>2020-05-09T19:13:36.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Najv8uZlXmW8xGG_" /><figcaption>Photo by <a href="https://unsplash.com/@maritafox?utm_source=medium&amp;utm_medium=referral">Marita Kavelashvili</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Looking back after half a year :D</h4><blockquote>Here’s an article I’ve been sitting on for quite some time. I didn’t write this with the intention of publishing it to Medium, but oh well, here we are. Have fun reading through the thoughts of a person who lived in the pre-Corona era.</blockquote><p>The New Year is upon us. It brings with it a whole new decade — full of possibility and hope. Ah well, let’s see how things go.</p><p>While half my friends were out partying and the other half were asleep, I was busy constructing a tree. Not a tree of the wooden kind, however. A more digital tree. Yes, my dear technically savvy reader — I am talking about the data structure.</p><p>However, the tree that I’ve been working upon is no normal tree. Rather, it is something called a <strong>Patricia Tree </strong>— short for <strong><em>Practical Algorithm to Retrieve Information encoded in Alphanumeric. </em></strong>Clearly a backronym. Oh well.</p><h3>Where It Began</h3><p>In my quest to find a way to create efficient autocomplete, I was introduced to the humble <strong>Trie.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wFu0dcW_1eYaaSKJ.jpeg" /><figcaption>Source: <a href="https://medium.com/basecs/compressing-radix-trees-without-too-many-tears-a2e658adb9a0">https://medium.com/basecs/compressing-radix-trees-without-too-many-tears-a2e658adb9a0</a></figcaption></figure><p>This nifty little data structure is capable of efficiently looking up word completions — far more efficient than a normal O(n) lookup. However, this speed came at a cost — space. Tries aren’t space optimised, which was rectified in the Patricia Tree. Yay.</p><h3>Moving Forward:</h3><p>This is when I found out about Patricia/Radix trees. <a href="https://stackoverflow.com/a/14708989/8986124">Here’s</a> an excellent StackExchange answer that highlights the difference between a Trie and a Radix Tree. I immediately fell in love with the elegance of the idea, and decided that I had to implement it. I wasted no time in finding a Python implementation, and was immediately surprised to find a dearth of examples. With perseverance, however, I found <a href="https://stackoverflow.com/a/2412468/8986124">this</a> excellent implementation by Justin Peel, from an ancient StackOverflow thread. I also found <a href="https://github.com/google/pygtrie/blob/master/pygtrie.py">this</a> one by the Google team. However, this was overkill for what I needed, and I found it hard to wade through the complete code, despite it being commented very well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7gGLl7Fx80b3aRw3.jpeg" /><figcaption>Source: <a href="https://medium.com/basecs/compressing-radix-trees-without-too-many-tears-a2e658adb9a0">https://medium.com/basecs/compressing-radix-trees-without-too-many-tears-a2e658adb9a0</a></figcaption></figure><p>In the face of these hurdles, I thought it prudent to <strong>write my own implementation</strong> of a Radix Tree. With much effort over the course of a day, I have managed to implement the functionality of adding a word to the tree, and reading the contents of the tree. In my case, this forms the bulk of the problem. I shall eventually get around to adding the functionality of removing words from the tree, at which point it would become a complete Data Structure. As of now, I can simply rebuild the tree with the updated vocabulary.</p><h3>Was It That Simple?</h3><p>No, not Really.</p><p>My implementation of the tree relies on the concept of <em>calling a function from within itself, </em>ie<em>, </em><strong><em>recursion</em></strong><em>. </em>This approach greatly simplifies the problem by breaking it down into smaller chunks, but it comes at the cost of scalability. Python has an inbuilt recursion limit of 1000 recursive function calls, but can be modified if required.</p><p>However, for the case of storing words, I believe I’m safe, as it would be an extremely rare case of exceeding 1000 calls. Hence, I shan’t worry about it for now.</p><h3>The Innovation</h3><p>What follows here are my theories and ideas for improving this approach.</p><p>The idea of combining Deep Learning with this tree structure is what makes this special. At each node of the Radix Tree, I attach a <strong>Neuron</strong> object — a black box that takes in a vector and a symbol as input, and provides the next traversal step, and an incremented symbol as output.</p><p>For reference, here is what a standard <em>Deep Neural Network</em> looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*oBNO_5ArxuMogITv" /><figcaption>Source: <a href="https://medium.com/coinmonks/the-artificial-neural-networks-handbook-part-1-f9ceb0e376b4">https://medium.com/coinmonks/the-artificial-neural-networks-handbook-part-1-f9ceb0e376b4</a></figcaption></figure><p>The first step in implementing this Neuron class would be a statistical approach — add all the words over a large corpora, and assign frequency to each node. The idea is simple — higher frequency nodes are likelier to be traversed. For example, the word <em>the </em>would appear more than the word <em>thesaurus</em>, hence making it more likely to be typed by the user.</p><p>However, the problems with this approach is that it does not understand context and will always provide the same suggestions for a given set of characters. To overcome this problem, we would ideally train the model to take into account <em>context vectors</em> in the form of <strong>Word Embeddings. </strong>This gives the model the ability to take into account the context of the word being typed, hence providing a dynamic and intelligent suggestion for autocomplete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*Hn112JNdeom6ogeh" /><figcaption>Source: <a href="https://www.shanelynn.ie/get-busy-with-word-embeddings-introduction/">https://www.shanelynn.ie/get-busy-with-word-embeddings-introduction/</a></figcaption></figure><p>An added advantage of this model is performance. Since at each timestep only one neuron (or atmost, a small number of neurons) provides an output, the prediction becomes logarithmically faster as we near the end of each word.</p><h3>The Future is Now</h3><p>A possible extension in the future is using this model for <em>next-word prediction</em> as well. The idea being — since the model becomes faster at the end of a word, we can use precompute the most likely word endings, and pass the context vector to the root of the tree again. In theory, if the model is well trained enough, it should be able to predict the next word to be typed — very efficiently. This could be recursively done until the model’s confidence diminishes to a point where it is less than 50% sure of a word being typed.</p><h3>Possible Implementations of the Neuron Class</h3><p>This being the most crucial part of this project, I have pondered over various approaches to implement the Neuron class. In theory, using a attention-based Transformer model with frequency/softmax determined biases would be the most efficient and accurate model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*cKwzWv8s1hWqSUBy" /><figcaption>Source: ‘Attention Is All You Need’ by Vaswani et al.</figcaption></figure><h4>Transformer-Softmax model</h4><p>Each neuron has three components: Encoder, Decoder, Softmax weight.</p><p><strong>The Softmax weights</strong> — The easiest component to explain. Since frequency of words does play a significant role in selecting paths, using a fixed weight as the softmax probability of the frequency of each node being traversed is a good idea.</p><p><strong>The Decoder </strong>— The input vector needs to be transformed into a form that can be used to identify the next nodes to traverse. This can be done with a Transformer architecture Decoder.</p><p><strong>The Encoder </strong>— Before passing the context vector to the next node, we need to account for the symbol that was just consumed at the current node. So we again use a Transformer architecture Encoder to achieve this.</p><p><strong>The Process </strong>— The input symbol and the context vector is provided to the Tree. The Decoder present at the Root node of the Tree passes it’s output to the Softmax weights. This layer selects the next most probable node through <strong>Multinomial Sampling. </strong>The updated context vector is then constructed by accounting for the symbol just consumed, and is then passed to the next node.</p><h3>Final Thoughts</h3><p>This entire project has helped me in many ways — exercise and sharpen my poor Python skills, expand upon my understanding and appreciation of Data Structures and Neural Networks, and hopefully, will give me the experience of building a working neuron from scratch, without relying on libraries such as TensorFlow and Keras.</p><p><em>Originally published at </em><a href="https://telegra.ph/Putting-up-Trees-for-New-Years-2020-01-02"><em>https://telegra.ph</em></a><em> on January 2, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd4b016d1cbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>