<?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 Harish Gandhi on Medium]]></title>
        <description><![CDATA[Stories by Harish Gandhi on Medium]]></description>
        <link>https://medium.com/@hramachandran?source=rss-12e9de977ddb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ojZlMkQNQqJLjf0LqU0GLQ.jpeg</url>
            <title>Stories by Harish Gandhi on Medium</title>
            <link>https://medium.com/@hramachandran?source=rss-12e9de977ddb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 16:49:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hramachandran/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[Life Partner selection — by building a personalized recommendation system to shortlist dating…]]></title>
            <link>https://medium.com/@hramachandran/life-partner-selection-by-building-a-personalized-recommendation-system-to-shortlist-dating-192fa067b515?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/192fa067b515</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[dating]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Fri, 27 May 2022 15:13:34 GMT</pubDate>
            <atom:updated>2022-06-28T21:30:33.891Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a personal assistant to shortlist your life partner</h3><p>Finding your life long partner has always been a challenging task to achieve. And in this technology era, there are lot of dating apps that shows us profiles based on our preference, yet we have to spend a lot of time in just swiping right and left.</p><p>The main problem here is that the filters or the recommendation system shows us profiles that are not exactly what we prefer to have. Of course, filtering through <em>Geo-location, age etc </em>are important but also the <em>bio </em>of the person, which most of the apps doesn’t have a filter to process the bio(mainly because its harder to do a text based search/query).</p><p>This series of articles helps you <strong>shortlist based on your own personalized preferences, irrespective of the limitations of the dating app</strong>. You can call this recommendation service as a marriage broker — matchmaker, a better personalized assistant that matches our personal choices more than what the dating app offers.</p><p>This application is build specific to an app called Matrimony app — which is a common Indian dating app that eventually leads to Marriage(Mostly 😆). However this project, can be tweaked and used for any web based dating app.</p><p>Trust me, this helped me more than what Sima Aunty can do 😆</p><p>Note: This article doesn’t help you find love or your life long annoying partner. All it does is that it introduce you to potential candidates to choose from!</p><p>Enough of this blabber, now let’s start!</p><h3>How it works</h3><ol><li>Create a profile in the app to have login ID</li><li>Create a personalized search filter</li><li>Automate the data scrapping (coding starts here)</li><li>Data preprocessing and transformation</li><li>Build a recommendation system to shortlist the profile</li><li>Automate Swiping 😏</li></ol><p>Lets walk through the stake holders in each stages of the data driven development process:</p><h3>Analyst/Decision Maker/Entrepreneur Phase</h3><p>The first and foremost is to <strong>have a question</strong>, and it doesn’t have to be a right question to start with. Here, the question is simple:</p><blockquote>How can I build an efficient recommendation system that recommends me dating profiles based on my personal preferences</blockquote><p>Currently the web application recommends/matches me with around 5000 unique dating profiles per week. And the objective of this project is to build a personalized AI recommendation system and thereby target the matches to l<strong>ess than 100 profiles/week</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1kMk7F5QiDxDTQ8Q7mSDA.png" /><figcaption>Dating app matches my profile with 5,399 matches for a single day</figcaption></figure><h3>Data Engineer/Architect phase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*o7csXtphl5umPXNr.png" /><figcaption>Data Architecting and Engineering Phase</figcaption></figure><p>This phase of the project is the starting point, and it involves the automation and architecting data collection process with minimal human intervention. Since you will be dealing with at-least 1000 profiles a day, a proper engineered solution has to be put in place in order for the downstream stakeholders to do their part.</p><p>As the figures show, this phase is responsible for collecting profile ids and processing their data to the database tables. I will discuss more about this process in the future articles, and also show you how I used multithreading to reduce the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*L62QO4s223nM9Kvl.png" /><figcaption>Average time for downloading each profile id is 3 secs :)</figcaption></figure><h3>Machine learning Engineer/Data Scientist Phase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*--536UkOsJt689Fu.png" /><figcaption>Machine learning and automation phase</figcaption></figure><p>This phase of the work will be involving more on engineering and applying algorithms that are personalized to the end user. Checkout my data mining preprocessing techniques at <a href="https://docs.google.com/presentation/d/1Xczp7VL0WTivJO49z4MWANVodMY0At_jByY-iF5Gu0A/edit#slide=id.g37fa75daa1_17_238">PyData Talk(from slide 15</a>).</p><p>Data preprocessing and cleaning is the huge process as it helps in the later stages of applying algorithms to properly shortlist the profiles. The filtering of profiles even starts from this stage of the process. Below are the features/attributes needed to be populated through our data extraction process.</p><pre>{<br>    &quot;id&quot;: &#39;&#39;,<br>    &quot;html_info&quot;: &#39;&#39;,<br>    &quot;mother_tongue&quot;: &#39;&#39;,<br>    &quot;about_her&quot;: &#39;&#39;,<br>    &quot;partner_expectation&quot;: &#39;&#39;,<br>    &quot;family_details&quot;: &#39;&#39;,<br>    &quot;college&quot;: &#39;&#39;,<br>    &quot;profession&quot;: &#39;&#39;,<br>    &quot;income&quot;: &#39;&#39;,<br>    &quot;sisters&quot;: &#39;&#39;,<br>    &quot;brothers&quot;: &#39;&#39;,<br>    &quot;speaks&quot;: &#39;&#39;,<br>    &quot;location&quot;: &#39;&#39;,<br>    &quot;age_height&quot;: &#39;&#39;<br>}</pre><h3>Data Scientist/Decision Maker Phase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cU1aVxBNji3kuwVL.png" /><figcaption>Zooming on the ML phase where data scientist/analyst play a major role</figcaption></figure><p>These are the people who iteratively build a system and change the logic around the changes in the data. Business domain plays a critical role in solving what is needed in order to achieve our project objectives.</p><p>Attributes from the html text has to be extracted to apply our algorithms, and these attributes later become our feature and based on the weightage(importance), one can built efficient algorithm. The below image shows the extracted features populated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*SeUh7-MweCIOnv7b.png" /><figcaption>Table with Populated Features</figcaption></figure><p>One of the common text mining and natural language processing<strong> </strong>approach is to understand the bigram. They are basically a set of co-occurring words within a given window(checkout my bigrams explanation at <a href="https://nbviewer.org/github/harishaaram/Talks/blob/master/PyDataChi/Project2/PyDataChi_Project2.ipynb?flush_cache=True">PyData talk</a>). As you can see from the bigram figure below, the most occurring pair of words are common among most profiles(like <em>middle class, nuclear family</em> etc.) which makes recommendation from bio quite difficult. This lead to a very skewed dataset as shown figure below in the database table, the recommended shortlisted profiles are less than 0.1% of the total data profiles collected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*f_knhxLOHCMCFmvl.png" /><figcaption>Most occurring pair of words in the bio</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*gOPn53s83dX_RjER.png" /><figcaption>Labels indicating the shortlisted profiles( 1 implies shortlisted and 0 not shortlisted)</figcaption></figure><h3>Conclusion:</h3><p>We have seen on high level how one can automate the process and build a recommendation system specifically for dating. However, this approach is similar to any process that requires a decision on big data problem.</p><p>Decision making is a quite interesting and a challenging process especially if it has some significance in your life — like choosing a partner. Ultimately, one should always evaluate the decision quality based on what was known at that point of time. Here is an article of quick summary of book on decision making: <a href="https://medium.com/@hramachandran/art-of-decision-making-paradox-of-choice-d25e26c2c4f4">https://medium.com/@hramachandran/art-of-decision-making-paradox-of-choice-d25e26c2c4f4</a></p><blockquote>AI will always assist in our decision making, but can not replace the human hand in turning on the green light<em> ✅</em></blockquote><p>Keep tuned for the detailed approach in each of the stages in my future articles and I will also discuss the challenges involved and the interdependency of stakeholders in each phase of the project.</p><h3>Terminologies:</h3><ol><li>Profile ID: Unique ID representing the dating profile of an individual.</li><li>Features/Attributes: The column name of the table.</li><li>Shortlist: These are the partner profiles which matches the users preference.</li></ol><h3>Thanks for reading!</h3><p>If you liked this article keep sharing with your community 👏</p><p>Reach out to me on <a href="https://twitter.com/Harishaaram91">https://twitter.com/Harishaaram91</a> if you want me to give a lecture/talk on this project.</p><h3>Links:</h3><ol><li>Project python open source code(MIT License):<a href="https://github.com/harishaaram/DatingRecommendationApp">https://github.com/harishaaram/DatingRecommendationApp</a></li><li>Project implemented in GCP cloud(you have to pay once your credits/free usage are utilized): <a href="https://github.com/harishaaram/DatingRecommendationApp/tree/main/gcp_bash_script">https://github.com/harishaaram/DatingRecommendationApp/tree/main/gcp_bash_script</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=192fa067b515" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Art of Decision Making — paradox of choice]]></title>
            <link>https://medium.com/@hramachandran/art-of-decision-making-paradox-of-choice-d25e26c2c4f4?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d25e26c2c4f4</guid>
            <category><![CDATA[decision-intelligence]]></category>
            <category><![CDATA[decisions]]></category>
            <category><![CDATA[fear]]></category>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[choices]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Sat, 01 Jan 2022 03:45:01 GMT</pubDate>
            <atom:updated>2022-01-01T03:45:01.477Z</atom:updated>
            <content:encoded><![CDATA[<h3>Art of Decision Making — paradox of choice</h3><blockquote><em>“</em>To be or not to be<em>” is the genesis of each and every choice we make</em></blockquote><p>This article is just a summary of the book —<em> The Art of Decision Making by Joseph Bikart</em></p><h3>Part I: Indecision</h3><p>In this part, the author talks about the various factors or reasons that we tell ourself from not making the decision.</p><p>We may think a decision is just a matter of bringing about the best available outcome, but it can be more fundamental than this. One of the things that may hold us back is an attachment to known comforts, or conversely a fear of the unknown.</p><p><strong>Defence forces</strong><em>: Why decide on something new when the status quo seems much more efficient? </em>It is an effective defense mechanism, creating an illusion that we’re more focused and efficient</p><p><strong>Procrastination</strong>: is not a good strategy in committing to a decision. Sometimes people invoke good strategy/plans as as disguise for trepidation. One should note that, we can’t step twice in the same stream.</p><p><strong>Perfectionism: </strong>We should be grateful for the decision we have, rather than fearful about the knowledge we lack. If we are inclined to postpone a decision for perfect decision, we should ask ourself what is the critical information that will make all the difference? If so, how much you of it you need?</p><p><strong>Fears about the choices we make:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*Ci0arfGXPkKR5Z7ShOgqaA.png" /><figcaption>Will Smith Quote— After Earth Movie</figcaption></figure><ol><li>Fear of rejecting a better option</li><li>Fear of choosing the wrong option</li><li>Fear of failure</li><li>Fear of reaching heights</li><li>Fear of Identification(the belief that any criticism of what we have created is a criticism of the intrinsic self, its one of the main reason why we have dilemma in taking a new project)</li></ol><p>The best decision making emerges when we allow ourselves to be authentic. Worrying about how a decision, or its consequences, will make us appear to others is likely to result in poor choices, and will rob us of any prospect of true fulfillment.</p><h3>Part 2: Knowing yourself</h3><p><strong>Hidden Chamber</strong>:Decision making has to involve tapping into our intuition. We may never attain the perfect decision, but our exploration must begin with our own feelings, sensation and intuition about what is needed. In that respect, all decisions — and especially tough decisions — are a voyage of self-discovery.</p><p><strong>Options</strong>: When facing tough decisions, not only do we need to create more options, we also need to establish what the main variables are, and to question ourselves regarding our underlying motivations. This too is about interests, not positions.</p><p><strong>Selection</strong>: Decision making is about discernment — including discerning what your personal needs and priorities are. To focus too much on the details of the possible choices that appear to be available can lead to a decision that is not thoroughly informed by self-knowledge — and therefore flawed. Think of yourself as steering a ship through a complicated passage amidst hazards. Your ultimate concern is not the hazards but the ship itself, which must end up 1) intact, safe and 2) set toward an appropriate future.</p><p><strong>Action</strong>: “ALL SET TAKE” — and because nothing can get in the way, doubt is not welcome to the party — it would only lead to postponing. Taking a leap of faith is necessary but not easy. The only way to learn diving is to dive, learn to ride by riding, we learn public speaking by speaking in public; and so we must learn to decide by deciding.</p><p>The act of leaving one’s intimate comfort zone, is also the journey that takes us to ourselves, our true essence and our ultimate purpose.</p><p>We make our luck the same way we make our destiny. We may not have all the cards, but if we have a good enough hand, this may be all we need. If the “action” phase of decisions involves the leap of faith discussed earlier, it needs to start with faith in ourselves: the belief that we can do it.</p><p><strong>Resolution</strong>: is not just a phase in decision making. It is also a state of mind, even a state of being, a state of soul. On this note, we need to recognize that the temptation to go backward is ever present.</p><p>Our Journey toward decision making will encounter doubt along the way — indeed, it may even be filled with doubt. We may find ourselves surrounded by desert, a desolate and depressing wilderness where we had hoped for paradise. Two and a half millennia ago, Confucius said: “wheresoever you go, go with all your heart”. Which can also be understood as to go one step at a time and don’t ever go backwards; when you eventually get there, you will find no limit to where you can go.</p><p><strong>Completion</strong>: In business, people rarely have the luxury of enough time to seek perfection — for example, when launching a new product. Of course, they need to make sure their new product will meet all the necessary technical requirements( for example, complying with safety regulations): but by seeking constant improvement, they risk losing their “first mover” advantage, and letting a competitor reap the rewards of their hard work.</p><p>As with virtue, there is no peak of perfection, only a perfect balance between two extremes. As we get closer to completing a work/decision making, this dividing line becomes thinner: it is only when we intuitively know, at the last moment, that anything more might worsen the results.</p><h3>Part 3: The Momentum of Decisiveness</h3><p>Only by moving can one comfortably maintain one’s balance!</p><p><strong>Decision Flow</strong>: Research shows that activities that are most likely to create flow are those that are challenging and at the same time require our most advanced skills.There is only so much we can control and any attempt to override this limitation is doomed and will lead to the kind of fixation that results in psychic entropy, the opposite of flow.</p><p>Flow happens when consciousness of the self is lost: the ego recedes into the background. As a result, flow experiences are largely egoless experiences. There are two personality profiles that prevent flow:</p><ol><li>Excessive self-consciousness: someone who is forever anxious about how others will perceive them and is afraid of creating a bad impression or of doing something inappropriate.</li><li>Excessive self-centered: Person who is usually not self-conscious, but instead evaluates every bit of information only in terms of how it relates to his desires.</li></ol><p>These traits prevent the flow because one’s attention has become too rigid, too narrowly focused.</p><p>People who experience flow dedicate themselves to “doing their best in all circumstances”, but this doesn’t mean pursuing the dictates of self interest. Instead, it means committing to exerting their talents as effectively as possible to attain the optimum outcome.</p><p>They know they are not compelled to complete a task they have started, but something in them keeps them going and will not allow them to give in. This is, I believe, both a source and a consequence of the flow experience.</p><p><strong>Emotion-Feeling-Thought-Speech-Action:</strong>Verbalizing can make a crucial breakthrough in decision making, even when we are thinking and acting alone. Often just a single phrase, accurately expressed, can give you a useful compass bearing in your decision making.</p><p>Inconsistencies between thought, speech and action are the main culprits. The momentum chain gives dynamism to a life force.</p><p><em>Intentionality</em>(the fact of being deliberate or purposive) matters a great deal to decision making because it is the purest and most original manifestation of our will, of our conscience. This is what we need in order to quieten our fears. It is the energy that moves the roadblocks of fear from our chosen path. It is what reveals our will and, at the same time, unleashes the power of momentum.</p><h3>Part 4: The Deciding Mind</h3><p>If we understand where our feelings, desires, thoughts and fears come from, we are better placed to make decisions that serve us effectively. A questioning form of self-analysis is always a good starting point for decision making, since it respects one of the key principles of human behaviour: the idea that our choices are presented to us not in a vacuum but as natural extensions of a fully lived life.</p><p>Two Techniques to help in your decision making process:</p><ol><li>If you Imagine you are advising a stranger on the best course of action in a situation that mirrors your own, the “<strong>distance</strong>” involved in this can help you make a good decision for yourself. This is an excellent approach to take when the effort of self-analysis seems more than you can manage at the moment for example because your issues are particularly complex or painful.</li><li>Imagine ourselves at the “<strong>point of death</strong>”. one should look at and consider the situation on the day of judgement and think how at that moment you would want to have chosen in the present matter; and adopt now the rule that I would then want to have observed. with this in mind — the ultimate hindsight — which of course of action would be most proud of ?</li></ol><p>In Each of these suggestions the common link is the distance and perspective: distancing ourselves from our preferences, from our egos, and from our living selves; and gaining clarity and insight from the remote position. Research shows that we can gain clarity and insight by taking an artificially remote position .</p><p>Use <strong>WRAP</strong> when faced with challenging decisions, it involves these four steps:</p><blockquote>W — Widen your options</blockquote><blockquote>R — Reality-test your assumptions</blockquote><blockquote>A — Attain distance before deciding</blockquote><blockquote>P — Prepare to be wrong</blockquote><p>We should be aware of our immediate emotions one way of achieving this distance from our present emotions is the <strong>10–10–10 method</strong>. These are how I will feel about this 10 minutes from making a decision? How will I feel after 10 months? and finally after 10 years?</p><p>Such Reflections would not be a negation of emotions. Rather this technique is meant to distance us from our short-term emotions, placing them in the perspective afforded by medium-term and long-term ones.</p><p><strong>The concept of View through a window</strong>: Perspective lines to a vanishing point within the “window” of a frame give a useful analogy for effective decision making. A 360-degree view is not helpful. We need to focus on what is relevant. Some decision-makers swamp their own vision of a situation by trying to master a detailed and comprehensive picture of the context. Better to be selective, following one’s intuitive judgement.</p><p>The scope of a decision will also include the time we give ourselves to execute it. Sometimes, the timing is imposed on us: there is a deadline to observe. But when this is not the case, when the horizon line is blurred, we should set ourselves a time-frame within which to make our decision. Without such delineation we are giving ourselves an open-ended invitation to procrastinate, whilst we are busy blaming our own busyness. As if we were an artist, our first concern should be the selection of a canvas of the right dimension.</p><p><strong>Decision-making model</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NVRY_7V3uUVP403V" /></figure><p>The distance between ego and decision is a constant. What this implies is that any time spent trying to get closer to a decision, or to the heart of a decision, is time wasted if this is driven by the ego. We will never narrow this gap. The best we can do is to move the decision in the direction of the right of the chart, as far away as possible from conceptual/ideal (that is, the “what could be”) and toward reality (the “what is”). The ego can play its role in this process, by making progress (horizontally) toward the Self. It does this either in a “Self-effacing” way, whereby the ego disappears in favour of the Self; or by aligning itself with the Self, and thereby bringing the decision to its optimal place for realization. This also implies that by focusing on the decision itself and its materialization, rather than on “what’s in it for the ego”, we will derive the same kind of positive outcome.</p><p>Distancing yourself from your decisions, and judging whether they’re right for you, is no easy task. You need to understand the difference between the requirements of the ego and those of the Self. In simplified terms, the ego’s perspective is narrow, close-focusing, short-term, whereas the self’s view is broad, far-seeing, long-term. That doesn’t mean that the ego is intrinsically wrong: sometimes, in the practicalities of a decision, you need to be focused and to ignore the bigger picture. However, the Self embraces the whole context of the decision, looking at what will best serve your life, your personal journey. By dropping the ego’s guard and aligning it with the self you can judge your decision more wisely. Expose the ego to the Self’s wisdom and the Self to the ego’s capability: ease the tension between the two.</p><p>Shifting from ego-centric, and focusing on the self, is more likely to break the deadlock of procrastination of decision making.</p><p>Alternatively, we can achieve the same outcome by focusing on the decision rather than the implications for ego or self. This shifting of the decision toward the right of our chart will pull the ego toward the middle, making it more aligned with the Self.</p><p>If decisions are good, they collude with us to create joy. If they’re bad, they subtract something from us and create sadness. The blueprint behind this principle is our inner necessity, because what is good for us, what brings us joy and elevates us, is what is needed by our soul. This inner necessity is therefore also a determining factor when it comes to our decision making.</p><p><strong>The Thread between our decisions</strong>:If we give up, even temporarily, the belief that decisions are either right or wrong, positive or negative, we open a window to a new way of life. Here, our approach to the outcomes of decisions is neutral, what matters is the effect they have on us. Sometimes, what may look like a “wrong” outcome may point us in the direction of a true vocation. Even if the immediate outcome can be viewed as negative, the ultimate effect may be ideal. The same is true of decisions. What matters most is the thread between them, how they’re connected and how each decision builds on the body of experience we have acquired in our lifetime to date.</p><p><strong>Engaging with the flow of the will</strong>:You can decide to do, to get, to become anything you set your mind to. There’s no guarantee you will succeed, or that your wishes will be realized; but this means that, over time, the decision you make will become more tuned in to your true Self. and if you fail occasionally, this is the sign that you have stretched yourself outside your comfort zone, which is exactly what the space you should be exploring. Welcome “misses”(failures) are a likely sign you’re aiming high, and that you find yourself on the right path.</p><p>Choice options A, B today may change to C,D,E tomorrow. This highlights the significance of engaging with the flow, when making decisions. Don’t procrastinate, waiting for a month to make the decision. The successful clients and chief executives tend to be those who are fully engaged in a permanent flow of decision and activity. In their world, one thing always leads to another, without any stress necessarily intruding into their lives, but on the contrary in a highly organized, efficient and natural way. This doesn’t only happen at work. It seems that even their holidays perfectly fulfil their integrated goal of unwinding — something they can also achieve with great dedication!</p><p>Our decisions form a thread, and this thread is more important than any individual decision. We need to engage with the thread, with sufficient momentum, or else risk being stuck in indecision. This doesn’t mean that we need to be constantly making decisions, but that we need to be alert to the opportunities for making them. Even when we feel stuck, we have options. It may be that we are attempting to follow more than one thread, creating a conflict we can best solve by abandoning at least one of them. Such realization may have the power to set us on a new and more positive path.</p><p><strong>Our Narrative</strong>:Trust yourself; create the kind of self that you will be happy to live with all your life. Make the most of yourself by fanning the tiny, inner sparks of possibility into flames of achievement. This describes realistic ambition: the best we can aim for, is not the self but merely a “kind of self”. This is an analogy or approximation of the self, and our inspiration in this quest does not stem from the ideal, conceptual world but from the phenomenal world — namely: those sparks of possibility.</p><p>Experience — “to try,to attempt”; it follows that our experience of the Self must rely on our attempting to do things, to derive empirical evidence of the Self’s nature. Experience is shelving in that it circles upon the Self afar, rather than analysing it — since to analyse is, literally, to break something up into smaller parts, an exercise that would be doomed by nature.</p><p>Therefore, <strong>the experience of the Self is essentially about trying, not about succeeding</strong>. It doesn’t contain any hint of the experience’s outcome. It is almost as if the outcome were utterly neutral, as long as each experience informs the subsequent one.</p><p>From this we derive the notion that if we want “to create the kind of self you will be happy to live with all your life”, the approach we must follow is entirely diagnostic: it does not start with a grand vision of the Self, but it involves constantly probing, constantly trying. This is about accessing discrete moments of knowledge, recognizing things that are apart, and whilst we do so, failing, learning and trying better each time.</p><p>Experience, the act of trying, is not the adherence to a new religion of fate and randomness: it is the act by which randomness informs knowledge, and therefore judgement. Experience is that window we open onto the world, whereby we let in sparks of randomness in order to discern a uniting order among them.</p><p>What comes out of this experience? Essentially, it is a feeling, an intuition of the Self. There is a word that means(both etymologically and literally) the “action of pressing out a feeling”: this word is “expression”</p><p>Understanding the threads between our past choices helps us assess each new decision, and how it reflects our character. This process is dynamic, as each new decision also informs our own blueprint for who we want to be. It helps us elevate ourselves through the medium of decision making. Only experience will confirm, each time and with each decision, whether we are on the right track. And our ability to express what we have learnt from such experiences is what gives meaning to our lives.</p><p>Through the normative power of hard choices, “we create reasons for ourselves to become this kind of person rather than that; we wholeheartedly become the person that we are ; we become the authors of our own lives”</p><p>When facing hard choices, it is only by throwing in the weight of our volition that we can create the momentum needed to progress. Otherwise we drift, or we wait idly on the river bank until fate decides for us — and waiting is no safe option.</p><p>“Becoming one with the will” is truly normative. It is through our identification of the right time, place and way to engage with the will that we write the story of our lives. In creating, through accurate use of our volition, our own story, we also create our own luck.</p><p>Often, instead of asking ourselves, “Is option A or Option B better for us”, the question should be ,” Since option a and option b are on a par; when/how will I throw myself into this decision, and make this hard choice, which will be transformative for me?”</p><p><strong>Nostalgia of the future: </strong>In this tense, the “tension” is of different nature. Here the expression “i will” means “i wish i could”. It is tainted with the fear that we may not deserve or be capable of the outcome we desire. It limits our scope. It forces us, once again, “to walk in shoes too small for us”</p><blockquote>The most painful state of being is remembering the future, particularly the one you’ll never have</blockquote><p>There is only one way to heal this pain: following the principle of active form.</p><p><strong>The active form</strong>: The question we should ask ourselves is not “what will i do next?” but instead, “can i decide to be able to fully live the life that i am living?” what this implies is that any difficult we have with a decision — which by definition involves a future state — is essentially a difficulty we have with our present condition. Being unable to decide, we reveal ourselves as ignorant of ourselves, our affects, our desires. We also reveal our inability to accept what we have become. The active form urges us to embrace our present state, the only one in which we feel, desire, think, are.</p><p>The excavation in the book, having methodically catalogued the artefacts that the author painstakingly unearthed, one might find them on the brink of another, deeper, more personal exploration — one that cannot solely happen in a book, but for which one must elect to become, at once, the archaeologist and the site of this future expedition.</p><h3><strong>Conclusion:</strong></h3><p>Our toughest decisions, painful as they may be, offer us a unique window into the world, both external and internal. The exposure to chaos they employ shouldn’t be feared but warmly greeted. This chaos exists in the world, perhaps as a mere reflection of the necessary chaos that resides in ourselves. In this daunting realization may lie our salvation.</p><blockquote>One must still have chaos in oneself to be able to give birth to a dancing start. You still have chaos in yourselves</blockquote><blockquote><em>— — Friedrich Nietzsche</em></blockquote><h3>Link:</h3><ol><li>How to tackle toughest decisions: <a href="https://hbr.org/2016/09/how-to-tackle-your-toughest-decisions">https://hbr.org/2016/09/how-to-tackle-your-toughest-decisions</a></li><li>Sheldons way of decision-making: <a href="https://www.youtube.com/watch?v=BVIjqd8DBGw">https://www.youtube.com/watch?v=BVIjqd8DBGw</a></li><li>How to make hard decisions:<a href="https://www.ted.com/talks/ruth_chang_how_to_make_hard_choices?language=en">https://www.ted.com/talks/ruth_chang_how_to_make_hard_choices?language=en</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d25e26c2c4f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate the data extraction using AWS — S3, Lambda, CloudWatch Events[Part 2]]]></title>
            <link>https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-2-254002056a97?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/254002056a97</guid>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Sun, 04 Nov 2018 22:18:17 GMT</pubDate>
            <atom:updated>2022-06-24T16:24:55.610Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automate the data extraction using AWS — S3, Lambda, CloudWatch Events[Part 2]</h3><h3>Objective</h3><p>I want to collect the news from the <a href="https://news.ycombinator.com/">Hacker news</a> website on a daily basis. However I only want to collect those articles that have a <strong><em>score</em></strong><em> </em>more than 100 points.</p><p>Before you start , checkout my <strong>part 1 — Setup phase</strong>: <a href="https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-1-563a00118394">https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-1-563a00118394</a></p><p>Now creating the Lambda function/code.</p><h3><strong>Creating a Deployment Package</strong></h3><h4><strong>Step 1: Build a python Script</strong></h4><p>Before we start we need to import these packages <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">boto3</a>, B<a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">eautifulSoup</a>, <a href="http://docs.python-requests.org/en/master/">requests</a>, time, json.</p><pre><strong>import </strong>boto3<br><strong>import </strong>json<br><strong>import </strong>requests<br><strong>from </strong>bs4 <strong>import </strong>BeautifulSoup<br><strong>import </strong>time</pre><p>I had used three functions here:</p><ol><li><a href="https://docs.aws.amazon.com/lambda/latest/dg/python-programming-model-handler-types.html"><strong><em>lambda_handler</em></strong><em>(event, context)</em></a><em>: </em>This is the function that gets invoked when the service executes the code.</li></ol><pre><strong>def lambda_handler</strong>(event, context):<br>    data = collect_data_from_website()<br>    <strong>for </strong>key, val <strong>in </strong>data.items():<br>        <strong>if </strong>int(val[&quot;points&quot;].split(&quot; &quot;)[0]) &gt; 100:<br>            file_name = time.strftime(&quot;%m%d&quot;)+&quot;/&quot; +str(val[&quot;title&quot;])<br>            save_file_to_s3(&#39;hackernews-bucket&#39;, file_name, data[key])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJnJwjuXE5YaV6glQL36xw.png" /></figure><p><strong><em>2. collect_data_from_website</em></strong><em>(): </em>I scraped the articles based on their score(&gt;100) values.</p><p><strong><em>3. save_file_to_s3</em></strong><em>(bucket, file_name, data): </em>Here we pass in our data dictionary into the bucket.</p><pre><strong>def save_file_to_s3</strong>(bucket, file_name, data):<br>    s3 = boto3.resource(&#39;s3&#39;)<br>    obj = s3.Object(bucket, file_name)<br>    obj.put(Body=json.dumps(data))</pre><p>Since this project needs third party libraries(<em>requests</em> and <em>BeautifulSoup</em>), we can’t directly copy paste the code on to the Lambda <em>function code inline feature.</em>we need to deploy it as a zip package along with the libraries.</p><h4>Step 2: Create the Zip file</h4><p>There are various ways of <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html">deploying the package</a>. I am going to show how you can do it through a <strong>linux terminal virtual environment</strong>.</p><p><strong>Steps:</strong></p><ol><li>Create a virtual environment on your directory(<em>virtualenv myenv</em>)</li><li>Activate it(<em>m</em>yenv) and store your <em>lambda_function.py</em> script</li><li>Install your third party libraries(<em>pip3 instaill requests bs -t .</em>)</li><li>Zip the package along with your script file(<em>lambda_function.py</em>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muFzSSuHys3pTsKBTjdmuw.png" /></figure><h4>Step 3: Upload and test</h4><ol><li>Before uploading the zip file, make sure your <em>Handler </em>name is same as the <strong>filename.filehandler(say <em>lambda_function.lambda_handler</em>)</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ywRcx60mpzqDcrU4Cr_XA.png" /></figure><p>2. Save and test your code.</p><p>3. A prompt window will appear for some <em>Event name</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHWohytE8EYMvQKShaSc5Q.png" /></figure><p>4. TEST it! 😏</p><p>Note: <strong>Change the <em>timeout</em>(</strong><em>otherwise time execution error will occur</em><strong>)</strong> from your <em>basic settings</em>(scroll down your lambda function page)</p><h4>Step 3: Output:</h4><ol><li>Check out S3 bucket(<em>hackernews-bucket</em>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wq9D4F8RNpSP7o1jmLyaGQ.png" /></figure><p>2. You will see the articles with score greater than 100 points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IoB1fRWkism9qgnWgvKhyw.png" /></figure><p>3. Click on any of the files using the <em>select from</em> and have a <em>JSON </em>preview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7OErhqt5ZtHALSR-OLD8vQ.png" /></figure><h3><strong>Full code:</strong></h3><pre><strong>import </strong>boto3<br><strong>import </strong>json<br><strong>import </strong>requests<br><strong>from </strong>bs4 <strong>import </strong>BeautifulSoup<br><strong>import </strong>time<br><br><strong>def lambda_handler</strong>(event, context):<br>    data = collect_data_from_website()<br>    <strong>for </strong>key, val <strong>in </strong>data.items():<br>        <strong>if </strong>int(val[&quot;points&quot;].split(&quot; &quot;)[0]) &gt; 100:<br>            file_name = time.strftime(&quot;%m%d&quot;)+&quot;/&quot; +str(val[&quot;title&quot;])<br>            save_file_to_s3(&#39;hackernews-bucket&#39;, file_name, data[key])<br><br><strong>def collect_data_from_website</strong>():<br>    data = {}<br>    page = requests.get(&quot;https://news.ycombinator.com/&quot;)<br>    soup = BeautifulSoup(page.content, &#39;html.parser&#39;)<br>    table = soup.select(&quot;td&quot;)<br>    key_title = &quot;&quot;<br>    <strong>for </strong>row <strong>in </strong>table:<br>        score = row.find(&quot;span&quot;, {&quot;class&quot;: &quot;score&quot;})<br>        link = row.find(&quot;a&quot;, {&quot;class&quot;: &quot;storylink&quot;})<br>        <strong>if </strong>link:<br>            key_title = link.get_text()<br>            data[key_title] = {<br>                &quot;title&quot;: key_title,<br>                &quot;link&quot;: link.get(&#39;href&#39;),<br>                &quot;points&quot;: &quot;0 points&quot;<br>            }<br>        <strong>if </strong>score:<br>            <strong>if </strong>key_title <strong>in </strong>data:<br>                data[key_title][&quot;points&quot;]=score.get_text(strip=<strong>True</strong>)<br><br>    <strong>return </strong>data<br><br><strong>def save_file_to_s3</strong>(bucket, file_name, data):<br>    s3 = boto3.resource(&#39;s3&#39;)<br>    obj = s3.Object(bucket, file_name)<br>    obj.put(Body=json.dumps(data))</pre><h3>References:</h3><ol><li>Free AWS usage: <a href="https://aws.amazon.com/free/">https://aws.amazon.com/free/</a></li><li>API usage for Amazon S3: <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-examples.html">https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-examples.html</a></li><li>Pip install documentation: <a href="https://pip.pypa.io/en/stable/reference/pip_install/">https://pip.pypa.io/en/stable/reference/pip_install/</a></li><li>Different ways for Job Scheduling in pyhton: <a href="https://raybuhr.github.io/talks/python-job-scheduling/python-job-scheduling.html#/">https://raybuhr.github.io/talks/python-job-scheduling/python-job-scheduling.html#/</a></li><li>No module named lambda function: <a href="https://www.iheavy.com/2016/02/14/getting-errors-building-amazon-lambda-python-functions-help-howto/">https://www.iheavy.com/2016/02/14/getting-errors-building-amazon-lambda-python-functions-help-howto/</a></li><li>Resolve import errors during deployment: <a href="https://davidhamann.de/2017/01/27/import-issues-running-python-aws-lambda/">https://davidhamann.de/2017/01/27/import-issues-running-python-aws-lambda/</a></li><li>Lambda function errors: <a href="https://www.iheavy.com/2016/02/14/getting-errors-building-amazon-lambda-python-functions-help-howto/">https://www.iheavy.com/2016/02/14/getting-errors-building-amazon-lambda-python-functions-help-howto/</a></li></ol><h3>Thanks for reading!</h3><p>If you liked this article keep sharing with your community and consider exploring what happens when you click the clap icon more than once 👏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=254002056a97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate the data extraction using AWS — S3, Lambda, CloudWatch Events[Part 1]]]></title>
            <link>https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-1-563a00118394?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/563a00118394</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[scheduling]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Sun, 04 Nov 2018 16:20:32 GMT</pubDate>
            <atom:updated>2018-12-03T17:45:37.503Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Space and Time efficient</strong>!</p><h3><strong>Why do you need it?</strong></h3><p>Initially I was doing the data extraction pipeline all by myself! Running a cron-job every day 10 am in the morning and storing it in my local machine! I know it’s a tedious process until I found out about these <strong>workers</strong> who can do it for me at <a href="https://aws.amazon.com/free/"><strong>ZERO COST</strong></a>(for free tier account)! Saves a lot of your <strong>productive time</strong>(and your <strong>hard-disk memory</strong>)</p><p>This Cloud Automation helped me save a lot time for completing my project: <a href="https://medium.com/@hramachandran/impact-of-linguistic-choice-of-words-in-news-articles-105122d099a5"><strong>NewsOptimism</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ObPF2Zegqzie38hyovV8yg.jpeg" /><figcaption>BEWARE!THERE IS NO FREE LUNCH EVERY TIME!</figcaption></figure><h3><strong>What is this article all about?</strong></h3><p>This article will walk you through the process of running the script on the cloud. The script extracts the data(from the web) and stores it in the S3 bucket. I will walk you through an sample project.</p><p>This article is more of a <strong>quick starter</strong> tool for you to take your first step towards using <strong>cloud application! </strong>I am going to use <strong>Python 3.</strong></p><p>Note: This article is not going to explain all the settings of AWS! But sufficient enough to get you boarded 😉</p><h4>Steps:</h4><ol><li>Part 1: Setup— S3, IAM, LAMBDA, CLOUDWATCH.</li><li>Part 2: Creating a function/script.</li></ol><blockquote>The first step is the hardest!</blockquote><h3><strong>Project Objective</strong></h3><p>I want to collect the article links from the <a href="https://news.ycombinator.com/">Hacker news</a> website on a daily basis. However I only want to collect those articles that have a <strong><em>score</em></strong><em> </em>more than <strong>100 points</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRruAYh-A4t8ubJFaYKpDg.png" /><figcaption>HackerNews</figcaption></figure><h3>SETUP PHASE</h3><p>Before you start you need to have registered the AWS account(need to have <a href="https://aws.amazon.com/free/">free tier AWS account</a>).</p><h4><strong>S3 — SETUP</strong></h4><ol><li>Launch S3 from the AWS console.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cW9ZgTONeZi-DIb_lM1bPQ.png" /></figure><p>2. Create a S3 bucket(i have already 2 buckets).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tj-53ZzKLPZMe_qqwDCUqg.png" /></figure><p>3. The name of the bucket should be unique(<em>hackernews-bucket</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zq5izYQwaSHMBcdP2swltw.png" /></figure><p>4. Done 👏</p><h4>IAM — SETUP</h4><ol><li>Launch IAM from your AWS Console.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrfEfn0FZ5Hn8L8VAMgFKw.png" /></figure><p>2. Click on the <em>Roles</em> and <em>Create role.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xFxo8_yFpIU-zJwJLgirg.png" /></figure><p>3. Choose <em>Lambda.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n68I58ACTS4lHmWx3bpQ_w.png" /></figure><p>4. Now search and select <em>AmazonS3FullAccess</em> policy and press <em>Next</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5P-gagpk99hCs81GpzsUHA.png" /></figure><p>5. Give a role name(I am going with <em>news_scraper_role</em>) and <em>Create role</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_gdLIVEZ1NSMJdZm0vgiA.png" /></figure><h4><strong>LAMBDA — SETUP</strong></h4><ol><li>Create Functions(I have 4 functions..you might see none if you’re new)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPHRAk9KHpyy-o2zqQMeTw.png" /></figure><p>3. Choose your <em>runtime(python 3.6)</em> and select the <em>custom role</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7HJiqIDijl3YcphoQbT5w.png" /></figure><p>4. Select the <em>IAM role </em>that you have created(<em>news_scraper_role</em>) during the <strong>IAM setup stage</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDzaO8CAp27_NW9KG4oHtg.png" /></figure><p>5. Successfully Created your lambda function. 👏</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*euIJb7ZYtRdVreOJVgPu_A.png" /><figcaption>Lambda Setup</figcaption></figure><h3>CloudWatch Events-Setup</h3><ol><li>Go to your Lambda function(<em>s3-news-trigger</em>) and <em>cloudWatch events </em>from the<em> add triggers </em>section.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0F3RqXfsIQc2d3AGDI6J8A.png" /></figure><p>2. Click on the CloudWatch Events to configure. Create your own new rule and choose <em>Schedule expression </em>and I am triggering everyday 10pm UTC.(check out the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">cron syntax</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVqPhe7PfAPz8sFewPjVOQ.png" /></figure><p>3. Add it and save it!You’re done 👏</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9bNPeSHtkaY-JF0AsHHA4A.png" /></figure><p>Once you’re done with the setup, move on to my <a href="https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-2-254002056a97">Part 2,</a> Creating the Lambda function.:<a href="https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-2-254002056a97">https://medium.com/@hramachandran/automate-the-data-extraction-using-aws-s3-lambda-cloudwatch-events-part-2-254002056a97</a></p><h3>References:</h3><ol><li>Free usage: <a href="https://aws.amazon.com/free/">https://aws.amazon.com/free/</a></li><li>API usage for Amazon S3: <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-examples.html">https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-examples.html</a></li><li>AWS Lambda pricing: <a href="https://aws.amazon.com/lambda/pricing/">https://aws.amazon.com/lambda/pricing/</a></li><li>Different ways for Job Scheduling in python: <a href="https://raybuhr.github.io/talks/python-job-scheduling/python-job-scheduling.html#/">https://raybuhr.github.io/talks/python-job-scheduling/python-job-scheduling.html#/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=563a00118394" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Impact of Linguistic choice of words in News articles on our Society]]></title>
            <link>https://medium.com/@hramachandran/impact-of-linguistic-choice-of-words-in-news-articles-105122d099a5?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/105122d099a5</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Tue, 22 May 2018 21:17:02 GMT</pubDate>
            <atom:updated>2022-06-24T16:11:41.821Z</atom:updated>
            <content:encoded><![CDATA[<p>All around the world both good and bad happens, and we get to know only those that are exposed to us. And, that’s the primary responsibility of the media. But the bigger responsibility of these media houses is the way in which they express the content to the people.</p><p>A responsible media house’s content should be original, unbiased, free of exaggeration and should be very sensitive in handling the emotions of it’s readers and viewers. <strong>A same story could be told in different ways and these different ways could definitely trigger different emotions among it’s readers.</strong></p><p>It is known that we become who we are by what we say and what we read. Reading a story that’s filled with positive words would make us feel more positive and vice versa. So the wordings of a content definitely plays an equal role as that of the content itself.</p><p>This project aims to answer how some of the major media houses in USA are giving importance to the <strong>wordings of their content</strong>. The answer would allow the readers to wisely choose their daily source of news that truly cares about its readers.</p><p>For detailed information check out the <strong><em>‘Detailed Research resources’</em></strong> section.</p><h3>Assumptions/Target Audience:</h3><ol><li>Our target audience are prone to ALL the articles published in the home page.</li><li>Data has been scrapped from the resources at the <strong>same</strong> time(since it gets updated regularly).</li><li>Only the USA News web market is considered for this research.</li><li>CNN, Foxnews, nytimes, huffingtonpost, reuters are the top news websites considered based on the unique visitor count obtained from the research.</li><li>Our Sample considers only the articles published in these websites at 10am(CST).</li></ol><h3>1) Data Extraction/Preparation Phase:</h3><p>The Data is collected through script which using Newspaper3K API. The script is designed to collect all the articles published at 10am(CST) in the above mentioned news homepage. Here is a sample image of few articles published on 10/17/2017, 10am in Reuters.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DeniTDVTOatEY2hH." /></figure><p>I then pipelined these raw text into CSV forma, segregated into columns(as shown below) for easy exploration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s8uTxD8k3rlQorCh." /></figure><p><strong>The data as CSV file has the following columns:</strong></p><ul><li><strong>TITLE</strong>: the Title of the article.</li><li><strong>SUMMARY</strong>: first few lines of the article’s text.</li><li><strong>TEXT</strong>: Full text inside the article</li><li><strong>URL</strong>: web link to the article.</li><li><strong>KEYWORDS</strong>: important words in the article.</li></ul><p>It is also to be noted that all the articles published in their webpage doesn’t have to be from their own news editors. For instance reuters article is shared in the homepage of HuffingtonPost.com.</p><h3>2) Preprocessing/Cleaning Phase:</h3><p>My concern is to analyze only the textual content of the article. Thus, only the text(from the text column of the csv file) data is tokenized.</p><p>Major issue with these billions and billions of content is that most of which are not relevant to our analysis. So we do language preprocessing and then we build a JSON file format storage all these tokenized vocabulary content for faster access of only the relevant tokenized term contents for our analysis phase.</p><h3>3) Analysis/Model Building Phase:</h3><p>Let’s check the distribution of negative words(words that have a negative connotation), as shown below. The media house with least projection of these negative words is <strong>Foxnews followed by The New York times</strong>. They deliver the content in more optimistic way than their counterparts. Thus our Net score is calculated using the equation:</p><blockquote>Net Negative Score=∑Negative termsper media × Sentiment score</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ZcetvJoTPnsa0KNf." /></figure><p>However to make the comparison more fair, we also need to check all vocabulary content of the article, that includes <strong>both the usage of positive and negative words</strong>. It has been found that the content of the Foxnews articles are MORE than that of the Newyork times. So to do a <strong>fair analysis</strong>, we factor it using <strong>normalization</strong>. Thus a <strong>Normalized score</strong> is introduced!</p><p>A <strong>Normalized score</strong> is the net sentiment score of all articles to that of the total number of term usage across all the articles in a day(which is specific to each media houses).</p><blockquote>Net Normalized Score=∑(termsper day * Sentiment score)∕Total Number of terms</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*L6xf53LYkBRcsiMn." /></figure><h3>Conclusion:</h3><p>As Seen from the above plot we can infer that <strong>The New York times </strong>plays an important role in not only conveying the News but also in a healthy way(comparatively more optimistic). Thus I recommend New york time , for those specific target auidience of web users who just want to have good taste of daily news.</p><blockquote>&quot;People like to think they&#39;re objective and making decisions based on numbers,&quot; Dr. Lera Boroditsky said. &quot;They want to believe they&#39;re logical. But they&#39;re really being swayed by metaphors.&quot;</blockquote><h3>Links:</h3><ol><li><a href="https://tedxinnovations.ted.com/2015/04/10/spotlight-tedx-talk-how-the-words-we-use-affect-the-way-we-think/"><strong>How the words we use affect the way we think.</strong></a></li><li><a href="https://news.stanford.edu/news/2011/february/metaphors-crime-study-022311.html"><strong>According to new research by Stanford psychologists. Your thinking can even be swayed with just one word, they say.</strong></a></li><li>There is a famous concept called Law of attraction written by Rhonda Byrne in her book<a href="https://en.wikipedia.org/wiki/The_Secret_%28book%29"> Secret</a>. It says that we become who we are by what we say!</li><li><a href="https://www.ted.com/talks/lera_boroditsky_how_language_shapes_the_way_we_think#t-840579"><strong>Lera Boroditsky: How language shapes the way we think.</strong></a></li></ol><h3>Thanks for reading!</h3><p>If you liked this article keep sharing with your community and consider exploring what happens when you click the clap icon more than once 👏</p><p>Reach out to me on <a href="https://twitter.com/Harishaaram91">https://twitter.com/Harishaaram91</a> if you want me to give a lecture/talk on this project.</p><p><em>Final Remarks: All the data collected and used are open to access to any individual under this </em><a href="https://github.com/codelucas/newspaper/blob/master/GOOSE-LICENSE.txt"><em>License.</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=105122d099a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Food Recommendation using NLP, adhering to the Obama-era FDA policy]]></title>
            <link>https://medium.com/@hramachandran/analysis-of-fdas-calorie-count-policy-effects-on-restaurant-food-items-using-nlp-ee80ca4bff1d?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee80ca4bff1d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[food-technology]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[food]]></category>
            <category><![CDATA[fda]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Mon, 14 May 2018 14:48:02 GMT</pubDate>
            <atom:updated>2022-06-24T16:14:57.997Z</atom:updated>
            <content:encoded><![CDATA[<p>The U.S. Food and Drug Administration (FDA) has announced to implement an Obama-era policy that will require restaurants with more than 20 locations to <a href="https://www.vox.com/science-and-health/2017/11/10/16623590/calorie-count-menus-mandatory-2018"><strong>label calorie counts on their menus</strong></a><strong>. </strong>This move by the FDA, gives people the opportunity to take calorie count into consideration when they order a meal.</p><p>This Project uses the Restaurants Menu-Item names and user food choice to see which food item becomes more preferable(low calories). The relation between user choice and Menu items is achieved using <strong>N-grams.</strong></p><p><strong>Now we will see how this small change in adding calorie information can affect the whole choice of food that we make…</strong></p><h3>What are N-grams?</h3><p>It is a contiguous sequence of <em>n words</em> from a given sample of text, a technique widely used in Natural Language processing/Text Mining. Consider the example below for<em> uni-grams, bi-grams, tri-grams</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/0*ZgNrHZI_1BKK9Q5D.png" /><figcaption>source: Stack overflow</figcaption></figure><h3>Target audience:</h3><ol><li>It is based on the assumption that <strong>some</strong> <strong>people make choice based on the Menu_Item name</strong>. For eg: Whenever I visit, Pizza hut, I want to have <em>Chicken Pizza</em>, but this is more generic! so which one?….I really don’t care about all the options in the Menu!</li><li><strong>Calorie Conscious</strong>(quite not the same as health conscious) people.</li></ol><h3>Quick Walk-through of how it works</h3><ol><li>Obtaining the Data: The restaurant item’s nutritional data is obtained from the database maintained by <a href="http://menustat.org/"><strong>MenuStat</strong></a>.</li><li>Input: User Inputs his choice of <strong>Food Item</strong> and the <strong>Restaurant name.</strong></li><li>Model building: The input information is used to extract similar Menu_item list choices along with its calorie val using NLP.</li><li>Recommender: Recommend the user with top 5 low calorie values from the extracted list of choices.</li></ol><h3>Project Exploration</h3><p>The MenuStat has the consolidated database of Menu-Items and their calorific values of each items specific to each restaurants. I leveraged these .csv datafile for this project.</p><h4>EDA Phase:</h4><p>There are 94 Restaurants, that have the calorific values of each item_name in their Menu card. Let’s take a look at the Calorie distribution(it’s easier to use the <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.groupby.html">Pandas groupby</a> clause). Hover over the graph below to see the exact count and its percent contribution to the overall data set.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fplot.ly%2F%7Ehramachandran%2F37%2F&amp;src=https%3A%2F%2Fplot.ly%2F%7Ehramachandran%2F37.embed%3Fautosize%3Dtrue&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=plot" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/943695b979b41e4c90550b99a2960bec/href">https://medium.com/media/943695b979b41e4c90550b99a2960bec/href</a></iframe><p>It is found that for the year 2017, the <strong>mean calorie is 374 calories.</strong> Each restaurant has a mean value as shown in the bar chart above.</p><p>The top ten restaurant chains which skew the distribution with their <strong>high calorie </strong>are :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*yhUpvX4wMW6futDjEG3u1w.png" /><figcaption>Total Calorie in the restaurants Menu(Highest 10 are shown here)</figcaption></figure><h3>Model-building Phase:</h3><p>The user chooses the restaurant name and food item name(for simplicity, the name has <em>two words-bigrams</em>), and I provide the top 5 recommendation of the item name from the Menu card with low calorie values. Let’s explore it through a example:</p><ol><li>Let’s say I wanted to have <strong>Mocha Frappuccino</strong>(item name)<strong> @ Starbucks</strong>(restaurant name).</li><li>The Model extracts the <strong>bigrams </strong>of the term-<strong><em>Mocha Frappuccino </em></strong>along with the Menu Id and calorific value.</li><li>This gives 194 choices with <strong>Mocha Frappuccino</strong>. The figure below shows a list of tuples with tuple value as <strong>item name </strong>and its <strong>calorie</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Hhrz7XW-DvqpeC8." /></figure><p>4. Here are the top 5 <strong>Mocha Frappuccino</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/0*zD9zqzMEpa1HiXzM." /></figure><h4>Conclusion:</h4><p>FDA’s announcement of calorie count on Menu items can affect various stakeholders in different levels. This project, talks about one such possibility — <strong>Menu items that can get affected because of it’s high calorie content.</strong></p><p>I used <strong>NLP n-grams technique</strong> to find the similarity of menu items with people choices, and build a recommendation based on the calorie content of the Food Item.</p><p>This application helps both the customers and the Restaurant. When the customer is <strong>not very specific</strong> about what he wants to have at the restaurant, all he needs to have is generic food item name, then this app recommends the customer with least calorie count.</p><p>In case of restaurant, they need to revamp the high calorie content food items that has an alternate option!</p><h3>Resources:</h3><ol><li><a href="http://nbviewer.jupyter.org/github/harishaaram/Talks/blob/master/PyDataChi/Project2/PyDataChi_Project2.ipynb"><strong>Full working demo</strong></a></li><li><a href="http://menustat.org/#/home">Restaurant Nutrition Database through MenuStat</a></li><li><a href="https://www.politico.com/story/2018/05/07/fdacalories-food-labels-obama-trump-517191">Obama’s calorie rule kicks in thanks to Trump</a></li><li>The <a href="https://en.wikipedia.org/wiki/Psychological_pricing">Psychological effect of Numerical pricing</a> value</li></ol><h3>Thanks for reading!</h3><p>If you liked this article keep sharing with your community and consider exploring what happens when you click the clap icon more than once 👏</p><p>Reach out to me on <a href="https://twitter.com/Harishaaram91">https://twitter.com/Harishaaram91</a> if you want me to give a lecture/talk on this project. This has already been presented at PyData Chicago community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee80ca4bff1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Patient activities monitoring using OpenCV]]></title>
            <link>https://medium.com/@hramachandran/image-recognition-to-find-patterns-in-patient-activities-ed70a62ddc7d?source=rss-12e9de977ddb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed70a62ddc7d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[image-recognition]]></category>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Harish Gandhi]]></dc:creator>
            <pubDate>Wed, 09 May 2018 18:54:11 GMT</pubDate>
            <atom:updated>2022-06-27T22:58:47.990Z</atom:updated>
            <content:encoded><![CDATA[<p>Tremendous increase in the tech industry has made life simple for many but not all. There are people who still face issues catching up with the tech growth.</p><p>It also becomes hard for the doctors to diagnosis certain problems of a patient without their constant monitoring of the patients activities.</p><p>This <strong>application stand as a bridge</strong>! It helps the Doctor to monitor their patient activities providing them with crucial insights, while keeping it’s simplicity for other end user-Patient.</p><h3>Walk-through of how it works</h3><ol><li>User(Patient) is given an activity sheet(like an excel spreadsheet).</li><li>Doctor collects a sample of <strong><em>X</em></strong> mark signature from the user.</li><li>Our Machine learning model(using <a href="https://opencv.org/"><strong><em>opencv</em></strong></a>) is pre-trained with User specific X mark collected from the Doctor sample.</li><li>User X marks the activity sheet and uploads photo through the mobile app.</li><li>The image is pipelined from mobile app to the<strong> </strong><a href="https://firebase.google.com/docs/database/"><strong><em>Firebase database</em></strong></a><strong>.</strong></li><li>The Image from the database is then pipelined through our Image recognition model(trained on the user specific X marks).</li><li>The App marks the regions of X with corresponding X(activity) label and Y(Time) label.</li><li>The collected Information provides the basic Insight for doctors.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecxbvOJsim6Lb6B2C2sUAA.png" /><figcaption>WorkFlow of our Application</figcaption></figure><h3>Processing stages of our Machine Learning Model</h3><h4>Stage 1:</h4><p>Sheet of paper with activity and time frame labels are provided as feature by the doctor to the patient. These are all marked by the patient, on a periodic basis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_E1hTaTIAsPOwSNRsfqNmQ.png" /><figcaption>Photo of an X marked Activity Sheet by the Patient</figcaption></figure><h4>Stage 2:</h4><p>The doctor collected written <em>X</em> marks from their patients are send to us. We then use those images as sample to train our model to match the pattern in the activity sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvDM0hCaT8a2Jt72cFSPmw.png" /><figcaption>X marks written by User(used for pattern match)</figcaption></figure><h4>Stage 3:</h4><p>The Activity sheet Image is converted to gray scaled version as the processing of pattern detection becomes easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T5ziPe7gyugu-kPgf1VhEw.png" /><figcaption>Grayscaled(BW) version of the Photo Image</figcaption></figure><h4>Stage 4:</h4><p>We pass the gray scaled image to Machine Learning model which is trained to identify the X patterns in the sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHzEsRCKWbOmwupU5Xey4A.png" /><figcaption>Rectangular box detects the X marks.</figcaption></figure><h4>Conclusion:</h4><p>We wanted to build an application that is simple to use for all stake holders and <strong>let us handle the complexity</strong>! That’s why we started to build this simple tracker that helps both the Doctor and the Patient in a simple way.</p><p>Even though we trained our model with few X marks, it still can <strong>identify the distorted X marks</strong>(eg: the C[tablet] row on Wednesday column has a curvy X mark). Thus our model is more <strong>robust </strong>to new data(ie new X marks).</p><p>However, we are also looking into the <strong>Type II error(False Negatives)</strong>, and this error can be minimized with more trained images of different X patterns from different users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*YSk8oEaycZA3rJSeayF7YA.png" /><figcaption><strong>Confusion Matrix</strong> (Source: <a href="https://au.mathworks.com/">https://au.mathworks.com/</a>)</figcaption></figure><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed70a62ddc7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>