<?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 Tushar Neupaney on Medium]]></title>
        <description><![CDATA[Stories by Tushar Neupaney on Medium]]></description>
        <link>https://medium.com/@tneupaney?source=rss-7af3dbb4d070------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BUJUmTTbjaheoID_KlreWw.png</url>
            <title>Stories by Tushar Neupaney on Medium</title>
            <link>https://medium.com/@tneupaney?source=rss-7af3dbb4d070------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 05:11:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tneupaney/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[Meet Reqd]]></title>
            <link>https://tneupaney.medium.com/meet-reqd-34e554860383?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/34e554860383</guid>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Thu, 07 Aug 2025 12:08:58 GMT</pubDate>
            <atom:updated>2025-08-07T12:08:58.791Z</atom:updated>
            <content:encoded><![CDATA[<p>Your Fix for Messy Software Requirements</p><p>Requirements gathering is a headache for businesses and software teams. Clients often start with vague ideas, like “I want to grow my business,” but halfway through a project, they switch gears: new features, different themes, or a total pivot. This leaves developers scrambling and clients unhappy with the results. I’ve seen this chaos too many times, so I built Reqd, a conversational AI tool to make requirement gathering clear, structured, and pain-free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7svPauaWZeOxFjnGyeP2oQ.png" /><figcaption>Reqd, Chatbot UI</figcaption></figure><p><strong>What is reqd?</strong></p><p>Reqd is a smart chatbot platform that mixes a PHP MVC backend, a Python ML service, and a simple frontend. It chats with users, figures out their business goals using transformer-based machine learning, and suggests solutions that actually make sense. Everything gets saved neatly in a SQLite database, so you’ve got a clear record to work from. It’s built for businesses and software companies who want to nail requirements upfront and avoid mid-project disasters.</p><p>Ever had a client change their mind after you’ve coded half the project? It’s frustrating, time-consuming, and expensive. Reqd stops that by:</p><p><strong>Chatting Like a Pro:</strong> Its conversational UI asks smart, staged questions to dig out every detail, no matter how vague the client starts.</p><p><strong>Spotting Goals with ML:</strong> Using ONNX transformer models (think cutting-edge AI), it detects multiple intents — like “grow leads” or “build a website”and even from fuzzy input.</p><p><strong>Suggesting Solutions:</strong> It maps intents to practical options, like “Lead Automation,” and follows up to refine the plan.</p><p><strong>Keeping It Organized:</strong> All answers and solutions are summarized and stored in SQLite, ready for your team to use.</p><p>This setup kills scope creep and keeps everyone on the same page from day one.</p><h3>Cool Stuff Reqd Does</h3><p><strong>Dynamic Chats:</strong> Handles multiple goals at once, switching questions based on what the client says.</p><p><strong>Easy to Tweak:</strong> Change conversation flows or intents in PHP config files to fit any industry.</p><p><strong>Logs Everything:</strong> Tracks every interaction for debugging or compliances which makes everything super transparent.</p><p><strong>Modular Design:</strong> The frontend, backend, and ML parts are separate, so you can scale or swap things out (like moving to MySQL).</p><p><strong>Extensible ML Models:</strong> ONNX models for intent detection and a FastAPI backend keep it fast and reliable.</p><h3>How It Works in Real Life</h3><p>Picture a client saying, “I need to grow my business.” Reqd asks, “What’s your main goal here?” They pick “Automated online campaigns.” Reqd then suggests “Lead Automation” and asks, “Fully automated or semi-manual?” By the end, you get a clean summary of their goals and choices, saved for your team. No more guessing or late-game surprises.</p><h3>Ping me for more</h3><p>Reqd is like playing tic-tac-toe on a 3x3 board — simple but strategic. Instead of predictable draws (or project failures), it scales up the game, giving you clear, structured requirements every time. For businesses and software teams, it’s the tool to stop the requirement chaos and deliver projects clients love.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34e554860383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing the Dynamic Database Health and Performance Analyzer]]></title>
            <link>https://tneupaney.medium.com/introducing-the-dynamic-database-health-and-performance-analyzer-f64ecea5452f?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/f64ecea5452f</guid>
            <category><![CDATA[mysqlite]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[database-health-checks]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Sat, 05 Jul 2025 10:45:05 GMT</pubDate>
            <atom:updated>2025-07-05T10:45:05.106Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*htFzFHnsksdE2Gh7SygCkA.png" /><figcaption>Query Identifier</figcaption></figure><p>In today’s data-driven world, a healthy and performant database is the backbone of any successful application. But how do you truly know what’s happening under the hood? Are your queries efficient? Is your data pristine? Are there hidden security risks?</p><p>Introducing the <strong>Dynamic Database Health and Performance Analyzer</strong> — an open-source Python tool designed to answer these critical questions. This project empowers developers and database administrators to gain deep insights into their relational databases, currently supporting <strong>SQLite</strong> and <strong>MySQL</strong>, with extensibility for more.</p><h3>Hidden Bottlenecks and Risks</h3><p>Traditional database monitoring often focuses on high-level metrics. What’s often missed are the granular details: an unindexed foreign key causing slow joins, a forgotten trigger silently adding overhead, or even plaintext passwords lingering in a forgotten table. These hidden issues can lead to performance degradation, data integrity nightmares, and critical security vulnerabilities.</p><h3>Dynamic, Comprehensive Analysis</h3><p>Our tool tackles this by dynamically discovering your database’s schema and then running a suite of targeted analyses:</p><ul><li><strong>Intelligent Schema Discovery:</strong> It doesn’t assume your table names. It inspects <em>all</em> your tables, columns, indexes, foreign keys, and triggers.</li><li><strong>Proactive Performance Testing:</strong> It generates synthetic queries based on your actual schema, identifying slow queries and offering concrete SQL suggestions for new indexes.</li><li><strong>Robust Integrity Checks:</strong> It hunts down foreign key violations and duplicate unique entries, ensuring your data remains consistent.</li><li><strong>Heuristic Security Scanning:</strong> It intelligently looks for sensitive data patterns, including a heuristic check for plaintext or weakly hashed passwords.</li><li><strong>Trigger &amp; Relationship Deep Dive:</strong> It measures the real-world impact of triggers and analyses the efficiency of your JOIN operations.</li></ul><h3>Key Features at a Glance</h3><ul><li><strong>Dynamic Schema Discovery:</strong> Adapts to <em>any</em> relational schema.</li><li><strong>Actionable Optimisation Suggestions:</strong> Provides CREATE INDEX statements and other tips.</li><li><strong>Interactive HTML Reports:</strong> Visualises query performance with D3.js and presents all findings in a clear, collapsible format.</li><li><strong>Modular &amp; Extensible:</strong> Built with a pluggable handler system, making it easy to add support for PostgreSQL, SQL Server, and more.</li></ul><h3>Get Started Today!</h3><p>The Dynamic Database Health and Performance Analyzer is available on GitHub under the GNU General Public License v3.0. Whether you’re debugging a sluggish application, performing a security audit, or simply want to understand your database better, this tool is for you.</p><p><strong>Explore the project, contribute, and take control of your database health!</strong></p><p><a href="https://github.com/tneupaney/DB_Analyzer"><strong>Visit the GitHub Repository</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f64ecea5452f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visually Understanding Maths]]></title>
            <link>https://tneupaney.medium.com/visually-understanding-maths-cfec9d62af4e?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfec9d62af4e</guid>
            <category><![CDATA[teaching]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[series]]></category>
            <category><![CDATA[geometry]]></category>
            <category><![CDATA[teaching-and-learning]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 08:43:06 GMT</pubDate>
            <atom:updated>2019-03-28T08:43:06.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwDTFoiKqYc2x7DzM5QayA.jpeg" /></figure><p>This blog is a first post from the series of posts about revisiting the foundations of geometry and mathematics as a whole. We humans are visual animals and we have build theories, understandings about our world through pictures, words and drawing. I would like to invite you to learn mathematics in a more visual way. Let’s begin our journey.</p><p><strong>Math has a bad reputation</strong></p><p>In schools, mathematics starts with counting, drawing figures and gets into algebra, trigonometry and what not. Students tend to be excited with their early years in maths and already lost interest during their high schools.</p><p>This means we constantly face people who think there is no use of mathematics in their life and they have ruined their youth studying shit. I have even met programmers, engineers and computer science students who don’t have firm grip of mathematics and speculate on most mathematical theories and thinking.</p><p><strong>Math course should start with geometry</strong></p><p>I sincerely think maths must start with geometry as it provides us grounds why maths is necessary. Human mind is always looking for patterns. We are so accustomed to thinking visually that non-intuitive and hard to visualize theories are confusing for us to grasp. In our ever lasting search for patterns, we look for summarizing complex topics like texts, data and information in manner that is visually intuitive.</p><p>So, most of our findings are illustrative, graphical and have a lot of charts in them. We have tried to find shapes in data and information all the time. Our brain has been using geometry and comparing shapes forever.</p><p><strong>How to think like a mathematician</strong></p><p>When you think like a mathematician, first of all, you start to establish some facts. Then you move along by stepping on the facts and establishing more facts.</p><p>Here, let’s start with a single point in space. To establish a fact, you must first ascertain what a point is and how is a space defined. A point would be something with zero size. Unlike physics, mathematics allows zero sizes. The space we will be using is a two dimensional Euclidean space i.e. an infinite length and height that doesn’t meet or curve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbdjK3SFUaMBfQ0eyHbGtg.jpeg" /><figcaption>A point in 2D Euclidean space</figcaption></figure><p>If you could draw another point in the same space, in Euclidean space, the shortest path to the point would be a straight line. A line can be considered a path joining two points in space, straight line being the shortest. But you can also think a line as an extension of a point in one dimension. It’s like you have stretched a point in one direction and made a line out of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7z5s5F4YznF0_f-zozekQg.jpeg" /><figcaption>Straight line is the shortest path connecting two points</figcaption></figure><p>With the introduction of the shortest path, we came across Arithmetic. Our first encounter with numbers will be for comparing sizes. As happened to us in our childhood. Childhood brain compares all figures with sizes before interpreting what it is. Only later it develops complex understanding of shapes.</p><p>Now let’s move the line we draw. In mathematics this movement is called translation. In an infinite space, the translation mean nothing. What if we rotate the line from one of the points. For example, in the line above what if we hold one point with a thumb and rotate another point in a circular manner. We will end up creating a circle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEZ0u4ngLkRnFVZst5H40w.jpeg" /><figcaption>A circle is made if we rotate a line 360º from it’s origin</figcaption></figure><p>I always wanted to learn things in intuitive way. Because I am very poor in remembering, I hate to memorize and I hate when i can’t visualize what i am learning.</p><p>Using the same process of creating a circle, if we pull both points with equal effort vertically, we can create a rectangle and square. So, it’s like we are pulling and stretching points to create different shapes of geometry.</p><p>With these basic shapes the circle, square, rectangle and lines, we can create almost all geometric figures.</p><h3><strong>Numbers</strong></h3><p>When we are building intuition about shapes, we have seen that we are stretching (scaling), rotating and moving (translating) points. To create a definite shape and to replicate the process, we need to scale it in a definite fashion. Like if we want to draw two equal rectangles, we need to know what is the height and width of the two lines used to draw one.</p><p>Some shapes like circles are rotations. And some shapes like arcs, are circles which start at a certain angle and stops at a certain angle.</p><p><strong>Types of numbers</strong></p><p><strong>Natural numbers</strong> are those who are either equal to or more than zero. Like 0,1,2,3,4 … These are numbers we use to count objects in whole, also called whole numbers.</p><p><strong>Integers</strong> are numbers which is everything whole numbers have plus all the negative numbers. Like … -4,-3,-2,-1,0,1,2,3 …</p><p><strong>Rational numbers</strong> are those which can be written in the form of a fraction. Actually all numbers can be written in a fraction form if they are divided by 1. Like 1/1,2/1 … so, all numbers that are countable are rational numbers.</p><p><strong>Irrational numbers</strong> are those that doesn’t end in a decimal number. Like pi, whose value is 3.14156… and is never is ending.</p><p><em>I will slowly move forward in this series. Please wait for more.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfec9d62af4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most important single verse to remember in Hindu Mythology]]></title>
            <link>https://tneupaney.medium.com/most-important-single-verse-to-remember-in-hindu-mythology-38cc609d3a88?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/38cc609d3a88</guid>
            <category><![CDATA[universe]]></category>
            <category><![CDATA[mythology]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[upanisads]]></category>
            <category><![CDATA[hinduism]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 02:07:33 GMT</pubDate>
            <atom:updated>2021-01-15T08:08:11.437Z</atom:updated>
            <content:encoded><![CDATA[<p>Being born as a brahmin, i have access to Hindu texts and stories. Stories of kings and Maharajas, strong Prince and beautiful Princess. But the most that fascinated me are the verses in Sanskrit that talks about mathematics and science.</p><p>Sanskrit Vedic verses are about mythological characters &amp; stories and in most cases praises of gods and deities. They are easy to remember and made famous in pujas and rituals hindus do. There are some others describing philosophy, science and more. I have dig into some and came across this amazing Sanskrit verse from isopanisad. The first line and the ending line of isopanisad, an upanisad of the Hindu mythology goes like this:</p><p>ॐ पूर्णमदः पूर्णमिदं पूर्णात्पुर्णमुदच्यते<br>पूर्णस्य पूर्णमादाय पूर्णमेवावशिष्यते ॥<br>ॐ शान्तिः शान्तिः शान्तिः ॥</p><p>Word Translation:<br>1: Om, That is Purna (Full); This is also Purna; From Purna comes Purna.<br>2: Taking Purna from Purna, Purna Indeed Remains.<br>3: Om Peace, Peace, Peace.</p><p>Give yourself some time for reflection, then read along!</p><p>The word translation might have confused you, it literally translates to:<br>Purna is derived from Purna, Even after we take out some part of it Purna will remain.</p><p>The verse has many meanings, people have tried to interpret it in many ways. Theologists think it is talking about god. If something is taken out of god, god still remains full. In some hindu texts, humans are thought to be a part of god. Humans themselves are thought to be complete.</p><p>They believe, when god created humans, who are part of him, it will not deplete the vastness of god. And after we die, we recycle our soul, fulfil our duty. Those who fulfils their duty will get Mokshya and dissolve into god himself.</p><p>This verse has a very important place in Mathematics, too. Any mathematicians will love this verse immediately. The size of the Purna which when part of it is removed still remains the same is mind boggling. But the verse says more, it is not removing part of purna, but the part itself is purna.</p><p>According to mathematics, we can say that the above verse could relate to infinity and nothingness ( null ).</p><p>In mathematics, if there are two infinities, each of them are infinite. An infinity can be formed from another infinity and yet, the parent is still an infinity.</p><p>This idea doesn’t play well with our physical experiences, thus is very confusing. For example in the above statement, if you replace infinity with an apple, it doesn’t work.</p><p>Whereas in quantum physics we are amazed to see particles being created from nothingness, some short living, massless, charge-less particles are surprising physicists for long.</p><p>Physics is also struggling to understand the term information. It’s so ubiquitous and important that it is confusing. According to some schools of physics, information is never destroyed. So, the above definition fits well if we replace infinity with information.</p><p>In philosophy the null can be knowledge, as it can only grow if we share.</p><p>Link to isopanisad: <a href="https://sanskritdocuments.org/doc_upanishhat/iisha.pdf">https://sanskritdocuments.org/doc_upanishhat/iisha.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38cc609d3a88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improved WBC classification with CNNs]]></title>
            <link>https://tneupaney.medium.com/improved-wbc-classification-with-cnns-15930332a620?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/15930332a620</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[healthcare-technology]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[wbc]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Sun, 18 Mar 2018 06:55:20 GMT</pubDate>
            <atom:updated>2019-03-29T09:01:37.097Z</atom:updated>
            <content:encoded><![CDATA[<p>I found a WBC classification neural network developed by dhruvp in github. We would dive into the code and try to improve it. The code by dhruvp is here: <a href="https://github.com/dhruvp/wbc-classification">https://github.com/dhruvp/wbc-classification</a>. I wanted to improve the code and see if I could do any contribution. But before that, let’s have a closer look on how CNN is implemented and how his model is working.</p><h4>For the impatient</h4><p>Get the final code here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f0397322f7142350d2083f551c640a2/href">https://medium.com/media/5f0397322f7142350d2083f551c640a2/href</a></iframe><p>CNN or convolutional neural network is a deep learning methodology mostly used for classifying and understanding images. With a spark of deep learning, cheap hardware and open source tools, artificial intelligence and machine learning has gained significant traction for few years now.</p><p>I always wanted to sharpen my skills and what is better than to have a hands-on experience.</p><h4>Classifying White Blood Cells is hard</h4><p>WBC is part of our immune system and fights against antigens so we can be careless and keep our healthy habits at bay. But it’s really hard to extract nucleus from the blood smear and identify disease conditions without through investigation and expensive instruments. This however this is not readily available to many hospitals. The one thing that comes handy is the <a href="https://www.ncbi.nlm.nih.gov/books/NBK261/">less accurate automatic systems</a> available to do so, keeping all of us at risk.</p><h4>Neural Network for the rescue</h4><p>I will base myself with all the data provide by dhruvp and try to improve the results and findings. We will be using CNNs to classify WBCs. Here we will try to classify WBCs into two primary groups: polynuclear &amp; mononuclear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*YL8xlzEuMzu5-zagGBscSA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*5_fuvhI04Veps8BDuIJVlg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*r9irLAdw6nqY1_yYuDo8pg.jpeg" /><figcaption>Polynuclear cells: Basophil, Eosinophil, Neutrophil ( left to right )</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*si_L6AgsZ22HFN3hxU-9vA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*pmAU5yiDOunuGC_vVUG9Dw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*lu3UYRRJ6-jYTuzWb5XDcg.png" /><figcaption>Monuclear cells: Lymphocyte, Monocyte (left to right) , Types of WBC and an example of Leukemia ( right most )</figcaption></figure><h4>How are we classifying ?</h4><p>In a CNN, images are divided into smaller set of pixels where an algorithm will be used to find features. We will design different layers inside our system, once fed with test images: layers will filter them using the features and give us an output. At the end we want a <strong>binary output of either the image is Mononuclear or Polynuclear</strong>.</p><p><strong>The process</strong></p><ol><li>Feature Map</li><li>Dimensionality reduction or Pooling</li><li>Fully connected Layer or Dense Layer</li><li>Cost Function</li><li>Improvements</li><li>Comparisions</li></ol><p>I would like to go with a bare-bone structure and improve our system slowly. First let’s start with a single layer of <strong>convolutional network</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v0HL719pQjVVf4htKTfpzw.png" /><figcaption>Single layer Convolutional Network</figcaption></figure><p><strong>Data augmentation<br></strong>A neural network performs better if we provide it with a lot of data. When we have a small amount of data, like in our example, we need to artifically generate new data. This synthetic data generation can be done by cropping, skewing, zooming and rotating of images in our database.</p><p>In the image above, we have an input image ( here a monocyte ) and in our layer we have divided it into a set of features. It is basically a slice of the input image. This slice is fed to the filter, which will perform some mathematical operation (here, dot product) and provide us a number (weight) as an output. These two parts are called convolution or kernel. The weights from each convolution will tell us if the image is polynuclear or mononuclear.</p><h4>The Feature matrix</h4><p>We can add a lot of complexity to the network by dividing it into large number of feature sets. Inside a convolutional network, these features are actually divided into 3 dimensions ( <strong>W</strong>idth x <strong>H</strong>eight x <strong>D</strong>epth ). So, it will <strong>take a lot of memory space and consume a lot of resource</strong> if we are working on a large size of input image. CIFAR-10 is a freely available neural network training image dataset, where images are of size 32x32x3 (32w, 32h with 3 color channels (RGB)), so a single fully-connected neuron in a first layer would have 32*32*3 = 3072 weights. In our example, the images are in the dimensions of 640*480*3 = 921,600 weights. Quite huge huh!</p><h4>Choosing the right filters or activation functions</h4><p>Filters or activation functions are those that gives an output when two features are compared. There are tons of activation functions that we can use. Simplest being the linear function. That is, it draws a straight line to find features that match and give an output. Linear functions are accurate for discrete and predictable numbers. Another one is logistic function, which takes a sigmoid path and outputs are in the range (0,1). Logistic function provides a classification output so, matches when we want to choose between one and other. Hyperbolic tangent function is an extension of logistic function which gives an output or higher range ( -1, 1).</p><p>Logistic functions are fast and very useful. But in our case we want our output to be a feature comparision. So, we want if the feature matches the input or not. Basically, either a 0 or a 1, not anything in between. For that we use “ReLu” or <strong>rectified linear unit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*r63Kqq93YGVcF3nxk7lTTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Cf-9GLbYnxav3cZvRIQMcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*3m5h_dOCi7_NUOAQ7KAYcg.png" /></figure><h4>Reducing overhead with dimensionality reduction</h4><p>Downsampling is a mathematical process, which will reduce the size of a grid or kernel by doing a mathematical operation in each feature. In our example our images of 640*480 has to be reduced to 120*160.These are called poolig layer. Out of many pooling algorithms, max pooling takes the maximum value in an array to create another array. Average pooling on the other hand takes the average value in an array and creates another array. Read more <a href="http://deeplearning.net/software/theano_versions/dev/tutorial/conv_arithmetic.html">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8ff27934b2c8447bb4fa0f050273082/href">https://medium.com/media/d8ff27934b2c8447bb4fa0f050273082/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N39j6ppufzY479CpuLH-Ew.jpeg" /><figcaption>Max pooling and Average pooling</figcaption></figure><p>One <strong>caution while using dimensionality reduction</strong> will be, as downsample blurs out features, for example while working with text, it might blur out important regions and the output might be useless. But dimensionality reduction also <strong>improves our model’s prediction</strong> even if the image looks way different than those we used for training.</p><p><strong>Dense Layers</strong><br>Dense layers are fully connected layers which assumes it’s input as independent and performs the activation function accordingly. Before arriving to the dense layer, the data needs to be flattened.</p><blockquote>Neurons in a fully connected layer have connections to all activations in the previous layer, as seen in regular neural networks. Their activations can hence be computed with a matrix multiplication followed by a bias offset.</blockquote><p><strong>Cost Functions and optimization algorithms<br></strong>Our model is fully working by now. But the problem now is, it is not learning. It will give us an output put won’t learn from it’s mistakes. That is where we need optimization algorithms. The idea behind these algorithms is to minimize the cost function so that the finding is gets closer to the expected outcome. There are many optimization techniques, you can go <a href="https://towardsdatascience.com/types-of-optimization-algorithms-used-in-neural-networks-and-ways-to-optimize-gradient-95ae5d39529f">here to read more</a>.</p><h4>Improvements</h4><p><strong>Regularization with Dropouts<br></strong>As our model starts to learn, each neuron will have a weight associated with them. This weight starts to settle. Neighboring neurons rely on this weights and our output starts to be very specialized to the training data. In Machine learning, it’s called overfitting. This reliant on context for a neuron during training is referred to complex co-adaptations.</p><p>To handle this situation, we can introduce a dropout layer in our model which randomly removes some nodes in the network along with all of their incoming and outgoing connections. Dropout can be applied to hidden or input layer. Thus unlearning some of our features. Here is a gif to give you a hint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*qM6ZRfezI6mVLz7B9X0LvA.gif" /><figcaption>Dropout layers src: <a href="https://chatbotslife.com/regularization-in-deep-learning-f649a45d6e0">Regularization in deep learning</a></figcaption></figure><h4>Comparison</h4><p>I compared the graphs generated by his algorithm against mine to see if I could have any contributions. I found that by adding simple dropouts inside the model I could achieve far smoother lines for variation loss and accuracies, while maintaining the accuracy score of 98.59+% on test data.</p><p>Also the validation accuracy in my version remains greater than the training accuracy, which means we don’t overfit. Here are the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JPW8BI3X2DLeBa611Tg5ow.png" /><figcaption>Epoch Time/Result comparison</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*6s7ahWweMc-VXMFlVtYgHA.png" /><figcaption>Line Chart of Epoch time/result comparison</figcaption></figure><p>After a request I received in Twitter, I have also made changes to the code. Now i have included, a section where the model can be saved. We will be using:</p><p><em>model.save(‘final.model’)</em></p><p>Later we will be using tensorflow’s keras to import the model to a function and predict the outcome accordingly. You need to give location of where you have kept your testing files. I’ve kept mine at the images/TEST_EXTERNAL folder.</p><pre><strong>import</strong> <strong>tensorflow</strong> <strong>as</strong> <strong>tf</strong><br><br><strong>def</strong> prepare(filename):<br>    img_file = &quot;../images/TEST_EXTERNAL/&quot;+filename<br>    sizeX = 120<br>    sizeY = 160<br>    img_file = cv2.imread(img_file)<br>    img_arr = scipy.misc.imresize(arr=img_file, size=(120, 160, 3))<br>    <strong>return</strong> img_arr.reshape(-1, 120,160,3)</pre><pre>trainedModel = tf.keras.models.load_model(&quot;final.model&quot;)<br>prediction = model.predict([prepare(&#39;002.jpg&#39;)])<br><strong>print</strong>(int(prediction))</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15930332a620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In the name of Tic-Tac-Toe]]></title>
            <link>https://tneupaney.medium.com/in-the-name-of-tic-tac-toe-2ee92c5f210c?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ee92c5f210c</guid>
            <category><![CDATA[tic-tac-toe]]></category>
            <category><![CDATA[math]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[combinatorics]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Sat, 10 Mar 2018 07:18:42 GMT</pubDate>
            <atom:updated>2018-03-10T08:28:07.507Z</atom:updated>
            <content:encoded><![CDATA[<p>My 5 year old daughter loves to play tic-tac-toe. Mostly, my daughter wins the game, because I want her to get busy while I lose myself in the internet. Tic tac toe is a very interesting game, played in a 3x3 board, where each user either selects cross or circle. Mostly the “x” is the first player. The winner needs to have similar symbols in the diagonals or straight lines ( both vertical or horizontal ). This two dimensional 3x3 game of tic tac toe is a fun way to pass time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*9u-IL7tFBKTU5ULH4uvTSw.png" /><figcaption>Example of a first player win ( source: wikipedia )</figcaption></figure><p>While playing with my daughter, I can see when I start to lose and when we are heading to a draw, just after the third move. It quickly gets boring when we can predict the results. Regular tic-tac-toe in a 3x3 board, can get a bit boring — if both players are playing optimally, it always ends in a draw. So to keep the fun alive, we can actually play this game by expanding the size of the board. For example, instead of playing in a 3x3 board, we can play on a 4x4 board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*vnQrpfSi9VVndQkcIenbNA.png" /><figcaption>4x4 board ( source: internet )</figcaption></figure><p>In search for an interesting game, you can play tic tac toe in a board with a nXn size. In a normal 3x3 board, there are 9 possible moves for the first player, 8 for the second and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*D_zelmWhK8I8HpdvTnWbJA.jpeg" /><figcaption>Winning combinations in 3x3 board</figcaption></figure><p>In mathematics, combinatorics is a field that looks after possible combinations which could lead to a win or draw. There are 5 possible winning combinations in a 3x3 board. In the board above, we can see that if someone places their symbol in (2,2) or center of the board, they have the best chance to win. Next option being the corners.</p><p>We can increase the size of the board or maybe even increase the dimensions. For example Atari a very famous game console developer of 80’s build this 3D tic tac toe for the general public. And expanding the dimension to 3D is just a beginning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*wdIhFlewkJ7E5Y5P7fZksg.jpeg" /><figcaption>Atari’s 1978 3-D tic tac toe game</figcaption></figure><p>Tic-Tac-Toe is an easy game, so let’s switch to the 3-dimensions. The 3×3×3 Tic-Tac-Toe is a trivial first player win, the 4×4×4 Tic-Tac-Toe is a very difficult first player win (computer-assisted proof by O. Patashnik in the late 1970s), and the 5×5×5 Tic-Tac-Toe is a hopeless open problem (it is conjectured to be a draw game). Note that there is a general recipe to analyze games: perform backtracking on the game-tree (or position graph). For the 5 × 5 × 5 Tic-Tac-Toe this requires about 3125 steps, which is totally intractable.</p><p>We have a theorem called density Hales Jewett Theorem<strong>, </strong>which<strong> </strong>states that as you increase the dimensions, the number of squares you must black out to prevent a win gets arbitrarily close to 100% of the squares available. So in some high dimension, you’ll have to black out at least 90% of the squares; in some higher dimension upto 99.9999%.</p><p>There are other varients of alternate dimension tic-tac-toe, like treblecross: a one dimensinal (1Xn) tic-tac-toe variant, which is really fun to play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JYJtMIDAbkB3tZW99TfdWw.png" /><figcaption>Treblecross is a one dimensional tic-tac-toe variant. src:wikipedia</figcaption></figure><p>There is also a more sophisticated version called the Ultimate tic-tac-toe and it’s really fun to play, too. This variant gives the feeling of playing in a multi-dimensional board, and I totally enjoyed playing the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*-9oyu3SiHHYivka-XzDZRw.jpeg" /><figcaption>Ultimate tic-tac-toe src: mathwithbaddrawings.com</figcaption></figure><p>So, you are free to explore new versions, rules, dimensions and love the game.</p><p><strong>References</strong><br>1.<a href="https://mathwithbaddrawings.com/2013/06/16/ultimate-tic-tac-toe/"> Ultimate Tic-Tac-Toe</a><br>2. <a href="https://www.amazon.com/Combinatorial-Games-Tic-Tac-Toe-Encyclopedia-Applications/dp/0521184754">Combinatorial games, tic-tac-toe theory</a><br>3. <a href="https://en.wikipedia.org/wiki/Tic-tac-toe">Wikipedia — Tic-Tac-Toe</a><br>4. <a href="https://en.wikipedia.org/wiki/Tic-tac-toe_variants">Wikipedia — Tic-Tac-Toe Variants</a><br>5. <a href="https://www.rand.org/content/dam/rand/pubs/documents/2015/D1164.pdf">John Nash — Some Games and Machines for playing them</a><br>6. <a href="http://jordao76.github.io/ultimate-tic-tac-toe/">Online Ultimate tic-tac-toe</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ee92c5f210c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Through the eyes of a great Indian youth]]></title>
            <link>https://tneupaney.medium.com/through-the-eyes-of-indian-youth-16dbefa9fccf?source=rss-7af3dbb4d070------2</link>
            <guid isPermaLink="false">https://medium.com/p/16dbefa9fccf</guid>
            <category><![CDATA[youth]]></category>
            <category><![CDATA[society]]></category>
            <category><![CDATA[poverty]]></category>
            <category><![CDATA[economy]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Tushar Neupaney]]></dc:creator>
            <pubDate>Wed, 20 Sep 2017 04:31:01 GMT</pubDate>
            <atom:updated>2017-09-22T14:44:41.594Z</atom:updated>
            <content:encoded><![CDATA[<p>It was hot at the Lucknow railway station. My train was delayed, and I found a place to put my luggages and take some rest. Indian railways has been struggling to manage these delays. This means, lots of people need to spend hours at the station. In the platform, I saw a young boy, carrying a baggage in his shoulder, probably waiting to catch a train. The seat next to me was available and with a slow gait, he comes for a rest. This young boy was probably at the age of 15. His mysterious eyes caught my attention, which seems to be searching for something. <strong>His attire was unique, his clothes were new and he had this old bag in his shoulder.</strong> I couldn’t remember how the conversation started, but it went well into my memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPnc0_C0BOVNPrzVc9xzyg.jpeg" /><figcaption>Youths are struggling to understand the future and relate the past. photo: Tushar Neupaney</figcaption></figure><p>As India’s economic growth continues, I was wondering how young boys think about their future in India. India’s economic progress has been around for a short while. The poverty in wide spread and huge mass of people are still struggling to meet the ends.<strong> But there is a large population slowly moving towards prosperity.</strong> And a small population out there in the top of the pyramid. This young guy seems to be an aspirant of the Indian future. I was well acquainted about youths in Nepal, I just wanted to know what Indian youths think. So, I asked my question to him, <strong>“What would you like to be in the future?”</strong>. Future for sure, stores hope for all. When someone asks me about my future, I have stories and assumptions of hope to tell them. Something I hope I will achieve or something I guess I will gain. Not much of negativity one wishes to put forth. Obviously, my question sparked a joy in his eyes. But to my great surprise, he told me, he wanted to be an Indian army.</p><p>Not much have I thought, an Indian youth would like to be an Army. The newly found wealth and prosperity should have made him achieve a more materialistic future. Like being a job holder at some big house or opening a business. Most of the time, when I met young Indians, <strong>I’ve heard them talking loud and about on “MNC” or Multi national companies</strong>. Everyone was associated or wanted to be, with one of those. The increasing foreign direct investment into India was so lucrative, everyone somehow wanted to be attached to the bandwagon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvZE1e5YdrQY-HTnwY_ZHg.jpeg" /><figcaption>A railway station somewhere in Maharashtra photo: Tushar Neupaney</figcaption></figure><p>But this young guy was an exception. He has already completed his B.Sc and still wanted to join the army. He told me it takes a whole year to prepare for the exam at the Army and he has already started the preparation. I quickly asked him the next logical question “WHY ?” His answer was, it was his dream from his childhood, which he merely seems to cross. To get an answer, I need to edit my questions, so I asked him about his family. This boy’s family was apparently very poor. He started to look away and told me that his family had struggled hard for him.</p><p>Devastated by decades of poverty, cultural and social disparity, in India, poor people have very limited options. People’s cry for equality, government transparency and justice has been mere agendas for political campaign. With very limited hope for the poor, the struggle of the boy’s parents could easily be seen from his eyes. Rural Indians have different meanings for their “achhe din”. To cope with this constantly changing fashion, ideas, rhetorics and technology that a growing economy brings forth, is quite a challenge. For the poor, it’s a far cry. Another significant trend I have seen is the westernization of India. The food, the clothings and almost everything. This means, the skill sets of Indian workers are slowly becoming obsolete while multinational ventures are making huge profits. The coconut juice stall is empty while western drinks get more traffic. This sudden dilemma is pushing Indian society to new direction.</p><p>This young boy has two sisters, who are in class 9 and 10. A younger brother who is at home, not ready for school yet. He told me, his sisters wanted to become doctors, and his younger brother is very lazy. The army has an easier entry than others and have decent pay, though not comparable to others. While saying so, his eyes were wet and I could easily see the pain within.</p><p>His submission to labor was because of his poverty. Quite deceptively, the boy hides his pain while going through endless facebook posts and youtube videos he has in his phone. With free internet provided by Google in each station, there is a place to get lost.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16dbefa9fccf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>