<?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 Rohan Rangari on Medium]]></title>
        <description><![CDATA[Stories by Rohan Rangari on Medium]]></description>
        <link>https://medium.com/@rohanrangari?source=rss-65f08d91efde------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*APLAYppCKdFYdGoojkpnHA.png</url>
            <title>Stories by Rohan Rangari on Medium</title>
            <link>https://medium.com/@rohanrangari?source=rss-65f08d91efde------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:40:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohanrangari/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[Transformers Explained from Scratch: A Complete Beginner’s Guide to the Architecture (Part 1)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rohanrangari.medium.com/transformers-explained-from-scratch-a-complete-beginners-guide-to-the-architecture-part-1-6f6cbb44ff81?source=rss-65f08d91efde------2"><img src="https://cdn-images-1.medium.com/max/600/0*wf8WYrm5fCf7KYzU" width="600"></a></p><p class="medium-feed-snippet">Understand how ChatGPT and modern language models work, one component at a time &#x2014; without starting with complicated mathematics or code.</p><p class="medium-feed-link"><a href="https://rohanrangari.medium.com/transformers-explained-from-scratch-a-complete-beginners-guide-to-the-architecture-part-1-6f6cbb44ff81?source=rss-65f08d91efde------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rohanrangari.medium.com/transformers-explained-from-scratch-a-complete-beginners-guide-to-the-architecture-part-1-6f6cbb44ff81?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f6cbb44ff81</guid>
            <category><![CDATA[forward-deployed-engineer]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[attention-mechanism]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 09:41:55 GMT</pubDate>
            <atom:updated>2026-10-24T09:49:52.012Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
        </item>
        <item>
            <title><![CDATA[Jenkins: The Dependable Butler of DevOps and CI/CD]]></title>
            <link>https://rohanrangari.medium.com/jenkins-the-dependable-butler-of-devops-and-ci-cd-1d4d70dc3130?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d4d70dc3130</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Tue, 05 Nov 2024 13:52:24 GMT</pubDate>
            <atom:updated>2024-11-05T13:52:24.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*4ePyBUjKZgPpTCA52MdbIg.png" /><figcaption>Jenkins The Butler</figcaption></figure><p>Some Meme to get started with…..!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*iCxuFABP2cw8EWfU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*7KC6Mq4Z0xC2LhnX.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*9LklVtlspyVKK0Ot" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*Q0EQPMGYzu7Q4X2U" /></figure><h3>1. What is Jenkins?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*k35yt9OJH-QXoh04p6o-NA.png" /><figcaption>Legos</figcaption></figure><blockquote>Alright, imagine you’re building a LEGO castle. You have a lot of pieces, and every time you add a new piece, you want to make sure it fits perfectly without breaking anything else you’ve built. Jenkins is like a friendly robot that helps you do this.</blockquote><blockquote>In the world of software, Jenkins is a tool that helps developers (the people who write the code) by automatically checking their work. When a developer adds a new piece of code, Jenkins takes it, puts it together with the existing code, and makes sure everything works well together.</blockquote><blockquote>In DevOps (which is like a way for developers and operations people to work together to build and maintain software), Jenkins is very important because:</blockquote><blockquote><strong>Saves Time</strong>: Jenkins can do many checks and tests automatically, so developers don’t have to do them manually.</blockquote><blockquote><strong>Catches Mistakes Early</strong>: If there’s a mistake in the new code, Jenkins finds it quickly, so it can be fixed before it causes bigger problems.</blockquote><blockquote><strong>Makes Work Faster</strong>: Since Jenkins works all the time, it helps get new features and fixes to users faster.</blockquote><blockquote>So, Jenkins is like a helpful robot that makes sure the LEGO castle (your software) is built correctly and quickly, helping everyone work better together.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*JejJ8TqlfPcrlmeRgyQutg.png" /><figcaption>Legos Castle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*7imDqk5cSG2-0X5v" /><figcaption>Tell-me-more</figcaption></figure><blockquote>What is Jenkins (Technical way this time):</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*UFPWU8mhU7Y2qitQhJFcBQ.png" /><figcaption>Jenkins Defination</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /><figcaption>Cool</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/0*t-CdxML5XNBP-OAp" /></figure><h3>2. Jenkins in the DevOps CI/CD World</h3><p>Alright, let’s imagine you’re still building that LEGO castle, but now you want to add new pieces every day and make sure it’s always ready to show off to your friends. Continuous Integration (CI) and Continuous Delivery (CD) are like special rules to make this happen smoothly. Jenkins helps a lot with these rules.</p><h3>Continuous Integration (CI):</h3><ol><li><strong>Building Together</strong>: Every time a developer adds a new piece of code, Jenkins takes it and combines it with everyone else’s code. It’s like making sure each new LEGO piece fits perfectly with the castle without breaking anything.</li><li><strong>Finding Problems Fast</strong>: If a new piece of code (LEGO piece) doesn’t fit right, Jenkins quickly finds the problem. This way, developers can fix it immediately before it becomes a big issue.</li></ol><h3>Continuous Delivery (CD):</h3><ol><li><strong>Always Ready</strong>: Jenkins helps to make sure that the software (your LEGO castle) is always in good condition. It’s like always having your castle ready to show to your friends, even if you add new pieces every day.</li><li><strong>Automating Tasks</strong>: Jenkins can automatically do tasks like testing and deploying the software. Imagine a robot that not only checks your LEGO castle but also helps to put it on display every time you make it better.</li></ol><h3>Importance of Jenkins in CI/CD:</h3><ol><li><strong>Consistency</strong>: Jenkins makes sure that every new piece of code is tested and works well with the existing code, maintaining a stable and reliable software product.</li><li><strong>Speed</strong>: By automating tasks, Jenkins speeds up the process of finding and fixing problems, and getting new features to users quickly.</li><li><strong>Reliability</strong>: With Jenkins, you can trust that the software is always in good shape because it continuously checks and integrates new code, ensuring fewer surprises.</li></ol><p>So, Jenkins is like your very own LEGO-building robot, making sure your castle is always perfect, ready, and growing every day without any hassle!</p><h3>3. Why the logo?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*QS64O5D8ySFW7cxoY_gsRQ.png" /><figcaption>Butler</figcaption></figure><blockquote>The Jenkins logo features<strong> a butler named Jenkins</strong>, dressed in a suit and bow tie, holding a serving tray. This design has specific meanings and symbolism that relate to what Jenkins does in the world of software development. Here’s a simple explanation:</blockquote><blockquote><strong>Butler Symbolism</strong>: A butler is someone who serves and helps others, making sure everything runs smoothly. In the same way, Jenkins serves developers by automating tasks, making their work easier and ensuring everything works well together.</blockquote><blockquote><strong>Professionalism</strong>: The suit and bow tie represent professionalism and reliability. Jenkins, as a tool, is designed to be reliable and professional in helping developers integrate and deliver their code continuously.</blockquote><blockquote><strong>Service</strong>: The serving tray symbolizes Jenkins’ role in delivering services. Just as a butler delivers food and drinks, Jenkins delivers code updates and helps in deploying software efficiently.</blockquote><blockquote>So, the Jenkins logo with a butler holding a tray is a visual representation of how Jenkins assists and serves the development team, ensuring everything is integrated and delivered smoothly and professionally.</blockquote><h3>4. Alternatives to Jenkins: YES….. MANY!!!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P90hZjU-LFgWjR2twfg1yw.png" /><figcaption>Jenkins Alternatives</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVFaSLD5YIDdgA2l-6S1Yw.png" /><figcaption>Comparison</figcaption></figure><h3>5. Why Use Jenkins:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QuzwGTA1MuOj68zIaFXJA.png" /><figcaption>Jenkins Plugins</figcaption></figure><ol><li><strong>Extensive Plugin Ecosystem</strong>: Jenkins has a vast array of plugins, allowing for high customization and integration with many tools and technologies.</li><li><strong>Open Source and Free</strong>: Jenkins is open-source, which makes it a cost-effective solution compared to some proprietary tools.</li><li><strong>Highly Customizable</strong>: Jenkins can be tailored to fit complex and unique workflows, making it flexible for different project needs.</li><li><strong>Large Community Support</strong>: A large, active community contributes to Jenkins, providing extensive documentation, plugins, and support.</li><li><strong>Independence from Specific Platforms</strong>: Unlike tools that are tightly integrated with their platforms (e.g., GitLab with GitLab repositories, GitHub Actions with GitHub repositories), Jenkins is platform-agnostic and can integrate with various version control systems and environments.</li></ol><blockquote>However, the choice of CI/CD tool depends on specific project needs, existing infrastructure, and team familiarity. Each tool has its strengths, and organizations often choose based on factors like ease of use, integration with existing tools, and cost.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ze3e9kfMBaQGXEd8" /></figure><h3>6. History of Jenkins</h3><blockquote>Jenkins has an interesting history that reflects the evolution of continuous integration and continuous delivery in software development. Here’s a simple overview of its development timeline:</blockquote><blockquote>1. Origin (2004)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*YxUVwHsCVRj_7RbLvHsIhQ.png" /></figure><blockquote><strong>Creation of Hudson</strong>: Jenkins originated as “Hudson,” a project started by Kohsuke Kawaguchi while he was working at Sun Microsystems. The goal was to create an easy-to-use continuous integration (CI) server to automate the build process for software projects.</blockquote><blockquote>2. First Release (2005)</blockquote><blockquote><strong>Initial Release</strong>: The first version of Hudson was released, allowing developers to integrate their code changes more frequently and receive immediate feedback on their builds.</blockquote><blockquote>3. Growing Popularity (2006–2010)</blockquote><blockquote><strong>Widespread Adoption</strong>: Hudson quickly gained popularity due to its ease of use, flexibility, and the growing need for CI tools in software development. Many organizations began adopting it as their primary CI server.</blockquote><blockquote><strong>Plugin Ecosystem</strong>: During this period, a rich plugin ecosystem began to develop, allowing Hudson to integrate with various tools, version control systems, and deployment platforms.</blockquote><blockquote>4. Forking (2011)</blockquote><blockquote><strong>Community Dispute</strong>: In 2011, a conflict arose between the Hudson community and Oracle (which had acquired Sun Microsystems) over the project’s direction. This led to a fork of Hudson by the community, resulting in the creation of Jenkins.</blockquote><blockquote><strong>Name Change</strong>: The new project was named Jenkins, which reflected its community-driven nature.</blockquote><blockquote>5. Rapid Growth and Improvements (2011–2015)</blockquote><blockquote><strong>Increased Features</strong>: Jenkins continued to grow rapidly, adding new features, improving the user interface, and expanding its plugin ecosystem. The Jenkins community contributed to its development and supported its widespread use.</blockquote><blockquote><strong>Jenkins CI/CD</strong>: Jenkins became synonymous with continuous integration and continuous delivery, serving as a backbone for many development workflows.</blockquote><blockquote>6. Cloud and Container Support (2016–2018)</blockquote><blockquote><strong>Cloud Integration</strong>: As cloud computing and containerization became more popular, Jenkins added support for cloud-based builds and deployment processes, enhancing its capabilities for modern software development practices.</blockquote><blockquote><strong>Pipeline as Code</strong>: The introduction of the “Pipeline” feature allowed developers to define their build, test, and deployment processes as code, making Jenkins even more flexible and powerful.</blockquote><blockquote>7. Continuous Improvement (2019-Present)</blockquote><blockquote><strong>Modernization</strong>: The Jenkins project has continued to modernize its user interface and enhance its functionalities to keep pace with evolving software development practices.</blockquote><blockquote><strong>Jenkins X</strong>: The Jenkins community introduced Jenkins X, a version of Jenkins optimized for Kubernetes and cloud-native applications, to better support modern DevOps practices.</blockquote><blockquote>8. Current Status</blockquote><blockquote><strong>Active Community</strong>: Jenkins remains one of the most popular CI/CD tools in the world, with a large and active community, extensive documentation, and a vibrant ecosystem of plugins. It continues to evolve, addressing the needs of developers and teams in a rapidly changing technology landscape.</blockquote><blockquote>Summary</blockquote><blockquote>Jenkins has transitioned from a simple CI server to a powerful automation tool that supports a wide array of development workflows. Its community-driven approach and flexibility have made it a staple in the software development industry, helping teams deliver high-quality software efficiently and reliably.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*sRBd4LnGZkgxOf0Z" /><figcaption>End</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*fdZpn1jscFZAbQHH" /></figure><blockquote>I hope this blog has helped clarify the concepts and provided a solid foundation for getting started with Jenkins and understanding its underlying theory.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*NjfpL88-AiCnikGX" /></figure><p>#jenkins #tutorial #thoery #cicd #pipeline #hudson #devops</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d4d70dc3130" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Own Text Normalizer using Python]]></title>
            <link>https://medium.com/analytics-vidhya/build-your-own-text-normalizer-using-python-628f49e08033?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/628f49e08033</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[text-mining]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 09:02:09 GMT</pubDate>
            <atom:updated>2023-03-25T09:02:09.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FtGD6Luf1heLpV55mwiOXQ.png" /><figcaption>Text Normalization</figcaption></figure><p><strong>Goal: To convert the raw text data into clean normalized data</strong></p><p>So before we get started lets first clear some data science &amp; nlp text related concepts:</p><p>1- <strong>What is text corpus/corpora?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*_LgNh8Zmd-Pn211wUeBd0g.png" /><figcaption><a href="https://www.quora.com/What-is-corpus-corpora-in-text-mining?share=1">Link</a></figcaption></figure><blockquote>In simple terms : Text Corpus/Corpora == Text Dataset == Collection of Texts</blockquote><p>As we know text corpus is not always(mostly) not well formatted and standardized/ normalized to be directly used. Text datasets are full of messy &amp; noisy contents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*lf6PStCIiWbX9prazK9S8A.png" /></figure><p>Text Normalization consists of wide variety of methods that convert raw text into cleaned- normalized text form.</p><p>Various methods for making the text normalized can be thought of the below lists:</p><blockquote>1 — HTML Parsing &amp; Removing HTML tags</blockquote><blockquote>2 — Tokenization</blockquote><blockquote>3 — Unicode Normalization</blockquote><blockquote>4 — Handling contractions</blockquote><blockquote>5 — Removing unnecessary tokens</blockquote><blockquote>6 — Spelling corrections</blockquote><blockquote>7 — Stemming</blockquote><blockquote>8 — Lemmatization</blockquote><blockquote>9— Lower case / upper case — Case Conversions</blockquote><blockquote>10 — Removing stopwords</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*ol6AZJbSd8qLhuI4" /></figure><blockquote>Section 1: HTML Parsing &amp; Removing HTML tags</blockquote><p>For the step of data gathering we may need sometimes to do web scraping to get the data from the internet and get the contents &amp; make it cleaned to be consumed by a NLP system.</p><p>There are many python libraries available like: requests , beautifulsoup, …</p><p>Lets say we want to scrape the following website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIwoN7-gI9JyoGCPPzasIA.png" /><figcaption><a href="http://www.gutenberg.org/cache/epub/8001/pg8001.html">Website</a></figcaption></figure><p>As of now I am assuming you know how to run Python &amp; code in Python &amp; familiar with VS code.</p><blockquote>Lets get started :</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*CVDeiBbdhZ-xrzKWqmsTDQ.png" /></figure><p>Lets name it: text_normalizer.py</p><p>In case you don&#39;t have requests library installed you can use the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*XdEteHuekjLlRagkN7JyMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIszOwSx9PECBhHpdF5qJw.png" /><figcaption>Code-1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLuBLaCNTS3ENtuMznC4sA.png" /><figcaption>Output-1</figcaption></figure><p>As you can see from the output the content needs to be cleaned &amp; preprocessed before it can be consumed/used. We need to remove html tags &amp; clean some of the irrelevant tags &amp; content.</p><p>We can used BeautifulSoup that come with various functions we will help us to clean the content easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*Y83CkGqZoYcMUxNt09Cydw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4Uf0uqo0hoNrJS5rTaqeQ.png" /><figcaption>code-2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVaPXkYNhWI60lOt9Pe83Q.png" /><figcaption>Output-2</figcaption></figure><blockquote>Section 2: Tokenization (Text Tokenization)</blockquote><p>A text dataset /corpus consists of several components including sentences, which can be further broken down into clauses, phrases and words. NLP software typically analyzes text by breaking it up into words (tokens) and sentences.</p><blockquote><strong>Tokenization</strong> can separate sentences, words, characters, or sub words. When we split the text into sentences, we call it sentence tokenization. For words, we call it word tokenization. [<a href="https://neptune.ai/blog/tokenization-in-nlp">reference</a>]</blockquote><blockquote>Hence, any NLP pipeline has to start with a reliable system to split the text into sentences (sentence segmentation) and further split a sentence into words (word tokenization).</blockquote><p><strong>Sentence Tokenization via NLTK</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDi7bmkRvEI9-GdyChgfaw.png" /><figcaption>code-3</figcaption></figure><p><em>Note: Above tokenization_text is in one single string/sentence in a multi-line form</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlAjQI7aHPDoupx9SBDXEw.png" /><figcaption>Output-3</figcaption></figure><p><strong>Word Tokenization via NLTK</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oP-6gBtOVdz8kt7h1rE9MA.png" /><figcaption>code-4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WI4Tlt8OiZzpmqNhxErbKw.png" /><figcaption>output-4</figcaption></figure><pre># Various sentence Tokenizers present inside the NLTK Framework<br>- sent_tokenize<br>- Pretrained sentence tokenization models<br>- PunktSentenceTokenizer<br>- RegExpTokenizer</pre><pre># Various Word Tokenizers present inside the NLTK Framework<br>- word_tokenize<br>- TreebankWordTokenizer<br>- TikTokTokenizer<br>- RegExpTokenizer<br>- Inherited tokenizers from  RegExpTokenizer</pre><p>We can also use : <a href="https://spacy.io/"><strong>spaCy </strong></a>to perform sentence and word-level tokenizations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*TPPsCFeHihQBf2fP" /><figcaption>Not related to Spacy at ALL!!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*JNSAqcjD8maRqfBI" /></figure><blockquote>spaCy: Industrial-strength NLP<br>spaCy is a library for advanced Natural Language Processing in Python and Cython. It’s built on the very latest research, and was designed from day one to be used in real products.</blockquote><blockquote>spaCy comes with pretrained pipelines and currently supports tokenization and training for 70+ languages. It features state-of-the-art speed and neural network models for tagging, parsing, named entity recognition, text classification and more, multi-task learning with pretrained transformers like BERT, as well as a production-ready training system and easy model packaging, deployment and workflow management. spaCy is commercial open-source software, released under the MIT license.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*Z_ES0oFWdsFj2uhPKQpsjA.png" /></figure><p><strong>Sentence Tokenization via spacy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kgkV_ZZcHs0tBFJN5rjhMw.png" /><figcaption>code-5</figcaption></figure><p>You might get this with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*CRdhd7wdNwXzcH8huVhJDA.png" /><figcaption>OSError</figcaption></figure><p>So to resolve the above error you can try running the following commands:</p><pre># to download en_core_web_sm model for spacy<br>pip install -U pip setuptools wheel<br>pip install -U spacy<br>python -m spacy download en_core_web_sm</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*Q0JeXlU14J0i5k2frH_Hgg.png" /><figcaption>Output-5</figcaption></figure><p><strong>Word Tokenization via spacy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDzqQWNQwpXi6U_b1ZbR8g.png" /><figcaption>code 6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iW0piJwpmZTynp7fwbUF8g.png" /><figcaption>output 6</figcaption></figure><blockquote>Section 3 : Unicode Normalization</blockquote><p>As we develop code for cleaning up Messy data / HTML tags, we may also encounter various Unicode characters, including symbols, emojis, and other graphic characters. String accents are special string characters adapted from languages of other accents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*wSFboDhBiZ-ua0lc0mKqAg.png" /><figcaption>Unicode Characters</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*Xovqp_6EMuhwBfFkwXRT4w.png" /><figcaption>code-7</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*-epL4XaskqTKQ6GEGRtvAQ.png" /><figcaption>Output-7</figcaption></figure><blockquote>Section 4 : Handling contractions</blockquote><p>Contractions are short forms of words or in other words abbreviations of words or legends.<br>Contractions effect Text &amp; NLP use-cases &amp; problems.<br>So we can solve it based on common patterns and/or domain knowledge. <br>We can use <strong>contractions library</strong> &amp; below is the install guide &amp; code example to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*COeFRinMv-qYcZrp3sYwgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*btNi8gK4XPIHAfDvC8M6fQ.png" /><figcaption>Code-8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*pXj_9MyW6GCy1-lNvjqf2Q.png" /><figcaption>Output-8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*yAHJ3ojOhfzMwC4O" /></figure><blockquote>Section 5: Removing unnecessary tokens and stopwords</blockquote><p>We can remove stopwords &amp; unnecessay tokens based on NLP use-cases.<br>Since not every NLP use-cases requires them to be cleaned/removed but in most of cases we can clean/remove them.</p><p>We can use <strong>re library</strong> which is used for regular expression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uOfTitwGXnKv5KaVC-10Lw.png" /><figcaption>Code-9</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsYtd2yZb3Aixi5LE7Ejlg.png" /><figcaption>Output-9</figcaption></figure><blockquote>For more study/deep dive into re/ regex you can refer(just my suggestions) feel free to use any resource(s):</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMBUIPf3iNxZrrM11GvuTg.png" /></figure><blockquote><a href="https://www.youtube.com/watch?v=sHw5hLYFaIw">Link to the video</a></blockquote><blockquote>Or you can also reference: <a href="https://www.w3schools.com/python/python_regex.asp">https://www.w3schools.com/python/python_regex.asp</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*zsQ3WBtdJMy_C2e_" /></figure><blockquote>Section 6: Spelling corrections</blockquote><p>Incorrect words can mess up your whole training dataset / corpus in the NLP use- cases<br>Incorrect words can be due to manual/human errors, data errors, steps involved to get the dataset &amp; in that process your errors are introduced and many more ways,…</p><blockquote>Corrections can be done <br>- using known &amp; common words for the language or use-case &amp; edit/hamming distances for related words i.e. rule-engine based<br>- using some library to correct it</blockquote><p>We will be using one of the library present for spell corrections <br><strong>TextBlob</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*k7tT0G6YyF1ac7qvL6oWmw.png" /><figcaption>pip Install guide</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxtWW9uiYQarg5-NNhiF_Q.png" /><figcaption>Code-10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*0vrLTbFqnKP9er3yFak7rg.png" /><figcaption>Output-10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*irkfhOXfyoUZumTL" /><figcaption>haha</figcaption></figure><blockquote>Section 7 &amp; 8 : Stemming Vs Lemmatization</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*QmTZdLwnAvPSYtSO" /><figcaption>Word Roots</figcaption></figure><blockquote>Both the concepts i.e. Stemming &amp; Lemmatization are related to word roots</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*TDJXFDqOeljbD89HU3-evg.png" /><figcaption>Stemming Vs Lemmatization</figcaption></figure><p>We will be using <strong>NLTK library</strong> for stemming &amp; lemmatization in our case</p><blockquote><strong>Natural Language Toolkit</strong></blockquote><blockquote>NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to <a href="https://www.nltk.org/nltk_data/">over 50 corpora and lexical resources</a> such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning, wrappers for industrial-strength NLP libraries.</blockquote><h3>Submodules</h3><ul><li><a href="https://www.nltk.org/api/nltk.stem.api.html">nltk.stem.api module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.isri.html">nltk.stem.isri module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.lancaster.html">nltk.stem.lancaster module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.porter.html">nltk.stem.porter module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.regexp.html">nltk.stem.regexp module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.rslp.html">nltk.stem.rslp module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.snowball.html">nltk.stem.snowball module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.util.html">nltk.stem.util module</a></li><li><a href="https://www.nltk.org/api/nltk.stem.wordnet.html">nltk.stem.wordnet module</a></li></ul><h3>Module contents</h3><p>NLTK Stemmers</p><p>Interfaces used to remove morphological affixes from words, leaving only the word stem. Stemming algorithms aim to remove those affixes required for eg. grammatical role, tense, derivational morphology leaving only the stem of the word. This is a difficult problem due to irregular words (eg. common verbs in English), complicated morphological rules, and part-of-speech and sense ambiguities (eg. ceil- is not the stem of ceiling).</p><p>StemmerI defines a standard interface for stemmers.</p><blockquote><strong>References: </strong><br>https://www.nltk.org/<br>https://www.nltk.org/api/nltk.stem.html</blockquote><pre># Porter Stemmer Example<br>import nltk<br>ps = nltk.stemmer.PorterStemmer()<br>ps.stem(&#39;grows&#39;)<br>&#39;grow&#39;<br>ps.stem(&#39;leaves&#39;)<br>&#39;leav&#39;<br>ps.stem(&#39;fairly&#39;)<br>&#39;fairli&#39;</pre><pre># SnowballStemmer Example<br>import nltk<br>sno = nltk.stem.SnowballStemmer(&#39;english&#39;)<br>sno.stem(&#39;grows&#39;)<br>&#39;grow&#39;<br>sno.stem(&#39;leaves&#39;)<br>&#39;leav&#39;<br>sno.stem(&#39;fairly&#39;)<br>&#39;fair&#39;</pre><pre># Lemmatization Example<br>import nltk<br>lemma = nltk.wordnet.WordNetLemmatizer()<br>lemma.lemmatize(&#39;article&#39;)<br>&#39;article&#39;<br>lemma.lemmatize(&#39;leaves&#39;)<br>&#39;leaf&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*qO934nIPLfz6VFYG" /></figure><blockquote>Section 9 &amp; 10: Case Conversions: Upper/lower case &amp; removing Stopwords</blockquote><p>Stopwords are common words or words which do not have importance in the overall sentence(text), like “a”, “an”, “the”, etc. so they can be removed easily.</p><p>We will be using NLTK library for removing stopwords based on English Language. Below is the code snippet to showcase the same</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyPfmHeVMIvnLDRkFGsC-Q.png" /><figcaption>Code-11</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8gVzvY_VAQtraDlhffK4w.png" /><figcaption>Output-11</figcaption></figure><blockquote>Now based on your use-case &amp; needs you can bring all the above concepts and more to it &amp; into a Class/pipeline of functions to get the final text-normalized version of the raw text/ corpus</blockquote><h3>Indeed Build Your Own Text Normalizer using Python</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/0*ktHIlatpSly-NMXv" /></figure><h4>I hope that helped in understanding how you can do your own text preprocessing/ normalization using various libraries available for Python</h4><h4>In this blogpost, we have used <strong>requests, re, beautifulSoup, nltk, spacy, numpy, unicodedata, contractions, textblob libraries….!</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*2HLq8TU-vtlPJMWf" /><figcaption>Done!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*vVuN-8VtAcV7i1k9" /></figure><h4>Please drop in your comments/reactions/feedbacks!!<br>Thanks a lot for reading it!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*r9fSiTq7h784toT5" /><figcaption>Bye!</figcaption></figure><p><strong>Reference: Text Analytics with Python: A Practitioner’s Guide to Natural Language Processing by </strong><a href="https://www.amazon.in/Dipanjan-Sarkar/e/B01M100PAR/ref=dp_byline_cont_book_1"><strong>Dipanjan Sarkar</strong></a><strong> (Author)<br></strong><a href="https://www.amazon.in/Text-Analytics-Python-Practitioners-Processing/dp/1484243536/ref=sr_1_1?crid=3UX0XVSK993E5&amp;keywords=dipanjan+sarkar&amp;qid=1679734713&amp;sprefix=dipanjan+sarka%2Caps%2C230&amp;sr=8-1"><strong>link</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=628f49e08033" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/build-your-own-text-normalizer-using-python-628f49e08033">Build Your Own Text Normalizer using Python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn Python via Gold Resources!]]></title>
            <link>https://blog.devgenius.io/learn-python-via-gold-resources-549a3ef2fc0e?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/549a3ef2fc0e</guid>
            <category><![CDATA[paid]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[resources]]></category>
            <category><![CDATA[free]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sun, 01 Jan 2023 19:17:40 GMT</pubDate>
            <atom:updated>2023-01-02T10:58:57.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0eoMCjAEJdd8SQC8PT3a8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*FNmRmrzfHpREMy0HLMcMsQ.png" /></figure><h3>Gold Resources to Learn Python from Noob to Pro :)</h3><p>If you are a beginner or intermediate or expert maybe this blog will help you learn some new things in Python or in general make the transition from Noob to Pro Python Programmer via resources!</p><p>This blog contains both Free &amp; Paid resources.</p><blockquote><strong>Free Resources</strong></blockquote><p><strong>0- Before getting started with Python</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FF2Mx-u7auUs%3Fstart%3D252%26feature%3Doembed%26start%3D252&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DF2Mx-u7auUs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FF2Mx-u7auUs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcc984f6498e7bd7b00f6f357694190d/href">https://medium.com/media/dcc984f6498e7bd7b00f6f357694190d/href</a></iframe><p><strong>1- Beginner / </strong><a href="https://www.youtube.com/@TechWorldwithNana"><strong>TechWorldwithNana</strong></a><strong> [In general this channel contains very good videos for DevOps &amp; related stuff]</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Ft8pPdKYpowI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dt8pPdKYpowI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Ft8pPdKYpowI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4a81e4e36f8b30a44a825f0ab230583/href">https://medium.com/media/d4a81e4e36f8b30a44a825f0ab230583/href</a></iframe><p><strong>2-Beginner / </strong><a href="https://www.youtube.com/@freecodecamp"><strong>Freecodecamp</strong></a><strong> [One of the best YouTube Channel for Developers]</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FeWRfhZUzrAc%3Fstart%3D2&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeWRfhZUzrAc&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FeWRfhZUzrAc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f466984a90199e90d0c1c2f8e11c7b35/href">https://medium.com/media/f466984a90199e90d0c1c2f8e11c7b35/href</a></iframe><p>Assumingly that you have done either of one of the above or both the courses, lets try to build something so the knowledge gets strengthen.</p><p><strong>3- Build Project/ </strong><a href="https://www.youtube.com/@freecodecamp"><strong>Freecodecamp</strong></a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8ext9G7xspg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8ext9G7xspg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8ext9G7xspg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1aa2c2d0b459314de7bfc1fc38084e0d/href">https://medium.com/media/1aa2c2d0b459314de7bfc1fc38084e0d/href</a></iframe><h3><strong>Projects that you will be able to do</strong></h3><blockquote>1. Madlibs <br>2. Guess the Number (computer) <br>3. Guess the Number (user)<br>4. Rock Paper Scissors<br>5. Hangman<br>6. Tic-Tac-Toe<br>7. Tic-Tac-Toe AI<br>8. Binary Search <br>9. Minesweeper <br>10. Sudoku Solver <br>11. Photo Manipulation in Python <br>12. Markov Chain Text Composer</blockquote><p><strong>4- Build more Projects / Freecodecamp</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPXMJ6FS7llk&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPXMJ6FS7llk&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FPXMJ6FS7llk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e325b3ea6aefc162e7ae51e228bd831/href">https://medium.com/media/2e325b3ea6aefc162e7ae51e228bd831/href</a></iframe><h3>Projects that you will be able to do</h3><blockquote>Project #1 Table Extraction — Extract Tables from Websites</blockquote><blockquote>Project #2 — Web Automation &amp; Web Scraping — HTML Basics — Tags and Elements</blockquote><blockquote>Project #3 — Automate Excel Report — Create a Pivot Table with Python</blockquote><blockquote>Project #4 — Automate WhatsApp</blockquote><p>Lets try to get hands on with the two of the most used libraries with rich functionalities i.e. Pandas &amp; NumPy.</p><p><strong>5- NumPy/ </strong><a href="https://www.youtube.com/@KeithGalli"><strong>Keith Galli</strong></a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGB9ByFAIAH4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGB9ByFAIAH4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGB9ByFAIAH4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/88a248c7517b5adb9aa702f3abfe0c81/href">https://medium.com/media/88a248c7517b5adb9aa702f3abfe0c81/href</a></iframe><p><strong>6- Pandas / </strong><a href="https://www.youtube.com/@KeithGalli"><strong>Keith Galli</strong></a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvmEHCJofslg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvmEHCJofslg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvmEHCJofslg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5aaf6193a7da5462bde9d61dddbec2aa/href">https://medium.com/media/5aaf6193a7da5462bde9d61dddbec2aa/href</a></iframe><p><strong>7- Project: How to Build a Football Data Web App in Python / </strong><a href="https://www.youtube.com/@DataProfessor"><strong>Data Professor</strong></a><strong> [ This channel contains very good videos related to Streamlit &amp; Data Science]</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzYSDlbr-8V8%3Flist%3DPLtqF5YXg7GLmCvTswG32NqQypOuYkPRUE&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzYSDlbr-8V8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzYSDlbr-8V8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f493d496ef39ccdeb063d68dfb77ab79/href">https://medium.com/media/f493d496ef39ccdeb063d68dfb77ab79/href</a></iframe><p><strong>8- OOP/ freecodecamp</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEj_02ICOIgs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEj_02ICOIgs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEj_02ICOIgs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eaa90d4df4c8a89c5b19a09aaddf71c4/href">https://medium.com/media/eaa90d4df4c8a89c5b19a09aaddf71c4/href</a></iframe><blockquote><strong>Paid Resources</strong></blockquote><p><strong>1- </strong><a href="https://www.udemy.com/course/learn-complete-python-tutorial-in-simple-way/"><strong>Learn Complete Python In Simple Way</strong></a><strong> [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*inpA6g9JWxrRUUeokqk91g.png" /></figure><p><a href="https://www.udemy.com/course/learn-complete-python-tutorial-in-simple-way/">Course Link</a></p><ul><li>It goes for Scratch to Advance</li><li>Good for beginners</li><li>Good for interviews as well</li><li>Covers almost every python topic</li></ul><p><strong>2-</strong><a href="https://www.udemy.com/course/complete-python-developer-zero-to-mastery/"><strong> Complete Python Developer in 2023: Zero to Mastery</strong></a><strong> [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*d4SrpBTadtcX2XCYQ4_YAA.png" /></figure><p><a href="https://www.udemy.com/course/complete-python-developer-zero-to-mastery/">Course Link</a></p><ul><li>It goes for Scratch to Advance</li><li>Good for beginners</li></ul><p><strong>3- Python 3: Deep Dive (Part 1 — Functional) [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*sKsUh-ylewv3vGjPtkseIw.png" /></figure><p><a href="https://www.udemy.com/course/python-3-deep-dive-part-1/">Link</a></p><p><strong>4- Python 3: Deep Dive (Part 2 — Iteration, Generators) [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*abRpTG2ySaYQlTvJyCCtoQ.png" /></figure><p><a href="https://www.udemy.com/course/python-3-deep-dive-part-2/">Link</a></p><p><strong>5- Python 3: Deep Dive (Part 3 — Hash Maps, JSON Serialization) [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*6yww46-4FyjpQK0x4jV4aQ.png" /></figure><p><a href="https://www.udemy.com/course/python-3-deep-dive-part-3/">Link</a></p><p><strong>6-Python 3: Deep Dive (Part 4 — OOP) [Udemy]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*f1AETwLWUNtgJmj3NQMJVw.png" /></figure><p><a href="https://www.udemy.com/course/python-3-deep-dive-part-4/">Link</a></p><ul><li>Python 3: Deep Dive Series Part 1, 2, 3, 4 goes from intermediate to as the name suggests goes Deep!</li><li>Basic Python understanding is required before taking the course</li></ul><blockquote><strong>Extra: VS CODE</strong></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1ZfO149BJvg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1ZfO149BJvg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1ZfO149BJvg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b491f78907bd3220fb6555391c227030/href">https://medium.com/media/b491f78907bd3220fb6555391c227030/href</a></iframe><blockquote><strong>Extra: VS Code Tips &amp; Tricks</strong></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FifTF3ags0XI%3Fstart%3D192%26feature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DifTF3ags0XI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FifTF3ags0XI%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9508676c1d5de42ced7561cb3d6cb00/href">https://medium.com/media/f9508676c1d5de42ced7561cb3d6cb00/href</a></iframe><p>Hope these resources serve you good in learning python in a fun way yet gaining the good or deep understanding of concepts &amp; coding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*rA56fNMLnyVyPrwXcTxfTQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=549a3ef2fc0e" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/learn-python-via-gold-resources-549a3ef2fc0e">Learn Python via Gold Resources!</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secret world around Python’s Dictionary]]></title>
            <link>https://blog.devgenius.io/secret-world-around-pythons-dictionary-697ba074a0ab?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/697ba074a0ab</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[dictionary]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 15:37:19 GMT</pubDate>
            <atom:updated>2022-12-10T14:01:42.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qCrBcQXx9NB9ElK_.jpg" /></figure><p>Lets cover Python’s Data Structure Dictionary &amp; the less explored things inside it.</p><h4>Topics to be covered:</h4><ol><li>Dictionary Default Values</li><li>Mapping Keys to Multiple Values in a Dictionary</li><li>Calculating with Dictionaries</li><li>Finding Commonalities in Two Dictionaries</li><li>Filtering out words in a sentence based on some threshold i.e number of occurrences</li><li>Mathematical operations on dictionaries</li><li>Sorting a List of Dictionaries by a Common Key</li><li>Switch/Case Statements With Dictionary</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*bHakfLtvoKq94i5y" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*FGTlhhGk2HzpxbLT" /></figure><h3>1. Dictionary Default Values</h3><blockquote><em>Example: Lets take the jersey number of the few famous Indian cricket players and create a dictionary out of it where key is jersey-number and value is Player Name</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEMbQILNlkWR4h90hyC_IQ.png" /><figcaption>Code-1</figcaption></figure><p>After running the above code snippet we get the below output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*I3eaKPbGgDsFQtHPprb9bg.png" /><figcaption>Output-1</figcaption></figure><blockquote>Now if we try to get some jersey_number which is not present inside our defined jersey_dict then it will give KeyError</blockquote><blockquote>For example if we ran the above code snippet for jersey_name=13; we will get KeyError: 13 &amp; output for the same is below</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f41TRlgLHwYDaQlakzJhNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*9W6xRNkDkwxDXVn8Jc_8RA.png" /></figure><blockquote>A KeyError isn’t something that we want our code to get us back &amp; so ideally we should be able to address this issue if the corresponding Key is not found/present inside our defined jersey_dict</blockquote><blockquote>So we can solve the above KeyError using the below code changes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2T-eNrphRA-kY0CX58wng.png" /><figcaption>Code-2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*2N2oROP1SLV5qJOPBYlfhA.png" /><figcaption>Output-2</figcaption></figure><blockquote>We are able to fix the KeyError exception but there is still room for improvement. As you can see we are accessing the dict twice which is not a good coding practice to be followed &amp; it is not Pythonic and it is inefficient as well.</blockquote><blockquote>We can use the try-except block to fix the above concern &amp; the corresponding is as follows:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbZWG9DwD3wrYrT4wtAmgA.png" /><figcaption>Code-3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*OTx79Irzb2LSOVo4lOc_3Q.png" /><figcaption>Output-3</figcaption></figure><blockquote>The code is better than the previous version but we can still improve the code &amp; maybe write cleaner version of the same code for the above KeyError Exception using dictionary’s get() method.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MqSo0gFYmMNft0-cfje2Kw.png" /><figcaption>Code-4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*cEhxLcFU8Dk8rO25PJTWAQ.png" /><figcaption>Output-4</figcaption></figure><blockquote>Now the above code in the Figure: Code-4, uses dictionary’s built-in method &amp; it is cleaner &amp; precise &amp; the best solution out of all solutions discussed above.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*zdhDhk39sacwSLNs" /></figure><h3>2. Mapping Keys to Multiple Values in a Dictionary</h3><blockquote><em>Example :Lets create a dictionary for first innings for a cricket match where key is over-number and value is array/list containing runs scored in an over</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RgRBlzVyqJg-_YcLiRMrA.png" /><figcaption>Code-5</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*TZCG3Qfz6lnF00DRY3vvuw.png" /><figcaption>Output-5</figcaption></figure><blockquote><em>We if want get the data in the above form as specified in the first_innings_dict. We can use </em><strong><em>defaultdict from collections module</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*duLObr_BQjmhvfbJzRiX-A.png" /><figcaption>Code-6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*_AvD1qODRyF5aTc76XRuww.png" /><figcaption>Output-6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*CUuW3nRkgM53VHF5" /></figure><h3>3. Calculating with Dictionaries</h3><blockquote>Now lets say we take the above first_innings_dict &amp; do the addition of all runs scored in an over &amp; create a dictionary first_innings_dict_sum out of it</blockquote><ul><li>In which over we scored the max runs?</li><li>In which over we scored the min runs?</li><li>Sort the dictionary</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9XBftbI89CC5s4879W5bw.png" /><figcaption>Code-7</figcaption></figure><blockquote>max_scored = max(zip(first_innings_dict_sum.values(), first_innings_dict_sum.keys())) # we use zip to use the values &amp; keys at the same time &amp; do a max over it &amp; return the max value over it</blockquote><blockquote>Similarly, we can do min &amp; sorting of the dict based on the values, as shown in the above code</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*wQfBJYaOkxCi2WH1Bp200Q.png" /><figcaption>Output-7</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*i95te-4Iz8k6ejZm" /></figure><h3>4.Finding Commonalities in Two Dictionaries</h3><blockquote>Example: Lets create a dictionary for first innings &amp; second innings for a cricket match where key is over-number and value is total runs scored in an over</blockquote><ul><li>Find common keys in dictionaries</li><li>Find common items in dictionaries</li><li>Subtraction of keys in dictionaries</li><li>Removal of keys from the overall dictionaries</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1J_Q7YJem3QEke1RgWJXA.png" /><figcaption>Code-8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*C_C6jea4NT0IHUd0ZgCK8Q.png" /><figcaption>Output-8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*5wBMKQft7UlOv9I2Df8OJA.png" /></figure><h3>5.Filtering out words in a sentence based on some threshold i.e. number of occurrences</h3><blockquote>Example : <em>Lets take scenario where you are dealing with text &amp; words And you need to count how many times a word occur in a sentence to be declared as important or not important based on some threshold or minimum of occurrences to be considered before calling it as important</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*HiH3UJr2VLg9lrvD7J63RA.png" /><figcaption>Code-9</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46FI7Z39iOUpHMMc0_UKAQ.png" /><figcaption>Output-9</figcaption></figure><h3>6. Mathematical operations on dictionaries</h3><blockquote><em>Example: Lets take scenario where you are dealing with text &amp; words, here in this case lets say we had 2 sentences &amp; we do a word count for each sentence now if we wanted to some mathematical operations on dictionaries</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*PZwJV0xIVuzkN8xjxtst4Q.png" /><figcaption>Code-10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVZ9yoT8Cvc_QuiBIrKMCQ.png" /><figcaption>Output-10</figcaption></figure><h3>7. Sorting a List of Dictionaries by a Common Key</h3><blockquote><em>Example: Lets take scenario where you are dealing with a list containing dicts again going back to cricket example lets say we have first_name, then last_name , jersey_number for some players and we want to sort dict based on some fields</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*depeUehi2h09awiFtj2Z2w.png" /><figcaption>Code-11</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgIv3nIe3rg7h-gIFvmY9w.png" /><figcaption>Output-11</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*H7nrCt87Wwuqh4sd" /></figure><h3>8.Switch/Case Statements With Dictionary</h3><blockquote><em>Example: lets take a example where we are using multiple case statements or just say multiple conditions. Allowed operations are “add”, “subtract”, “multiply”, “divide”</em></blockquote><blockquote>And we can have a code with some function as follows:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnkDGLCQmsZ0oWi8_GFi2Q.png" /><figcaption>Code-12</figcaption></figure><blockquote>And the corresponding is as follows:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*JgyqtDozAevE3Da0wcwuzQ.png" /><figcaption>Output-12</figcaption></figure><blockquote>We can improve the above code using dict &amp; the code snippet is as follows:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIiyaD9AKETo2xSEjPyZeQ.png" /><figcaption>Code-13</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*g94aF0fRnoHVMFB4rUh_Kw.png" /><figcaption>Output-13</figcaption></figure><p>I hope this examples &amp; code snippets were useful to you. Please feel free to drop any feedbacks &amp; comments. Thanks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*kO_R64agvzVcXxUA" /></figure><h4>Just a meme:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*0meewFG2V_B0kwn5" /><figcaption>haha</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=697ba074a0ab" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/secret-world-around-pythons-dictionary-697ba074a0ab">Secret world around Python’s Dictionary</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Super Charge yourself with Images & OpenCV in a fun way]]></title>
            <link>https://blog.devgenius.io/super-charge-yourself-with-images-opencv-in-a-fun-way-bb50ddd16bf9?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb50ddd16bf9</guid>
            <category><![CDATA[vidéo]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[image]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sat, 17 Sep 2022 17:38:00 GMT</pubDate>
            <atom:updated>2022-12-10T14:01:39.649Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*dwm5N5QrWzjmtfUs0sej1A.gif" /></figure><h3><strong>The goal of the blog is to cover the following topics :</strong></h3><ol><li>What is a image? What is a pixel ?</li><li>What is a Binary vs Grayscale image?</li><li>What is a color image?</li><li>What is Image Resolution &amp; standard resolutions?</li><li>What are some common image formats?</li><li>What is Image Processing?</li><li>Usage of Image Processing</li><li>Which are the popular libraries in python to read/manipulate images?</li><li>Why to use OpenCV?</li><li>How to install OpenCV?</li><li>How to read a image using Python &amp; OpenCV?</li><li>How to read &amp; write a image using Python &amp; OpenCV?</li><li>How to rescale a image using Python &amp; OpenCV?</li><li>How to read a video using Python &amp; OpenCV?</li><li>How to rescale a video using Python &amp; OpenCV?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*p4jUehZcDUmhdUO5iq70Zg.jpeg" /><figcaption>Let get started….!</figcaption></figure><h3><strong>1. What is a image?</strong></h3><blockquote>An image, digital image, or still image is a binary representation of visual information, such as drawings, pictures, graphs, logos, or individual video frames. Digital images can be saved electronically on any storage device.</blockquote><blockquote>Image is made up of pixels or a matrix (grid) of pixel values. Pixel is the smallest building block of the image.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*PO6yg2tkCRoagd3uMCdC-A.png" /></figure><p>In the above picture, it is rectangle made up of boxes or it can be said as matrix of 8 x 8 where h is height &amp; w is width of the matrix or image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qj3a3tveccwvDWx-FZiGYg.png" /></figure><p>Each box represented are pixel values which denote intensity or color in a given place(address) for a image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*GX6fSUBIMAgGkKp2.png" /></figure><p>As you can see various pixel values in the above picture ranging from 0 to 255 i.e. 256 levels in other words this is a <strong>Grayscale image</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cJx9EAV3mZGGiLja-QNpw.png" /><figcaption>Levels</figcaption></figure><h3><strong>2. What is a Grayscale Image? What is a Binary Image?</strong></h3><blockquote><strong>Grayscale Image</strong>, e.g. gray scales from 0 to 255 i.e. 256 levels or 8 bits</blockquote><blockquote><strong>Binary image</strong> is binary, it means black(0) or white(1) i.e. 2 levels</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/0*UfH5aHCoGY8qoF5a" /><figcaption>Grayscale vs Binary Image</figcaption></figure><p>Above is the example for Grayscale vs Binary Image, left part is Grayscale representation &amp; right part is Binary representation</p><h3><strong>3. What is a Color Image?</strong></h3><blockquote>1. <strong>Black and White image (Binary)</strong>: a M x N matrix. Each has value 1 or 0.<br>2. <strong>Grayscale image</strong>: a M x N matrix. Each member has value ranging from 0 to 255<br>3. <strong>Color image</strong>: MxNx3 matrix. Each M x N plane for Red, Green, Blue channel. And each member has value ranging from 0 to 255.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*XF8FB7gQAGDl-MumvtyPxg.png" /></figure><p>Alternatively we can say that:</p><blockquote>Grayscale image only has shades of black and white. It doesn’t have any color information like chrominance.</blockquote><blockquote>Gray scale image is usually 8bit image with each pixel having 256 combinations of shades of gray.</blockquote><blockquote>Whereas color image usually is a 24 bit image with 8bits of Red, 8 bits of Green, 8bits for blue information. Combination of these three basic colors can create 16,777,216 color combinations for a pixel.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*MEOaAoNEhPh_1Vvg" /></figure><p>As discussed above, image is a matrix of pixel values with some height &amp; width i.e. this representation of width x height is also known as <strong>Image Resolution.</strong></p><h3><strong>4. What is Image Resolution?</strong></h3><blockquote><strong>Image resolution</strong> is the pixel resolution — that is, the number of pixels in the image. <strong>Image resolution is typically expressed as a horizontal x vertical measurement or width x height</strong>.</blockquote><blockquote><strong>According to WIKIPEDIA</strong>: <strong>Image resolution</strong> is the detail an image holds. The term applies to digital images, film images, and other types of images. “Higher resolution” means more image detail. Image resolution can be measured in various ways. <strong>Resolution</strong> quantifies how close lines can be to each other and still be visibly resolved.</blockquote><h3><strong>Standard image resolutions are:</strong></h3><blockquote><strong>VGA</strong> (Video Graphics Array) : 640 x 480 pixels</blockquote><blockquote><strong>HD</strong> (High Definition): 1280 x 720 pixels pixels</blockquote><blockquote><strong>FHD</strong> (Full High Definition): 1920 x 1080 pixels</blockquote><blockquote><strong>4K </strong>resolution refers to a horizontal display resolution of approximately 4,000 pixels: 3840 x 2160 pixels</blockquote><h3><strong>5. Standard digital image file formats include the following:</strong></h3><blockquote><strong>JPEG</strong> (pronounced JAY-peg) is a graphic image file produced according to the Joint Photographic Experts Group standard.</blockquote><blockquote><strong>GIF</strong> (pronounced JIF by many, including its designer, and pronounced GIF with a hard G by others) stands for Graphics Interchange Format.</blockquote><blockquote><strong>PNG</strong> (pronounced ping) is the Portable Network Graphics file format for image compression.</blockquote><blockquote><strong>SVG</strong> (Scalable Vector Graphics) is a vector file used to display 2D graphics, charts and illustrations online.</blockquote><blockquote><strong>TIFF </strong>(Tag Image File Format) is a standard format for exchanging raster graphic (bitmap) images between application programs, including those used for scanner images.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*dnWughDXg6LpxwyQ" /></figure><h3>6. What Is Image Processing?</h3><blockquote>Image processing is the process of transforming an image into a digital form and performing certain operations to get some useful information from it.</blockquote><blockquote>The image processing system usually treats all images as 2D signals when applying certain predetermined signal processing methods.</blockquote><h3>7. Usage of Image Processing</h3><blockquote>Instagram &amp; Snapchat filters<br>Computer Vision<br>Microscopic Imaging<br>Facial Recognition<br>Object detection<br>X-Ray Bone Detection<br>Feature Extraction</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*fqkzW9u4_VhmXyvUWCoM4g.png" /></figure><h3>8. Which are the popular libraries in python to read/manipulate images?</h3><blockquote><a href="https://opencv.org/">OpenCV</a><br><a href="https://scikit-image.org/">Scikit-image</a><br><a href="https://scipy.org/">SciPy</a><br><a href="http://mahotas.readthedocs.io/en/latest/">Mahotas</a><br><a href="https://pillow.readthedocs.io/">Pillow/PIL </a><br>SimpleITK <br><a href="https://matplotlib.org/">Matplotlib </a><br><a href="https://numpy.org/">NumPy</a><br>Pgmagick<br>SimpleCV</blockquote><h3>9. Why to use OpenCV ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*JOVuGtnrlfNYnt0N" /></figure><p>Credit: <a href="https://medium.com/analytics-vidhya/what-and-why-opencv-3b807ade73a0">https://medium.com/analytics-vidhya/what-and-why-opencv-3b807ade73a0</a></p><blockquote><em>OpenCV is a library of Programming functions which are used in real-time Computer Vision. It is developed by </em><a href="https://en.wikipedia.org/wiki/Intel_Corporation"><em>Intel Corporation</em></a><em>, </em><a href="https://en.wikipedia.org/wiki/Willow_Garage"><em>Willow Garage</em></a><em>, Itseez .</em></blockquote><blockquote><em>“OpenCV is cross-Platform and Free for use under the license which makes it easy for businesses to utilize and modify the code and supports the Deep Learning Frameworks TensorFlow, Torch/PyTorch and Caffe.”</em></blockquote><blockquote><em>OpenCV is written in </em><a href="https://en.wikipedia.org/wiki/C%2B%2B"><em>C++</em></a><em> . supports Windows, Linux, </em><a href="https://opencv.org/android/"><em>Android</em></a><em> and Mac OS.</em></blockquote><p><strong><em>Which Language it supports :</em></strong></p><blockquote>1. C++</blockquote><blockquote>2. Android SDK</blockquote><blockquote>3. Java</blockquote><blockquote>4. Python</blockquote><blockquote>5. MATLAB/OCTAVE</blockquote><blockquote>6. C (Not recommended)</blockquote><p><strong><em>Which OS(Desktop and Mobile) it supports :</em></strong></p><ol><li>Linux</li><li>Windows</li><li>Android</li><li>Mac-OS</li><li>FreeBSD,</li><li>NetBSD</li><li>OpenBSD.</li></ol><blockquote>The library has more than 2500 optimized algorithms, which includes a comprehensive set of both classic and state-of-the-art computer vision and machine learning algorithms.</blockquote><blockquote>OpenCV has more than 47,000 people of user community and estimated number of downloads exceeding 18 million or 180 lakh which makes its more important in world community.</blockquote><h3>10.How to install OpenCV?</h3><blockquote>pip install opencv-python</blockquote><p>For more options check this: <a href="https://pypi.org/project/opencv-python/"><strong>https://pypi.org/project/opencv-python/</strong></a></p><h4>Lets get started with OpenCV finally:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*6KWfi43v5AYeL_Yk.jpg" /></figure><h3>11.How to read a image using Python &amp; OpenCV?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*OKePzcEd4aigJtXwxjh_vg.png" /></figure><p>You can run the above code snippet :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*sr1-abmolUyeuLe19Np-aA.png" /></figure><blockquote>The <strong>argparse</strong> module makes it easy to write user-friendly command-line interfaces.</blockquote><p>Where</p><p><strong>read_image.py</strong> is the module/python script</p><p><strong>— image meme.jpg</strong> is to tell the path of the image</p><p>The output is as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*1PXxl-1aVZ1VeK3Z29CIkw.png" /><figcaption>Output Figure</figcaption></figure><p>Now going into the details of the above script:</p><ul><li>image = cv2.imread(<strong>args[“image”]</strong>) where args[“image”] gives the path to the cv2.imread function</li><li><strong>cv2.imread</strong> read the image from the given path &amp; stores it into image variable</li><li><strong>image.shape</strong> gives the details about the image</li><li>As from the output Image INFO: <strong>(268, 474, 3)</strong> where 268 is width, 474 is height &amp; 3 denotes number of channels i.e. RGB</li><li>cv2.imshow(“Meme Image”, image) : gets the image variable &amp; displays the given image with the Window Name: Meme Image as we can see from the Output Figure.</li></ul><h3>12. How to read &amp; write a image using Python &amp; OpenCV?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*yPlB-W7j0GaGNrHNXVsswg.png" /><figcaption>Read &amp; write image</figcaption></figure><p>We are using mostly the above same code snippet except the following change:</p><ul><li><em># Read the image &amp; write the image with new name &amp; new format</em></li><li>cv2.imwrite(“newimage.png”, image) where “newimage.png” is the name &amp; format to be saved as.</li></ul><h3>13.How to rescale a image using Python &amp; OpenCV?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*FuVUxb1LfYWJE8b4_fLVDQ.png" /></figure><blockquote><em># Reisze the image</em></blockquote><blockquote>imgResize = cv2.resize(image, (200, 200)) here (200,200) is the new size in which we want to resize the image &amp; cv2.resize is the function we are using to resize using the opencv</blockquote><blockquote><em># Saving the image with new shape</em></blockquote><blockquote>cv2.imwrite(“resized_image.jpg”, imgResize) here we are passing the imgResize variable to cv2.imwrite function to save the resized image with name: “resized_image.jpg”</blockquote><blockquote>cv2.imshow(“Meme Org Image”, image) : To show the output window</blockquote><blockquote>cv2.imshow(“Resized Image”, imgResize) : To show the output window</blockquote><p>We run the script as show in the below picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*mu9oGRE7tKaiKJ7bIOH7XQ.png" /></figure><p>The output is as follows : Left is the Original image &amp; right is the resized image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1CED-4_1TDCKShZua9N8Gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*hPxs-j2RK8G-0ScQ" /></figure><h3>14. How to read a video using Python &amp; OpenCV?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*Dwf2bY1akmLyiPHmJY0OuQ.png" /></figure><blockquote>capture = cv2.VideoCapture(“got.mp4”) # VideoCapture function to read the video from the specified Path</blockquote><blockquote># Looping through the frames</blockquote><blockquote>while True:</blockquote><blockquote>isTrue, frame = capture.read()</blockquote><blockquote>cv2.imshow(“Video”, frame) # read frame by frame &amp; display it</blockquote><blockquote>if cv2.waitKey(20) &amp; 0xFF == ord(“d”): # if you press “d” from keyboard it stops</blockquote><blockquote>break</blockquote><blockquote>capture.release() # release the video object</blockquote><blockquote>cv2.destroyAllWindows()</blockquote><p>Output of the above the code snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpk_BeRPWwLI70qEOqza3A.png" /></figure><h3>15.How to rescale a video using Python &amp; OpenCV?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CyJQRTylkLAAxGmYyf0HNA.png" /></figure><h4>Define a rescale framing function to Rescale every frame:</h4><blockquote>def rescaleFrame(frame, scale=0.75):</blockquote><blockquote>width = int(frame.shape[1] * scale)</blockquote><blockquote>height = int(frame.shape[0] * scale)</blockquote><blockquote>dimensions = (width, height)</blockquote><blockquote>return cv2.resize(frame, dimensions, interpolation=cv2.INTER_AREA)</blockquote><p>Output after running the above code snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGt3NF4bfCdM0Xq6_dMoLw.png" /></figure><p>In the above output screenshot we can clearly see the original video &amp; resized video frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*CSWT-mHoDJF9fDFa" /></figure><p>Hopefully these basics will get you started with OpenCV &amp; you can build great tools &amp; applications basis of OpenCV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*T1tyiyImZGOd-J3U.jpg" /></figure><p>Please feel free to add any feedback or comments. Thank you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*mGFh77eycUi9Wu4r" /></figure><h3>References:</h3><p><a href="https://www.quora.com/What-is-the-difference-between-grayscale-image-and-color-image?share=1">What is the difference between grayscale image and color image?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb50ddd16bf9" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/super-charge-yourself-with-images-opencv-in-a-fun-way-bb50ddd16bf9">Super Charge yourself with Images &amp; OpenCV in a fun way</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DATA SCIENCE ESSENTIALS :SQL]]></title>
            <link>https://blog.devgenius.io/data-science-essentials-sql-66c85e4c2b3e?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/66c85e4c2b3e</guid>
            <category><![CDATA[data-sciene]]></category>
            <category><![CDATA[rdbms]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[dbms]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sun, 28 Aug 2022 13:05:13 GMT</pubDate>
            <atom:updated>2022-12-10T14:01:36.750Z</atom:updated>
            <content:encoded><![CDATA[<h3>DATA SCIENCE ESSENTIALS :SQL</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*mZOPYR9zjtk3sAZZB-hSvg.png" /></figure><h3>1.Introduction:</h3><blockquote><strong>Is SQL needed in the field of data science domain? or In general in data related roles?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*WgSvFPJ9hlOm_kv1mcQQow.png" /></figure><blockquote>The short answer to this question is, of course, yes!</blockquote><blockquote>In fact, Data Science (DS) is strongly interlinked with SQL, and if you want to pursue a career in this domain, learning SQL is mandatory.</blockquote><blockquote><strong>As alphabets are the foundation of English, in the same way, we can say that SQL is the foundation of DS.</strong></blockquote><blockquote>SQL is the language that is used everywhere; therefore, it is high in demand as all top companies use SQL to query data and perform analysis. Though there are many other languages, the scope of SQL is never going to end.</blockquote><h3>2. What is SQL?</h3><ul><li>SQL stands for <strong><em>Structured Query Language.</em></strong></li><li>It is the language <strong><em>“to talk”</em></strong> to the database(s) i.e. <strong><em>“to query”</em></strong> to the database</li><li>It is a query language to retrieve , add ,modify data to database.</li><li>SQL is use to talk to all the relational databases/ RDBMS.</li></ul><h3>3. SQL VS MYSQL ?</h3><blockquote>MySQL is an open-source relational database management system. Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter My, and “SQL”, the abbreviation for Structured Query Language.</blockquote><blockquote>A relational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data.</blockquote><blockquote>MySQL uses the SQL language to query the database.</blockquote><blockquote>Similar to MySQL there are other popular RDBMS like PostgreSQL, Oracle, MS-SQL, SQLite, etc.</blockquote><h4>Note:</h4><p>For the Purpose of this tutorial we will stick to MySQL, you can use any one of the popular RDBMS &amp; the syntax is almost similar so there should be not any problem following this.</p><p>Also see the below picture for the databases survey for all kind of databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*LPx3lmq2VEe4wpSFDh_A1g.png" /></figure><h3>4. Installation of the MySQL</h3><p>Please follow the steps showcased in the video below:</p><blockquote><a href="https://www.youtube.com/watch?v=OM4aZJW_Ojs">How to install MySQL 8.0.22 Server and Workbench latest version on Windows 10</a></blockquote><p>Assumingly the installation are done correctly, we can start finally with the hands on with SQL……Yeah!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*VtWv4wAgP5v4MxF_ANfUMw.png" /><figcaption>Yes!</figcaption></figure><h3>5. Basic SQL Queries</h3><p><em>I will be using the mysql from the command prompt</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*ctn2Bm7GYNmpzz9XN2NGtg.png" /></figure><p>Copy the path where the MySQL Server bin is present.</p><blockquote><strong>cd C:\Program Files\MySQL\MySQL Server 8.0\bin</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*hiVYXhM-v13o6GaQs2pCYw.png" /></figure><blockquote><strong>mysql -u root -p</strong></blockquote><ul><li>“-u” is for the username in this case it is “root:</li><li>“-p” for the password</li><li>So once the above command runs correctly you will see the below output</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*d8nUjbF_KqKbH0KOYCJMpw.png" /></figure><blockquote><strong>SHOW DATABASES;</strong></blockquote><blockquote>We generally write the keywords in the capital format as in the above command we wrote <strong>SHOW , DATABASES </strong>both are SQL Keywords &amp; followed by <strong>;(semicolon) </strong>indicating the end of query.</blockquote><blockquote>SHOW DATABASES; <em>command returns the list of available databases</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*fK7U9lBtqdJT2KubLW17XA.png" /></figure><blockquote><strong>help; </strong>As the name suggests helps you</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*Uw1sPCqsJlvYNDU1cVWtwQ.png" /></figure><blockquote><strong>SELECT @@hostname</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*JHDUvbcNgTBhwVly2LatMA.png" /></figure><p>Returns the hostname for your pc in my case it is MSI</p><blockquote><strong>What is a database?</strong></blockquote><blockquote>A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a <a href="https://www.oracle.com/database/what-is-database/#WhatIsDBMS">database management system (DBMS)</a>. Together, the data and the DBMS, along with the applications that are associated with them, are referred to as a database system, often shortened to just database.</blockquote><blockquote><strong>CREATE DATABASE &lt;DB_NAME&gt;;</strong></blockquote><p>Using the above command we can create the database with our choice of database-name</p><p>eg: <strong>CREATE DATABASE cricket_db;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*KM8Rvn1P_lZU8N-vwSxjxA.png" /></figure><p>As we can see in the output cricket_db is created &amp; in the list of databases now.</p><blockquote><strong>DROP DATABASE &lt;&lt;DB_NAME&gt;&gt;;</strong></blockquote><p>Deletes the specified the data</p><p>eg: DROP DATABASE ipl_db;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*f1dO_59uddQ6VDzRYx2NwA.png" /></figure><blockquote><strong>USE &lt;DB_NAME&gt;;</strong></blockquote><p>To select Database &amp; start using it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*hIWZOlldWp5XFKMYROuAKg.png" /></figure><blockquote><strong>SELECT DATABASE();</strong></blockquote><p>To get which Database are we using currently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*vW3ALIsZAxDmtMdk2_jP6w.png" /></figure><blockquote><strong>What is a table?</strong></blockquote><blockquote>A database table is a structure that organizes data into rows and columns</blockquote><blockquote>In simple terms it is similar to a spreadsheet containing rows &amp; columns</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*9NyQRMP3PD0PJj1dyYQAfQ.png" /><figcaption>Spreadsheet example</figcaption></figure><p>Lets try to create a table for Indian team which will have three fields: first-name, last-name, age.</p><blockquote>first_name: max 50 character limits</blockquote><blockquote>first_name: max 50 character limits</blockquote><blockquote>age: Number</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*xFA33bMDA6sMOs3OMUPxEQ.png" /></figure><blockquote><strong>CREATE TABLE &lt;TABLE_NAME&gt;(schema);</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*SrfR6VCo9uZEulCj9S4wKQ.png" /></figure><p>In the above the above command</p><p>VARCHAR(50): meaning Variable-length max 50 characters</p><p>INT : meaning it can be a number</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*DcbGpTSr6xgFY7bZRvfYEA.png" /></figure><p>We are able to create the table with table-name indian_team with 3 fields discussed above</p><blockquote><strong>SHOW COLUMNS FROM indian_team;</strong></blockquote><p>We can get more details above the table using the above command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*SCIHtYv9uhM9v6nWzdBcXA.png" /></figure><blockquote><strong>DESC indian_team;</strong></blockquote><p>We can get similar details about the table using the above command as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Nb72-3VjWIboBOF9KmV0Yg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*idD5XLpQkBoWC2WNpg0S-Q.png" /></figure><blockquote><strong>INSERTING SINLGE DATA</strong></blockquote><blockquote><strong>INSERT INTO &lt;table_name&gt; (fields) VALUES ();</strong></blockquote><p>The above can be understand more easily seen the below command</p><p>eg: INSERT INTO indian_team (first_name, last_name, age) VALUES (‘Rohit’, ‘Sharma’, 33);</p><p>So here order is important between the fields &amp; values, it can be mapped like this:</p><ul><li>first_name: “Rohit”</li><li>last_name: “Sharma”</li><li>age: 33</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*na1n7f2IHpdO5U2TZnRAyg.png" /></figure><blockquote><strong>INSERTING MULTIPLE VALUES AT ONCE:</strong></blockquote><blockquote><strong>INSERT INTO indian_team (first_name, last_name, age)</strong></blockquote><blockquote><strong>VALUES (‘KL’, ‘Rahul’, 29),</strong></blockquote><blockquote><strong>(‘Virat’, ‘Kohli’, 32),</strong></blockquote><blockquote><strong>(‘Suryakumar’, ‘Yadav’, 28);</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*YVkV0c9Hcu85wzydGa2Xfg.png" /></figure><h3>6.BE CAREFUL with INSERTIONS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*g7GNePFMaEv5Bu4DBa8k0w.png" /></figure><blockquote>Consider the below command since the age has INT data type “28” can give error or warning or maybe that is correct so lets check after running the command.</blockquote><blockquote>INSERT INTO indian_team (first_name, last_name, age) VALUES (‘Hardik’, ‘Pandya’, ‘28’);</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*0hUSU28fzOJOn7v0nbq_kQ.png" /></figure><blockquote>IT WORKS!!</blockquote><blockquote>Consider the below command since the first_name has MAX 50 characters LIMIT</blockquote><blockquote>INSERT INTO indian_team (first_name, last_name, age) VALUES (‘hakhdfkhskahfkhakshfkhkashfkhsakfhkashkfhkashfkhsakfhkahskfhskahfkhsakfdhksahkfhkashfkhksahf’, ‘Pandya’, ‘28’);</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7Tn6jUGNuc3T5WVFJ5p4Q.png" /></figure><blockquote>IT DOESNT WORK THIS TIME..!</blockquote><blockquote><strong>SHOW WARNINGS;</strong></blockquote><p>We can run the above command &amp; get the error for our query like the above the output.</p><p>I hope this will help you get started with SQL &amp; basic syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*Zf8-xhCQFBJM8LltRGvzeA.png" /></figure><h3>7.References:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOM4aZJW_Ojs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOM4aZJW_Ojs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOM4aZJW_Ojs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/780b3892ccc720c764095641329a1711/href">https://medium.com/media/780b3892ccc720c764095641329a1711/href</a></iframe><p><a href="https://www.oracle.com/database/what-is-database/">What Is a Database?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66c85e4c2b3e" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/data-science-essentials-sql-66c85e4c2b3e">DATA SCIENCE ESSENTIALS :SQL</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[♻️Waste Classification by Building Convolutional Neural Network (CNN) using TensorFlow ♻️]]></title>
            <link>https://blog.devgenius.io/%EF%B8%8Fwaste-classification-by-building-convolutional-neural-network-cnn-using-tensorflow-%EF%B8%8F-8dca408a0c0b?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dca408a0c0b</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deeplearing]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sat, 13 Aug 2022 14:08:31 GMT</pubDate>
            <atom:updated>2022-08-13T17:05:16.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*e2kdmwqe-1GxUQ2KDq8x7w.png" /><figcaption>Waste Classification</figcaption></figure><h3>PROBLEM:- WASTE CLASSIFICATION</h3><blockquote>Waste management is a big problem in our country. Most of the wastes end up in landfills. This leads to many issues like:</blockquote><blockquote><em>Increase in landfills<br>Eutrophication<br>Consumption of toxic waste by animals<br>Leachate<br>Increase in toxins<br>Land, water, and air pollution</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*W9L72nsY5eGqB6sU6BHqJA.png" /><figcaption>Waste Dumping</figcaption></figure><blockquote><strong>APPROACH: Automate the process by using IoT and machine learning / deep</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*32IPJZ46HFgI7dpE5p_Q7w.png" /></figure><p><strong>TASK: Waste Images Classification</strong></p><p>The dataset contains images of waste i.e Organic &amp; Recyclable objects.</p><p>Dataset is taken from Kaggle : [<a href="https://www.kaggle.com/datasets/techsash/waste-classification-data">Dataset link</a>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*Rs_3_qKh8haXi_zXwhBs_A.png" /></figure><p>Dataset is divided into train data (85%) and test data (15%)</p><p>Training data — 22564 images Test data — 2513 images</p><p>Let&#39;s try to solve this problem statement of image classification; precisely binary image classification since there are only two classes.</p><p>We can use Deep learning to solve binary image classification problems.</p><p>Specifically, we can use Convolutional Neural Network (CNN)s to solve it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*94UtGUXQ075wmBbuOSurKQ.png" /><figcaption>The image is taken from <a href="http://introtodeeplearning.com/slides/6S191_MIT_DeepLearning_L3.pdf">http://introtodeeplearning.com/slides/6S191_MIT_DeepLearning_L3.pdf</a></figcaption></figure><p>If you don&#39;t know what is Deep learning or CNNS in general, you can refer to this video:<a href="https://www.youtube.com/watch?v=uapdILWYTzE"> [link]</a> &amp; we will build a CNN using <a href="https://www.tensorflow.org/">Tensorflow</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*9LqO7_9CNKYWEo93Ea9KYQ.png" /></figure><p>Tensorflow: An end-to-end open source machine learning platform</p><p>Step:1- Load dependencies &amp; Explore the directories</p><pre>import numpy as np <br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import matplotlib.image as mpimg<br>import os<br>for dir_path, dir_names, filenames <strong>in</strong> os.walk(&quot;../input/waste-classification-data/&quot;):<br>    print(f&quot;There are <strong>{</strong>len(dir_names)<strong>}</strong> directories &amp; <strong>{</strong>len(filenames)<strong>}</strong> images in the <strong>{</strong>dir_path<strong>}</strong> directory&quot;)</pre><p>Step:2- Explore the data in depth</p><pre><em># class_names</em><br>import pathlib<br>train_dir = r&quot;../input/waste-classification-data/dataset/DATASET/TRAIN/&quot;<br>test_dir = r&quot;../input/waste-classification-data/dataset/DATASET/TEST/&quot;<br>train_path = pathlib.Path(train_dir)<br>class_names = np.array(sorted([item.name for item <strong>in</strong> train_path.glob(&quot;*&quot;)]))<br>class_names</pre><pre>array([&#39;O&#39;, &#39;R&#39;], dtype=&#39;&lt;U1&#39;)</pre><p>Here ‘O’: Represents the Organic Class &amp; ‘R’: Represents the Recyclable Objects Class</p><pre><em># Create a function to view the images from train &amp; test directories</em><br>import random<br>def view_random_image(target_dir,target_class):<br>    <em># set the path</em><br>    target_folder = target_dir+&quot;/&quot;+target_class<br>    <em># get a random image </em><br>    random_img = random.sample(os.listdir(target_folder), 1)<br>    print(random_img)<br>    <br>    <em># plot the image using matplotlib</em><br>    img = mpimg.imread(target_folder + &quot;/&quot; + random_img[0])<br>    plt.imshow(img)<br>    plt.title(f&quot;<strong>{</strong>target_class<strong>}</strong>&quot;)<br>    plt.axis(&quot;off&quot;);<br>    print(f&quot;Image shape : <strong>{</strong>img.shape<strong>}</strong>&quot;)</pre><pre>img = view_random_image(target_dir=train_dir,target_class=&quot;O&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*qzVO4LSPiC2rAQptU2vL1Q.png" /><figcaption>The output of the above function</figcaption></figure><pre>img = view_random_image(target_dir=train_dir,target_class=&quot;R&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*PqPcACbncfaOnjx8QDKxlA.png" /><figcaption>The output of the above function</figcaption></figure><p>Step:3- let&#39;s build an End to End CNN with the following steps:</p><blockquote>Load the data</blockquote><blockquote>Create Dataloaders &amp; mini batches</blockquote><blockquote>Create/Build a CNN</blockquote><blockquote>Evaluate</blockquote><blockquote>Repeat untill satisfied</blockquote><pre>import tensorflow as tf<br>from tensorflow.keras.preprocessing.image import ImageDataGenerator</pre><blockquote><a href="https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator">ImageDataGenerator</a>: Generate batches of tensor image data with real-time data augmentation.</blockquote><pre>train_data_gen = ImageDataGenerator(rescale=1./255)<br>test_data_gen = ImageDataGenerator(rescale=1./255)</pre><blockquote>rescaling factor. Defaults to None. If None or 0, no rescaling is applied, otherwise we multiply the data by the value provided (after applying all other transformations).</blockquote><pre>train_data = train_data_gen.flow_from_directory(directory=train_dir,<br>                                             target_size=(224, 224),<br>                                             batch_size=32,<br>                                             class_mode=&quot;binary&quot;)<br><br>test_data = train_data_gen.flow_from_directory(directory=test_dir,<br>                                             target_size=(224,224),<br>                                             batch_size=32,<br>                                             class_mode=&quot;binary&quot;)</pre><blockquote>directorystring, path to the target directory. It should contain one subdirectory per class. Any PNG, JPG, BMP, PPM or TIF images inside each of the subdirectories directory tree will be included in the generator.</blockquote><blockquote>target_sizeTuple of integers (height, width), defaults to (256,256). The dimensions to which all images found will be resized. In our example we have taken it to be (224,224)</blockquote><blockquote>class_modeOne of &quot;categorical&quot;, &quot;binary&quot;, &quot;sparse&quot;, &quot;input&quot;, or None. Default: &quot;categorical&quot;. In our example we have taken it to be : “binary”</blockquote><blockquote>batch_sizeSize of the batches of data (default: 32).</blockquote><pre>Found 22564 images belonging to 2 classes.<br>Found 2513 images belonging to 2 classes.</pre><pre>from tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2D<br>from tensorflow.keras import Sequential<br>from tensorflow.keras.activations import relu,sigmoid, softmax<br>from tensorflow.keras.optimizers import Adam, SGD</pre><pre>model_1 = tf.keras.Sequential([<br>    Conv2D(10, 3, input_shape=(224,224,3), activation=&quot;relu&quot;),<br>    MaxPool2D(2),<br>    Conv2D(10, 3, activation=&quot;relu&quot;),<br>    MaxPool2D(2),<br>    Flatten(),<br>    Dense(1, activation=&quot;sigmoid&quot;)<br>])<br><br>model_1.compile(loss=&quot;binary_crossentropy&quot;,<br>               optimizer=Adam(),<br>               metrics=[&quot;accuracy&quot;])<br><br>history_1 = model_1.fit(train_data,<br>                       epochs=5,<br>                       steps_per_epoch=len(train_data),<br>                       validation_data=test_data,<br>                       validation_steps = len(test_data))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*9Hp9nq9itLiah_5QGoqMBQ.png" /><figcaption>The image is taken from <a href="http://introtodeeplearning.com/slides/6S191_MIT_DeepLearning_L3.pdf">http://introtodeeplearning.com/slides/6S191_MIT_DeepLearning_L3.pdf</a></figcaption></figure><pre>model_1.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*aMxuAfyFtZf-j7nF1-OIFw.png" /></figure><pre>model_1.evaluate(test_data)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*alGu_uD0jbsQnx0pxEe13g.png" /></figure><pre><em># plot accuracy &amp; loss curves</em><br>def plot_loss_curves(history):<br>    <em># get loss</em><br>    loss = history.history[&quot;loss&quot;]<br>    val_loss = history.history[&quot;val_loss&quot;]<br>    <em># get accuracy</em><br>    accuracy = history.history[&quot;accuracy&quot;]<br>    val_accuracy = history.history[&quot;val_accuracy&quot;]<br>    <br>    <em># epochs</em><br>    epochs =range(len(history.history[&quot;loss&quot;]))<br>    <em># plot loss</em><br>    plt.plot(epochs, loss, label=&quot;Training Loss&quot;)<br>    plt.plot(epochs, val_loss, label=&quot;Val Loss&quot;)<br>    plt.title(&quot;Loss Curves&quot;)<br>    plt.xlabel(&quot;Epcohs&quot;)<br>    plt.legend()<br>    <br>    <em># plot accuracy</em><br>    plt.figure()<br>    plt.plot(epochs, accuracy, label=&quot;Training Accuracy&quot;)<br>    plt.plot(epochs, val_accuracy, label=&quot;Val Accuracy&quot;)<br>    plt.title(&quot;Accuracy Curves&quot;)<br>    plt.xlabel(&quot;Epochs&quot;)<br>    plt.legend();<br></pre><pre>plot_loss_curves(history_1)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*1dOxyeFO0zJ-haP_U8JNog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*WHPDKsUs9g0MfBlfuVzTDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*_sQtehs4VS3ILK_VT2o9mg.png" /></figure><h3>Let us Build a Simple CNN/Tiny VGG Model: 2</h3><pre>model_2 = Sequential([<br>    Conv2D(10, 3, input_shape=(224, 224, 3), activation=&quot;relu&quot;),<br>    Conv2D(10, 3, activation=&quot;relu&quot;),<br>    MaxPool2D(2),<br>    Conv2D(10, 3, activation=&quot;relu&quot;),<br>    Conv2D(10, 3, activation=&quot;relu&quot;),<br>    MaxPool2D(2),<br>    Flatten(),<br>    Dense(1, activation=&quot;sigmoid&quot;)<br>])<br><br>model_2.compile(loss=&quot;binary_crossentropy&quot;,<br>               optimizer=tf.keras.optimizers.Adam(),<br>               metrics=[&quot;accuracy&quot;])<br><br>history_2 = model_2.fit(train_data,<br>                       epochs=5,<br>                       steps_per_epoch = len(train_data),<br>                       validation_data=test_data,<br>                       validation_steps=len(test_data))</pre><pre>model_2.evaluate(test_data)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*5GPk-FyNhq_zgBIEFRpsog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*1d9QjdoBBWNuoZOXnXqVoA.png" /></figure><p>This is enough to get started with CNN and then perform a series of experiments until the desired performance metrics are met.</p><p>To get more improvements we can try to train :</p><blockquote>More epochs</blockquote><blockquote>With data augmentations</blockquote><blockquote>With more layers</blockquote><blockquote>With more neurons</blockquote><blockquote>With different activation functions</blockquote><p>We are able to get good results with just 2 simple CNN models and with just 5 epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*NpQ7s5WX-O2RSjoKs7RD0A.png" /></figure><p><strong>References:</strong></p><ul><li><a href="https://www.tensorflow.org/">TensorFlow</a></li><li><a href="http://introtodeeplearning.com/">MIT Deep Learning 6.S191</a></li></ul><p><a href="https://www.udemy.com/course/tensorflow-developer-certificate-machine-learning-zero-to-mastery/">https://www.udemy.com/course/tensorflow-developer-certificate-machine-learning-zero-to-mastery/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dca408a0c0b" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/%EF%B8%8Fwaste-classification-by-building-convolutional-neural-network-cnn-using-tensorflow-%EF%B8%8F-8dca408a0c0b">♻️Waste Classification by Building Convolutional Neural Network (CNN) using TensorFlow ♻️</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Curious Case of Imputation]]></title>
            <link>https://medium.com/analytics-vidhya/the-curious-case-of-imputation-a1edb7d5bc44?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1edb7d5bc44</guid>
            <category><![CDATA[imputation]]></category>
            <category><![CDATA[data-pre-processing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Sat, 22 Jan 2022 12:58:10 GMT</pubDate>
            <atom:updated>2022-02-25T16:31:57.294Z</atom:updated>
            <content:encoded><![CDATA[<p>How to handle missing values?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*II_2B8RcrHgMhYlG-6erOQ.jpeg" /><figcaption>How to handle the missing values in the right way(s)?</figcaption></figure><blockquote>In statistics,<strong> imputation</strong> is the process of replacing missing data with substituted values</blockquote><p>Suppose you are working on a project where your task is to do some data analysis or some cool data science stuff and you want to impress everyone around you that “ how awesome your data skills &amp; insights are ”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*IM5KIEzVKFPwabzfNgeJYA.jpeg" /></figure><p>Now by some means data is there on your system for sake of simplicity lets say it’s an Excel/CSV dataset, you open the dataset and start looking into the data to prove your points about your awesome data skills only to find that some of the data is missing……….!!!</p><blockquote>Interesting, what do I do now? And how can data be missing ? Who is to be blamed? How to handle these missing values? Delete them all? Fill them up but with what ? Are my data skills lowering done so soon…..? Think….think….?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*8yGYTIUApw86PDzvGjPVBQ.jpeg" /></figure><blockquote>Okay, first of all, data can be missing due to the following reasons:</blockquote><ol><li>Data must have got corrupted or changed.</li><li>Human errors</li><li>Technology/gadget errors</li><li>No data was found while data collection, etc</li></ol><blockquote>Now that I know that data can be missing and some of the reasons behind it, <strong>how do I check for the missing value data?</strong></blockquote><p>In Python, NA/ NaN stands for Not A Number and is one of the common ways to represent the missing value in the data.</p><p>If the values are NA. NA values, such as None or np.NaN, get mapped to True values. Everything else gets mapped to False values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*sdWQSYIvkmm-4sJzywepSg.png" /></figure><pre>example.isna()</pre><pre>0    False<br>1    False<br>2     True<br>dtype: bool</pre><blockquote>Also, <strong>pd.DataFrame.isna</strong> &lt; — Detect missing values</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o6UBoAAOhNLZuw8GQ%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o6UBoAAOhNLZuw8GQ%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3o6UBoAAOhNLZuw8GQ%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="229" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fa4a5cba11411085808cc257dd198c8/href">https://medium.com/media/0fa4a5cba11411085808cc257dd198c8/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlPY5d1vUYBreWtF1I0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FlPY5d1vUYBreWtF1I0%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FlPY5d1vUYBreWtF1I0%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f9f6282dcbe9234fe20ddd5817e3db6/href">https://medium.com/media/1f9f6282dcbe9234fe20ddd5817e3db6/href</a></iframe><p>Enough of talks lets get our hands dirty, by taking an dataset and exploring it right away.</p><h3>Problem Description : # House Prices — Advanced Regression Techniques</h3><p>* Predict sales prices and practice feature engineering, RFs, and gradient boosting</p><p>* Ask a home buyer to describe their dream house, and they probably won’t begin with the height of the basement ceiling or the proximity to an east-west railroad. But this playground competition’s dataset proves that much more influences price negotiations than the number of bedrooms or a white-picket fence.</p><p>* With 79 explanatory variables describing (almost) every aspect of residential homes in Ames, Iowa, this competition challenges you to predict the final price of each home.</p><p>Dataset link : <a href="https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data">https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data</a></p><p>Load the libraries &amp; dataset</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*X3Tb7AIcdwvVRSBlV9elbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*OprYCWd-XtUT7DhPGm2csA.png" /></figure><h3>Check if there are any missing values in columns</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aj0dk88yPGl3QvPUgMJ3xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*lpwq2a6lxfRF8K8y_BHTaw.png" /></figure><p>Also, 2nd way to identify the missing values is :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7966R_hWWQNv54GN3efYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*8ao7RbnfSzr6BJY5SrMJVg.jpeg" /></figure><p>Most libraries (including scikit-learn) will give you an error if you try to build a model using data with missing values. So you’ll need to choose one of the strategies below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rIqnU70HTxow_n3-4oPCwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*HHCNjRgvANimfvMTJuhjIA.gif" /></figure><h4>1- Drop Columns with Missing Values</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kc0ugiz1D0rHMsnQW_ibNQ.png" /></figure><h3>Pros:</h3><p>Easy to implement</p><h3>Cons:</h3><p>Data is lost. Which is never good choice in Data Science. Its all about improving the data and having insights about the data.</p><p>If those columns had useful information (in the places that were not missing), your model loses access to this information when the column is dropped</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*5CZePZHNIW_g75MPuGGskQ.jpeg" /></figure><h4>2- Imputation using some fixed values eg: “0”, “1”, “-1”, “NA”, “Undefined”, etc</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ine6MoqnZxLK2qR922qDYw.png" /></figure><h4>Pros:</h4><p>Easy to implement</p><h4>Cons:</h4><p>Domain Knowledge is required if you want to fill missing values with an value. Can make the distribution goes for a toss. i.e can mess it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*DD7jyiXdg4439360ObmW3Q.gif" /></figure><h4>3- Imputation using strategy: “mean”, “median”, “most-frequent”(mode)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPkWaWlSH56lAQhvemSgoQ.png" /></figure><h4>Pros:</h4><p>Easy to implement with scikit-learn. Depending on your use case , mostly used strategies are readily available.</p><h4>Cons:</h4><p>If you require more techniques to suit your use-case.</p><h4>4- Random/ Arbitrary Imputation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0VETFAD98jw3WXangzHQ_A.png" /></figure><h4>Pros:</h4><p>Easy to implement with scikit-learn. Depending on your use case , mostly used strategies are readily available.</p><h4>Cons:</h4><p>It can do horrible things to the variable distribution, as it changes the mean, variance, and covariance.</p><h4>5- Adding a variable to capture missing values</h4><p><strong>add_indicator </strong><em>bool, default=False</em></p><p>If True, a <a href="https://scikit-learn.org/stable/modules/generated/sklearn.impute.MissingIndicator.html#sklearn.impute.MissingIndicator"><strong>MissingIndicator</strong></a> transform will stack onto output of the imputer’s transform. This allows a predictive estimator to account for missingness despite imputation. If a feature has no missing values at fit/train time, the feature won’t appear on the missing indicator even if there are missing values at transform/test time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-maK001MkEtLmawyLiwidg.png" /></figure><h4>6- Imputation using Model eg: KNN</h4><p>Imputation for completing missing values using k-Nearest Neighbors.</p><p>Each sample’s missing values are imputed using the mean value from n_neighbors nearest neighbors found in the training set. Two samples are close if the features that neither is missing are close.</p><p><strong>n_neighbors </strong><em>int, default=5</em></p><p>Number of neighboring samples to use for imputation.</p><p><strong>weights</strong><em>{‘uniform’, ‘distance’} or callable, default=’uniform’</em></p><p>Weight function used in prediction. Possible values:</p><ul><li>‘uniform’ : uniform weights. All points in each neighborhood are weighted equally.</li><li>‘distance’ : weight points by the inverse of their distance. in this case, closer neighbors of a query point will have a greater influence than neighbors which are further away.</li><li>callable : a user-defined function which accepts an array of distances, and returns an array of the same shape containing the weights.</li></ul><p><strong>metric</strong><em>{‘nan_euclidean’} or callable, default=’nan_euclidean’</em></p><p>Distance metric for searching neighbors. Possible values:</p><ul><li>‘nan_euclidean’</li><li>callable : a user-defined function which conforms to the definition of _pairwise_callable(X, Y, metric, **kwds). The function accepts two arrays, X and Y, and a missing_values keyword in kwds and returns a scalar distance value.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*RYOmp3SaLS1RnODYIfhx6Q.png" /></figure><h4>7- End of Distribution Imputer</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_i5AI2gzd0k0v7jOS5Inkw.png" /></figure><h4>8- Class Based Imputation</h4><p>Lets say you are solving an binary classification task, which are positive and negative class.</p><p>So you can take mean of positive class i.e mean_pos_class and mean of negative class i.e mean_neg_class and use this variable to fill missing values instead of simple mean , median , mode or constant values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*m8NS2AcL1X4mEpbmimOWOA.gif" /></figure><h3>Conclusion:</h3><p>No strategy works all the time, so just code experiment &amp; experiment more.</p><p>Depending on your use case and data distribution and business needs try out different strategies and use what fits your needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*pNC5WmgoqdLeBUBWZI-iyA.gif" /></figure><blockquote><strong><em>References:</em></strong></blockquote><blockquote><a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isna.html">https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isna.html</a></blockquote><blockquote><a href="https://scikit-learn.org/stable/modules/generated/sklearn.impute.KNNImputer.html?highlight=imputer%20knn#sklearn.impute.KNNImputer">https://scikit-learn.org/stable/modules/generated/sklearn.impute.KNNImputer.html?highlight=imputer%20knn#sklearn.impute.KNNImputer</a></blockquote><blockquote><a href="https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html#sklearn.impute.SimpleImputer">https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html#sklearn.impute.SimpleImputer</a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FwuaxMsig0ZtRu%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FwuaxMsig0ZtRu%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FwuaxMsig0ZtRu%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="242" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea43252a9f70b5a4dc9e24e50046de7f/href">https://medium.com/media/ea43252a9f70b5a4dc9e24e50046de7f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1edb7d5bc44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/the-curious-case-of-imputation-a1edb7d5bc44">The Curious Case of Imputation</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developer’s Essential: JSON]]></title>
            <link>https://medium.com/analytics-vidhya/developers-essentials-json-7e94d5822cc?source=rss-65f08d91efde------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e94d5822cc</guid>
            <category><![CDATA[parse]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[js]]></category>
            <dc:creator><![CDATA[Rohan Rangari]]></dc:creator>
            <pubDate>Mon, 28 Jun 2021 15:32:19 GMT</pubDate>
            <atom:updated>2021-07-12T06:38:10.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*aED5wDp1mm1MT_dldrJcqA.png" /></figure><h3>What is JSON?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*e56CDFZdB9cnorJDaIqb0Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rl_tcQdDi2ksGueU9CWk2w.jpeg" /></figure><blockquote>JSON stands for <strong>JavaScript Object Notation.</strong></blockquote><blockquote>It is a lightweight data-interchange format.</blockquote><blockquote>It is easy for humans to read and write.</blockquote><blockquote>Commonly used for APIs and Configs</blockquote><blockquote>It is a very common data format, with a diverse range of applications, one example being web applications that communicate with a server.</blockquote><blockquote>JSON is a language-independent data format.</blockquote><blockquote>It was derived from JavaScript, but many modern programming languages include code to generate and parse JSON-format data.</blockquote><blockquote>JSON file names use the extension .json</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*KWd3vMgQAM5wCC2iKY9OWg.gif" /></figure><h3>JSON is built on two structures:</h3><blockquote>A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.</blockquote><blockquote>An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.</blockquote><blockquote>These are universal data structures. Virtually all modern programming languages support them in one form or another.</blockquote><blockquote>It makes sense that a data format that is interchangeable with programming languages also be based on these structures.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1VN0ZygvUhnp8UvUCy5pDg.jpeg" /></figure><h3><strong>In JSON, they take on these forms:</strong></h3><blockquote>An object is an unordered set of name/value pairs.</blockquote><blockquote>An object begins with {left brace and ends with }right brace.</blockquote><blockquote>Each name is followed by :colon and the name/value pairs are separated by ,comma.</blockquote><h3><strong>JSON Data Types allowed are:</strong></h3><blockquote>String</blockquote><blockquote>Number</blockquote><blockquote>Boolean</blockquote><blockquote>Array</blockquote><blockquote>Null</blockquote><blockquote>Object i.e. Key: value pairs</blockquote><h3>QUICK TIP:</h3><blockquote>Valid JSON needs “double-quotes” only. ‘Single-quotes’ gives errors.</blockquote><blockquote>Trailing commas in the end are not allowed, giving errors.</blockquote><blockquote>Comments are not allowed</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*DsF50swlrtzou2fTWtQk7g.jpeg" /></figure><h3>Example-1: Creds.json:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xad101BqxzRs9K7r" /></figure><h4>DATA TYPES USED :</h4><blockquote>{</blockquote><blockquote>“name”: “admin”, // String</blockquote><blockquote>“dataGbs”: 11.45, // Number</blockquote><blockquote>“isActive”: true, // Boolean</blockquote><blockquote>“license”: null, //Null</blockquote><blockquote>“Languages”:[“python”,”java”,”c”], //Array</blockquote><blockquote>“dbCreds”:{ // Object</blockquote><blockquote>“user”:”root”,</blockquote><blockquote>“password”:”root@12345&quot;,</blockquote><blockquote>“dbName”:”MySQL”,</blockquote><blockquote>“urls”:[ “localhost:1”, “localhost:2”, “localhost:3”, {“default”:”0.0.0.0&quot;}]</blockquote><blockquote>// Array in object // Nesting//</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><h3>Example-2:Array-json</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*hgw7OLSvByeJManG" /></figure><h3>JSON Parsing in Python3</h3><ul><li>Code for Parsing //creds.json</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*INR-gWSZvZio5xw8" /></figure><h3>Output of the above code snippet:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IOkFALvNatF0Cd-Y" /></figure><h3>Code for Parsing arrays.json:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*ziT0dn1InG02xs4D" /></figure><h3>Output of the above code snippet:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eBoBy_W3v46YMTy3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*SpsUaZNXbRD4YCwyvxBPsA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZyNY7cjQnpIIa_bOkACAvQ.jpeg" /></figure><blockquote>If you have any suggestions, please comment.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*syVc-xI95sDX3wNbEsvqCA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e94d5822cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/developers-essentials-json-7e94d5822cc">Developer’s Essential: JSON</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>