<?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 Prakhar Gurawa on Medium]]></title>
        <description><![CDATA[Stories by Prakhar Gurawa on Medium]]></description>
        <link>https://medium.com/@prakhargurawa?source=rss-c0cd22ec9144------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*v-zEAeJlHuEePCRHuN1EGg.jpeg</url>
            <title>Stories by Prakhar Gurawa on Medium</title>
            <link>https://medium.com/@prakhargurawa?source=rss-c0cd22ec9144------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 14:47:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prakhargurawa/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[Introduction to CodeLlama: Revolutionizing Programming with AI-Powered Code Generation]]></title>
            <link>https://prakhargurawa.medium.com/introduction-to-codellama-revolutionizing-programming-with-ai-powered-code-generation-426fa7bbcfbf?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/426fa7bbcfbf</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[meta]]></category>
            <category><![CDATA[code-llama]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 13:29:30 GMT</pubDate>
            <atom:updated>2024-08-23T13:29:30.454Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t_E2n1EqEn2NVPTn" /><figcaption>Photo by <a href="https://unsplash.com/@santesson89?utm_source=medium&amp;utm_medium=referral">Andrea De Santis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>CodeLlama, built on top of Llama 2, is designed specifically for coding tasks. It comes in three variants: Code Llama, Code Llama Python, and Code Llama Instruct. This specialized model extends the capabilities of Llama 2 by further training on code-specific datasets, making it adept at generating and analyzing code. CodeLlama is developed by Meta. It is designed to facilitate both the generation and discussion of code using prompts. By leveraging the robust capabilities of Llama 2, CodeLlama enables developers to efficiently generate code and engage in meaningful code-related conversations.</p><h4><strong>Variants of CodeLlama: Tailored for Specific Coding Needs</strong></h4><p>CodeLlama is available in three main variants, each designed to address different coding tasks, and all are released in four sizes (7B, 13B, 34B, and 70B parameters):</p><ol><li><strong>Code Llama:</strong> The foundational model optimized for general code generation tasks across various programming languages.</li><li><strong>Code Llama — Python:</strong> A specialized variant fine-tuned specifically for Python programming, offering enhanced performance in Python-related tasks.</li><li><strong>Code Llama — Instruct:</strong> This variant is fine-tuned with human instructions and self-instructed code synthesis data, making it ideal for tasks that require following detailed instructions and providing high-quality code synthesis.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*A-uRl02fKuCmzcyOjGz25Q.png" /></figure><h4>CodeLlama Models: An Overview</h4><p>Code Llama: The foundational model for general code generation, available in four sizes (7B, 13B, 34B, and 70B parameters). The 7B, 13B, and 70B models are trained with an infilling objective, making them suitable for tasks like completing code in the middle of a file. The 34B model, however, is trained without this infilling capability.</p><p>Code Llama — Python: Specialized for Python, this variant is available in the same four sizes (7B, 13B, 34B, and 70B). It is trained with a Python-heavy dataset, offering superior performance for Python-related tasks compared to general-purpose models.</p><p>Code Llama — Instruct: Designed to better follow human instructions, this variant is available in 7B, 13B, and 34B sizes. It is fine-tuned with additional tokens to enhance its ability to respond accurately to detailed prompts.</p><p>Code Llama 70B: The largest model in the family, Code Llama 70B is trained on 1 trillion tokens, double the amount used for the smaller models. It includes fill-in-the-middle (FIM) capability, making it highly effective for complex coding tasks. The Code Llama — Instruct 70B variant, based on the Python model, outperforms the base model in many coding challenges.</p><p>Below is a sample code generated by CodeLlama, although it is capable of generating much complex codes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*fFzGGj0wvYbuEXmcLKypzw.png" /></figure><h4>Applications of Code Llama</h4><ol><li>CodeLlama can handle a wide range of tasks, from generating code and providing natural language descriptions of code to code completion and debugging. It supports popular programming languages, including Python, C++, Java, PHP, Typescript (Javascript), C#, and Bash.</li><li>Codellama can be used to generate, convert, comment, debug and optimize code.</li><li>These models come equipped with fill-in-the-middle (FIM) capability, allowing them to insert code into existing codebases seamlessly, supporting tasks like code completion out of the box. Depending on your requirements, you can choose the model that best fits your needs: the smaller 7B and 13B models offer low latency and are ideal for real-time tasks, while the larger 34B and 70B models provide superior coding assistance but require more computational resources.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=426fa7bbcfbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Enterprise Insights: ChatGPT Meets Enterprise data with Azure OpenAI and Cognitive…]]></title>
            <link>https://prakhargurawa.medium.com/supercharge-your-enterprise-insights-chatgpt-meets-enterprise-data-with-azure-openai-and-cognitive-56bca5b705ea?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/56bca5b705ea</guid>
            <category><![CDATA[gpt-3]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[application]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Sun, 03 Sep 2023 10:33:48 GMT</pubDate>
            <atom:updated>2023-09-03T10:41:34.952Z</atom:updated>
            <content:encoded><![CDATA[<h3>Supercharge Your Enterprise Insights: ChatGPT Meets Enterprise data with Azure OpenAI and Cognitive Search</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*40VKuROrt50zIVAL" /><figcaption>Photo by <a href="https://unsplash.com/@jupp?utm_source=medium&amp;utm_medium=referral">Jonathan Kemper</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is Azure Search OpenAI Demo?</h4><p>The Azure Search OpenAI Demo is an open-source project that demonstrates the integration of Azure Search with OpenAI’s GPT-3. This powerful combination allows you to build intelligent search applications that can understand and respond to natural language queries. The repo can be found here : <a href="https://github.com/Azure-Samples/azure-search-openai-demo">https://github.com/Azure-Samples/azure-search-openai-demo</a></p><p>This demonstration showcases various methods to replicate ChatGPT-like interactions using your own data through the Retrieval Augmented Generation approach. It leverages the Azure OpenAI Service to tap into the ChatGPT model (<strong>gpt-3.5-turbo</strong>) and utilizes Azure Cognitive Search for efficient data indexing and retrieval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*NYNpLPrOKqSY-nOtMNL0eg.png" /></figure><h4>Exploring the Features</h4><p>The Azure Search OpenAI Demo comes with a set of impressive features:</p><ul><li><strong>Natural Language Querying</strong><br>Users can input natural language queries, and the demo leverages OpenAI’s GPT-3 to understand and process these queries effectively.</li><li><strong>Real-Time Results</strong><br>The demo provides real-time search results, making it incredibly responsive to user queries.</li><li><strong>Rich Content</strong><br>Search results can include a variety of content types, such as documents, images, and more.</li><li><strong>Easy Customization</strong><br>You can customize the demo to suit your specific use case by modifying the configuration and interface.</li><li><strong>Scalability</strong><br>Azure Search is designed to scale effortlessly, ensuring that your search application can handle increasing loads as your user base grows.</li></ul><h4>Azure Resources Utilized</h4><p>The implementation relies on several essential Azure resources, each serving a specific purpose:</p><ul><li><strong>Azure App Service:</strong> Azure App Service is a robust Platform as a Service (PaaS) offering by Microsoft. It serves as an ideal hosting environment for web applications, REST APIs, and backend services for mobile applications.</li><li><strong>Azure OpenAI Service:</strong> Azure OpenAI Service grants convenient REST API access to OpenAI’s cutting-edge language models, including the likes of GPT-4, GPT-35-Turbo, and the Embeddings model series. By utilizing Azure OpenAI, users benefit from the security features of Microsoft Azure while harnessing the formidable capabilities of OpenAI. This service offers advantages such as private networking, regional availability, and responsible AI content filtering.</li><li><strong>Azure Form Recognizer:</strong> Intelligent Document Processing (IDP) is a transformative technology that leverages artificial intelligence (AI) and machine learning (ML) to automatically extract valuable information from unstructured documents, including invoices, receipts, and various forms.</li><li><strong>Azure Cognitive Search:</strong> Formerly known as “Azure Search,” Azure Cognitive Search is a dynamic cloud search service that equips developers with the necessary infrastructure, APIs, and tools to craft rich search experiences across a wide array of private, heterogeneous content in web, mobile, and enterprise applications.</li><li><strong>Azure Blob Storage:</strong> Azure Blob Storage plays a pivotal role in creating data lakes tailored for your analytics requirements. It offers efficient storage solutions for constructing powerful cloud-native and mobile applications. With features like tiered storage for long-term data management and scalable capabilities for high-performance computing and machine learning workloads, it proves to be an indispensable component of your Azure ecosystem.</li></ul><h4>Use Cases</h4><p>The possibilities with the Azure Search OpenAI Demo are vast. Here are some use cases where it can shine:</p><ul><li><strong>E-commerce:</strong> Enhance your e-commerce platform with advanced product search capabilities.</li><li><strong>Customer Support:</strong> Create a chatbot that can understand and respond to customer inquiries more naturally.</li><li><strong>Content Discovery:</strong> Build a content discovery platform that helps users find relevant articles, videos, and more.</li><li><strong>Knowledge Management:</strong> Implement a knowledge base search to quickly locate internal documents and information.</li></ul><h4>Conclusion</h4><p>The Azure Search OpenAI Demo combines the capabilities of Azure Search and OpenAI’s GPT-3 to create intelligent search applications that understand natural language. Whether you’re building an e-commerce platform, customer support system, or knowledge management solution, this integration can revolutionize the way users interact with your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0lKvRGMNCwnLFaRr" /><figcaption>Photo by <a href="https://unsplash.com/@maria_shalabaieva?utm_source=medium&amp;utm_medium=referral">Mariia Shalabaieva</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56bca5b705ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Illusions: A Journey to Clarity]]></title>
            <link>https://prakhargurawa.medium.com/beyond-illusions-a-journey-to-clarity-38cf7a388e86?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/38cf7a388e86</guid>
            <category><![CDATA[short-story]]></category>
            <category><![CDATA[imagination]]></category>
            <category><![CDATA[fiction]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Wed, 17 May 2023 23:25:29 GMT</pubDate>
            <atom:updated>2023-05-17T23:25:29.217Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*wLu9wBxW2lwN_9cnf0VQWw.jpeg" /></figure><p>It was an early morning, and the doorbell rang continuously, disturbing the tranquility of the three friends’ flat. No one stirred inside the three-bedroom apartment. Moh, one of the flatmates who was rudely awakened by the persistent ringing, became increasingly frustrated as his companions failed to respond. Determined to put an end to the disturbance, Moh reluctantly made his way to the front door.</p><p>As Moh swung open the door, his irritation peaked. Two delegates, dressed in formal black suits, stood before him. Perplexed, Moh questioned their incessant ringing. One of the men calmly explained that they were from a credit card company and had come to seize his belongings as he had failed to repay a credited amount. Moh was taken aback, asserting that he had received no prior notice regarding this matter. The delegates claimed to have sent multiple notices, none of which had received any response.</p><p>Without warning, the delegates forcefully entered Moh’s home, barging into his room. Shocked and fearful, Moh followed closely behind, desperate to stop them. However, his attempts proved futile. Helplessly, he called out to his flatmates, their names echoing through the apartment. They rushed to his room, bewildered by Moh’s distress.</p><p>Moh passionately explained the delegates’ intrusion, pleading for their assistance. In response, his flatmates were puzzled, assuring him that there was no one in the room and his belongings remained untouched. Moh’s heart sank as he watched the delegates continue to pack his belongings, invisible to his friends’ eyes. Doubt crept into his mind, questioning his sanity. Was he experiencing hallucinations? Was there something wrong with his brain?</p><p>He knew he needed to visit a psychiatrist to address his apparent brain abnormality. The following day, Moh sought solace in the company of his close friend, Maya, at a peaceful park. Sitting on a bench near a serene lake, Moh confided in Maya, recounting his experiences and fears of perceiving delegates who didn’t exist. Maya listened attentively, recognizing the gravity of the situation. She comforted him, suggesting they visit a psychiatrist together, but first, she proposed a different approach.</p><p>Maya advised Moh to interact more frequently with others and surround himself with people. She believed that living alone in his current apartment might be exacerbating his hallucinations. Encouraging him to seek a fresh start, she proposed that Moh move to a new house and share it with flatmates, offering him a chance to experience a supportive environment.</p><p>Written by : Prakhar Gurawa</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38cf7a388e86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An introduction to Autoencoders for Beginners]]></title>
            <link>https://prakhargurawa.medium.com/an-introduction-to-autoencoders-for-beginners-d8ddbeb91496?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8ddbeb91496</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 20:34:50 GMT</pubDate>
            <atom:updated>2022-07-29T20:34:50.005Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Autoencoders are unstructured learning models that utilize the power of neural networks to perform the task of representation learning. In the context of machine learning, representation learning means embedding the components and features of original data in some low-dimensional structure for better understanding, visualizing, and extraction of meaningful information. These low dimensional vectors can help us gain amazing information about our data such as how close two instances of the dataset are, finding structure and patterns in the dataset, etc.</p><h3>Table of contents</h3><ol><li>Current scenario of the industry</li><li>Learning with unlabelled data</li><li>Introduction to Autoencoders</li><li>History of Autoencoders in papers</li><li>Introduction to Variational Autoencoders</li><li>VAE Varients</li><li>Application of Autoencoders</li><li>Conclusion</li></ol><h3>Current scenario of the industry</h3><p>In this big-data era, where petabytes of data are generated and processed by leading social networking sites and e-commerce giants, we are living in a world of data abundance. Our machine learning algorithms have only mainly exploited labeled datasets which are rare and costly. Most of the data generated are unstructured and unlabelled, so it is high time our machine learning community should focus on unsupervised learning algorithms and not just the supervised ones to unlock the true potential of AI and machine learning.</p><blockquote><em>“If intelligence was a cake, unsupervised learning would be the cake, supervised learning would be the icing on the cake, and reinforcement learning would be the cherry on the cake” — Yann LeCunn</em></blockquote><p>So why not eat the whole cake?</p><h3>Learning with unlabelled data</h3><p>A representation of data is really a mapping. If we have a data point x ∈ X, and we have a function f: X → Z for some data space Z, then f is a representation. The new point f(x) = z ∈ Z is sometimes called a representation of x. A good representation makes downstream tasks easier.</p><h3>Introduction to Autoencoders</h3><p>Autoencoders also known as self-encoders are networks that are trained to reproduce their own inputs. They come under the category of unsupervised learning algorithms, in fact, some researchers suggest autoencoders as self-supervised algorithms for a training example x, the label is x itself. But in a general sense, they are considered unsupervised as there are no classification or regression labels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*N47ZGWz0_khRVLWUkICfoA.png" /></figure><p>If an autoencoder does this perfectly, then the output vector x` is equal to the input vector x. The autoencoder is designed as a special two-part structure, the encoder, and the decoder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*gW5e-gVO4R3lUTd1A6_uIg.jpeg" /></figure><p>AE = Decoder(Encoder(x))</p><p>The model train uses the reconstruction loss which aims to minimize the difference between x and x’. We can define reconstruction loss as something like MSE(x, x’) if the inputs are a real value. The dimensionality of z is usually less than x, that’s why autoencoders are also called bottleneck neural networks. We are forcing a compressed knowledge representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*P7aFcjaMGLwzTvjW3sD-5Q.jpeg" /></figure><p>The encoder is used to map unseen data to a low dimensional Z and a good representation always focuses on the point that no important information was lost during compression. Autoencoders are just like Principle Component Analysis (PCA) which is itself a dimensionality reduction algorithm but the difference is PCA is linear in nature whereas autoencoders are non-linear in nature due to neural net-based architecture. For a better understanding of the latent space, we can use an example where the observed variable x can be something like (number of people on the beach, ice-cream sales, daily temperature) whereas the latent space z can be something like the tilt in Eath’s axis (ie. season of the year) because using the season information we can almost predict the number of visitors on the beach, ice cream sales, etc.</p><h3>History of Autoencoders in papers</h3><p>Below are research papers that are the first few to introduce AEs in the machine learning world :</p><ul><li>A learning algorithm for Boltzmann machines, DH Ackley, GEHinton, TJ Sejnowski. Cognitive science, 1985. Describes a simple neural network trained by self-supervision.</li><li>Learning representations by back-propagating errors, D. Rumelhart, Geoffrey E. Hinton, R. J. Williams. Nature, 1986. “We describe a new learning procedure, back-propagation, for networks of neuron-like units”.</li><li>Connectionist learning procedures, GE Hinton. Machine learning, 1990. Describes the “self-supervised” bottleneck neural network.</li></ul><h3>Introduction to Variational Autoencoders</h3><p>Variational Autoencoders are Autoencoders exploiting sampling technique and Kullback-Leiber Regularisation. The Variational Autoencoders aim to make the latent space smoother, i.e. a small change in x will lead to a small change in latent space z and a small change in z will lead to a small change in x. A latent space needs to be smooth with plausible points to be more effective and accurate and that is what VAE tries to achieve. In VAE, the encoder outputs not just z, but <em>mu</em> and <em>sigma</em>. After which sampling operation chooses z from these parameters and as usual decoder takes z as before.</p><p>A good sampling technique provides a good reconstruction of data points, also a good reconstruction of points near to data points. The process ensures that every point that’s close to the latent location where you encoded [the input x, ie z mean] can be decoded to something similar to [x], thus forcing the latent space to be continuously meaningful. Any two close points in the latent space will decode highly similar images. Continuity, combined with the low dimensionality of the latent space, forces every direction in the latent space to encode a meaningful axis of variation of the data, making the latent space very structured and thus highly suitable for manipulation via concept vectors. The pseudo-code for sampling is detected below :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fc51ec6ec5de4bc68dc24bc823a3f85/href">https://medium.com/media/8fc51ec6ec5de4bc68dc24bc823a3f85/href</a></iframe><p>In the VAE, we want the data to be distributed as a normal, in 𝑧-space. In particular, a standard multivariate normal, 𝑁(0,1). When using the decoder, we can be confident that all such points correspond to typical 𝑥 points. No “holes” because the encoder is working hard to compress the data, so it won’t waste space.</p><h4>Regularization</h4><blockquote>“The parameters of a VAE are trained via two loss functions: a reconstruction loss that forces the decoded samples to match the initial inputs, and a regularization loss that helps learn well-formed latent spaces and reduce overfitting to the training data.” — Chollet.</blockquote><p>The regularisation loss asks the encoder to put the data into a normal distribution in the latent space.</p><h4><strong>Kullback-Leibler divergence</strong></h4><p>The Kullback-Leibler divergence KL(𝑝||𝑞) is a statistical measure of dissimilarity between a pair of distributions, 𝑝, and 𝑞. So, it is a number that is large when 𝑝 and 𝑞 are dissimilar, and close to zero when they are similar.</p><p>The KL loss is a regularisation term in our VAE loss. As always, we can tune the regularisation by multiplying the KL by a scalar. If it is too strong our model will collapse and if too weak it will be equivalent to classic AE.</p><p><strong>Remember: VAE = AE + Sampling + KL loss</strong></p><p>1. The sampling procedure samples from a multivariate Normal 𝑁(𝜇, 𝛴) to get each point z.</p><p>2. The regularisation procedure adds a loss to push the latent distribution to be similar to a standard multivariate Normal 𝑁(0,1).</p><p>3. Usually, dim(𝑧) is usually small compared to dim(𝑥). How small? “As small as possible”, without increasing reconstruction error too. As always, it depends on the downstream task. If dim(𝑧) = 2, we can easily visualize. But this is usually too extreme: can’t reconstruct training data well. If dim(𝑧) &gt; 2, we might use 𝑡-SNE or UMAP for visualization.</p><h3>VAE variants</h3><ol><li>BetaVAE (stronger regularisation for disentangled representation).</li><li>Contractive AE (aims for smoothness with a different regularisation).</li><li>Conditional VAE (decoder maps (𝑧, 𝑐) → 𝑥, where 𝑐 is chosen, e.g. 𝑐 specifies which digit to generate and 𝑧 specifies the style</li></ol><p>Reference : <a href="https://blog.keras.io/building-autoencoders-in-keras.html">Keras Autoencoder</a></p><h3>Applications of Autoencoders</h3><ol><li>Denoising images (Conv AE)</li><li>Anomaly detection on time series (1D Conv AE)</li><li>Network intrusion detection by anomaly detection (VAE Encoder only)</li><li>Generation of video game levels and music (Conv VAE Decoder only).</li></ol><p>At last, I feel Autoencoders and Variational Autoencoders are one the most powerful unsupervised learning technique that every data scientist should be aware of. Although these models have their own limitations like they require comparatively larger datasets for training etc.</p><p>I have attached the VAE code, there are two files <a href="https://gist.github.com/prakhargurawa/f9e68e54ce00a12f4c5e96cb9cf87995">vae.py</a> which contains the encoder-decoder autoencoder model, and <a href="https://gist.github.com/prakhargurawa/75b162800a37b21e41b02daa56b137cf">vae_visualize.py</a> which can be used to visualize the outputs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/212ae0cb31f141aa5112a6467f4261ed/href">https://medium.com/media/212ae0cb31f141aa5112a6467f4261ed/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcf8c30c4319d4292ea1153492ce6e49/href">https://medium.com/media/fcf8c30c4319d4292ea1153492ce6e49/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8ddbeb91496" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fuzzy Address Matching Algorithm using Google’s Geocoding API]]></title>
            <link>https://prakhargurawa.medium.com/fuzzy-address-matching-algorithm-using-googles-geocoding-api-74c0d8d6a56f?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/74c0d8d6a56f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Fri, 15 Apr 2022 13:37:12 GMT</pubDate>
            <atom:updated>2022-04-15T13:42:25.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hLlFSwkSU5ePg2FG" /><figcaption>Photo by <a href="https://unsplash.com/@kai_wenzel?utm_source=medium&amp;utm_medium=referral">Kai Wenzel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Problem Statement</h3><p>In this article, we will try to solve a problem where we need to<strong> </strong>find whether the two addresses provided indicated the same location or different. Naturally, the simple way to do this is to perform an exact string match between the two addresses, but the problem arises when the two addresses are provided by different sources. For example, the first address might be provided by your customer who might be entering this manually using an online form and for the second address, you might be fetching addresses from the government’s land registry database. Now, these theses addresses might look similar or even not but can indicate the same place.</p><p>For example, the below two addresses if matched using an exact match algorithm will fail but actually, these are the same places :</p><ul><li><strong><em>134 Ashewood Walk, Summerhill Lane, Portlaoise</em></strong></li><li><strong><em>134 Summerhill Ln, Ashewood Walk, Summerhill, Portlaoise, Co. Laois, R32 C52X, Ireland</em></strong></li></ul><h3>Approach</h3><p>There can be multiple ways to solve this problem, but I used google&#39;s Geocoding API which basically converts addresses or place IDs to latitude/longitude or vice versa. You can read about the API from the below link, also remember this is <strong>not a free API</strong> and needs you to generate your own API_key to use it. But there is a limit of approx 2000 calls per 24 hours for which they don’t charge anything.</p><p><a href="https://developers.google.com/maps/documentation/geocoding/?csw=1">Google Maps Platform Documentation | Geocoding API | Google Developers</a></p><p>Let us start the coding and in parallel will try to explain the relevant information required. First import all the relevant libraries :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4aef24676eebeae0eca6072b92b979b/href">https://medium.com/media/b4aef24676eebeae0eca6072b92b979b/href</a></iframe><p>The next step will be generating your API_key for which you can refer to the <strong>Google Geocoding API </strong>website.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f067063f179a8883b3a7312c9345a04e/href">https://medium.com/media/f067063f179a8883b3a7312c9345a04e/href</a></iframe><p>The next step will be to test the external API and analyze its provided content. We have provided an address <strong><em>‘Bridgestreet Champs Elysees Accommodations Paris’</em></strong> for which the API will provide us different properties such as <strong>street_number, route, locality, country, postal_code, administrative_area_level_1,administrative_area_level_2, latitude, and longitude</strong>. For better analysis of the content provided by API this is JSON.</p><p><a href="https://jsonformatter.org/a0c611">Geocoding Result</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15e3b9af429c6f58f1284c0f15167076/href">https://medium.com/media/15e3b9af429c6f58f1284c0f15167076/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*MdVrzYvl1ecqHi6U0OW7xA.png" /></figure><p>Now we can write a function that will utilize the API and provide results in a clear python dictionary. These are two functions, the first just provide the latitude and longitude and the second provides all possible information that can be captured from the API result.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d84fa6d898b07aba2363aa7728934a4a/href">https://medium.com/media/d84fa6d898b07aba2363aa7728934a4a/href</a></iframe><p>An example result is provided below for this function created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*tt1T39SrfvtMn0_63OUFhw.png" /></figure><p>Also, we will require a function that can find the distance between two coordinates i.e latitude/longitude. We won’t use Euclidean distance as it works for the flat surface like a Cartesian plain however, Earth is not flat. So we have to use a special type of formula known as <strong>Haversine Distance. </strong><em>Haversine Distance</em><strong><em> </em></strong><em>can be defined as</em><strong><em> </em></strong><em>the angular distance between two locations on the Earth’s surface and can be calculated as :</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*UBjYXFKFCGI_OqWXjjvNIw.png" /><figcaption>Source: <a href="https://en.wikipedia.org/wiki/Haversine_formula">https://en.wikipedia.org/wiki/Haversine_formula</a></figcaption></figure><p>Thanks to python’s vibrant developer community we have a dedicated library to calculate Haversine distance called haversine(one of the perks of using python). Please read this excellent post by Ashutosh Bhardwaj for a better understanding of this.</p><p><a href="https://towardsdatascience.com/calculating-distance-between-two-geolocations-in-python-26ad3afe287b">Calculating distance between two Geolocations in python</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5be73b3d1c4d18b33a3546a3a1e6f67/href">https://medium.com/media/b5be73b3d1c4d18b33a3546a3a1e6f67/href</a></iframe><p>Below are two examples where the first pair of coordinated points to the same address and the second pair are coordinated of two houses that are very close to each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*fD_9wXGkqaDz0FkM-LSPXw.png" /></figure><h3>Address Matching Algorithm</h3><p>Now we will start working on the <strong>main algorithm </strong>which compares the two provided addresses and return whether they represent the same place or not. The algorithms perform the below logic :</p><ul><li>First, we<strong> fetch the Geocoding API’s parameters</strong> for both the addresses using the function we have already created.</li><li>Our logic checks that the<strong> Haversine distance</strong> between the coordinates for the first and second addresses should be less than the threshold set. If the distance is greater than the threshold we will return them as different addresses. I have set this threshold as 0.25 which means 250 meters.</li><li>Also, we will perform some <strong>address cleaning</strong> on the various components fetched by the API. We will remove fadas, special string characters adapted from languages of other accents. Also, remove dash(-) and period(.) and convert them in space, also remove every other nonalphanumeric character</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44b0cdc7bc36b42bd616c01798e9d52f/href">https://medium.com/media/44b0cdc7bc36b42bd616c01798e9d52f/href</a></iframe><ul><li>The second checks are on the various parameters provided by the external Google API. All of them need to be matched, but we won’t perform exact matching for all but will perform<strong> fuzzy matching </strong>of most of them. For calculating the fuzzy distance we will use the fuzzywuzzy library of python. <a href="https://en.wikipedia.org/wiki/Fuzzy_logic">Fuzzy logic</a> is a form of multi-valued logic that deals with reasoning that is approximate rather than fixed and exact. Fuzzy logic values range between 1 and 0. i.e the value may range from completely true to completely false. In contrast, <strong><em>Boolean Logic</em></strong> is a two-valued logic: true or false usually denoted 1 and 0 respectively, that deals with reasoning that is fixed and exact. Fuzzy logic tends to reflect how people think and attempts to model our decision making hence it is now leading to new intelligent systems(expert systems). <a href="https://en.wikipedia.org/wiki/Approximate_string_matching">Fuzzy String Matching</a>, also known as Approximate String Matching, is the process of finding strings that approximately match a pattern. You can read more on this here :</li></ul><p><a href="https://towardsdatascience.com/fuzzy-string-matching-in-python-68f240d910fe">Fuzzy String Matching in Python</a></p><ul><li>The <strong>weights dictionary</strong> decided the threshold limits for various address components. Such as for street_number, postal_town, country, and postal_code it is set as 100 which means <strong>exact matching,</strong> and for others we will have the fuzzy matching threshold set as 80 i.e even if they are 80% similar we will consider them as a match. The full algorithm is displayed below:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cadc1c7213ed02c152965bed7f4a8cb5/href">https://medium.com/media/cadc1c7213ed02c152965bed7f4a8cb5/href</a></iframe><p>Let us test on a few pairs of addresses, the first pair is actually pointing to the same address but looks different if compared using exact matching and which is provided as a match by our algorithm. The second pair are two addresses that are very nearly located and are marked as different addresses by our algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*dK9CKms-wz2xY7TkP_3RMw.png" /></figure><p><strong>Full code here</strong></p><p><a href="https://github.com/prakhargurawa/Natural-Language-Processing/blob/main/Google-Geocoding-Address-Matching-Algorithm/Address-Matching-Algorithm.ipynb">Natural-Language-Processing/Address-Matching-Algorithm.ipynb at main · prakhargurawa/Natural-Language-Processing</a></p><h3>To-do/Room for improvement:</h3><ul><li>Perform better address cleaning.</li><li>Maybe we can approach this problem using Google’s Autocomplete API as discussed here :</li></ul><p><a href="https://stackoverflow.com/questions/6078300/i-need-an-address-matching-algorithm/71871764#71871764">I need an address matching algorithm</a></p><ul><li>Can test with Dedupe library. <em>dedupe is a python library that uses machine learning to perform fuzzy matching, deduplication, and entity resolution quickly on structured data.</em></li></ul><p><a href="https://github.com/dedupeio/dedupe">GitHub - dedupeio/dedupe: A python library for accurate and scalable fuzzy matching, record deduplication and entity-resolution.</a></p><p>Let me know any suggestions/room for improvements/ideas/faults. Thanks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74c0d8d6a56f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an E-Commerce Product Category Classifier using Deep Learning — Part 2]]></title>
            <link>https://prakhargurawa.medium.com/creating-an-e-commerce-product-category-classifier-using-deep-learning-part-2-af4fb42aa945?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/af4fb42aa945</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[e-commerce-business]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Sun, 13 Feb 2022 00:47:26 GMT</pubDate>
            <atom:updated>2022-02-13T00:48:49.294Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating an E-Commerce Product Category Classifier using Deep Learning — Part 2</h3><p>The part focuses on the actual machine learning model creation, the first part <a href="https://medium.com/@prakhargurawa/creating-an-e-commerce-product-category-classifier-using-deep-learning-part-1-36431a5fbc4e">here</a> focussed on data understanding, data preprocessing, and analysis.</p><h3>Problem Description :</h3><p>We aim to create a product category API that utilizes machine learning and deep learning to predict the possible categories/classes for any provided product name and its descriptions. The problem is considered for an e-commerce domain and the dataset used to train our models will contain some products and their labeled categories.</p><h3>Machine Learning Pipeline :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*TL4OVtH0M1_Osq9shR_J1A.png" /><figcaption>Fig 1. The machine learning pipeline for the category prediction task.</figcaption></figure><p>To solve multi-label problems, we mainly have approaches:</p><ol><li><strong>Binary classification</strong>: This strategy divides the problem into several independent binary classification tasks. It resembles the one-vs-rest method, but each classifier deals with a single label, which means the algorithm assumes they are mutually exclusive.</li><li><strong>Multi-class classification</strong>: The labels are combined into one big binary classifier called powerset. For instance, having the targets A, B, and C, with 0 or 1 as outputs, we have A B C -&gt; [0 1 0], while the binary classification transformation treats it as A B C -&gt; [0] [1] [0].</li></ol><h3>Data Splitting</h3><p>The next step after data preprocessing, converting it into a form the machine learning models can understand is to split it into train/test set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2b39ec66e71385521557d279d57050e/href">https://medium.com/media/b2b39ec66e71385521557d279d57050e/href</a></iframe><p>See how the information column is chosen as the independent variable also denoted by X and the product labels are considered as dependent variable y.</p><p>It is highly recommended to use TF-IDF, a very common algorithm to transform the text into a meaningful representation of numbers which is used to fit machine algorithms for prediction. The working of TF-IDF can be studied <a href="https://medium.com/@cmukesh8688/tf-idf-vectorizer-scikit-learn-dbc0244a911a">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RHirkKCJTmaQAJJe-QI42A.png" /><figcaption>Fig 2. A mathematical explanation of TF-IDF</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fb0781196f2b015ab65044f92b9f051/href">https://medium.com/media/6fb0781196f2b015ab65044f92b9f051/href</a></iframe><h3>Binary Classification Technique :</h3><p>We will first use the Binary classification technique, which has been also explained above. In the below, you can see how we are creating a separate classifier for a separate product category, in machine learning this technique is called <a href="https://towardsdatascience.com/multi-class-classification-one-vs-all-one-vs-one-94daed32a87b">one-vs-all</a>. We have used a simple linear regression model as a single product classification model. Other models worth trying are Naive Bayes, SVC, Random Forest.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f9ae1058edd2a2f12b64839db631820/href">https://medium.com/media/1f9ae1058edd2a2f12b64839db631820/href</a></iframe><p>By using the above code, we create classifiers for each product category, print its individual accuracy, AUC ROC, and overall accuracy of the model as a multiclassification model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0020nzlbQVHj9KFJAedaDA.png" /><figcaption>Fig 3. Snippet showing individual accuracy/ROC of individual product classification model and finally accuracy/ROC of the overall model.</figcaption></figure><p>The below code is an API that takes the product name and its description, performs the necessary data preprocessing and conversion required to fit the models, and finally creates predictions on each and every trained simple linear regression model. If the individual models predict it as 1, that product category is considered as a probable class for that product.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f4ab8da1dfce497c1f8805b7f1752a6/href">https://medium.com/media/1f4ab8da1dfce497c1f8805b7f1752a6/href</a></iframe><p>Let us test on a few products and try to predict they&#39;re possible categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cMAGcKYxeZ5eGIK_xZgZKQ.png" /><figcaption>Fig 4. Predictions on a few samples, we can observe how it predicts Samsung as cell phone, Duracell battery as houseware.</figcaption></figure><h3>Deep Learning-Based Models :</h3><p>In this section, we will start creating deep learning-based models which follow the multi-class classification-based modeling. The data first needs to be preprocessed, tokenized, and split which will be quite similar to what we have done for the previous model. The deep learning-based model using vanilla neural nets is as bellow.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d5153fae47e5e426abdd51cb6227f2e/href">https://medium.com/media/0d5153fae47e5e426abdd51cb6227f2e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*94Py0-AXbutNblnz_Gg6rg.png" /><figcaption>Fig 5. Simple neural net-based multi-classification product category prediction model</figcaption></figure><p>This model is trained for 30 epochs, and the losses and AUC are plotted below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*ZHTec9_wdfnNyfQu9kkXbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*yuUsf0zV2qDG5J54-Iu4DA.png" /><figcaption>Fig 6. Performance tracking for neural net model</figcaption></figure><p>The model provided some decent predictions on the new data which can be seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEvWS9NpyXaWsEdKcuIiPQ.png" /><figcaption>Fig 7. Prediction by the neural net multi-classification model, we can observe how it has classified Kung Fu Panda as a Video Game which is quite well.</figcaption></figure><p>But still, we can improve the performance of this neural net model, by using a more powerful technique called convolution which is quite popular with images. A convolution-based model is designed below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a107d4ad721d5b41111cc5d9723a888/href">https://medium.com/media/9a107d4ad721d5b41111cc5d9723a888/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*NOOpJulynJh3Qg6A1Fs_Yw.png" /><figcaption>Fig 8. Conv neural net-based multi-classification product category prediction model</figcaption></figure><p>This model is trained for 30 epochs and its performance over epoch is quite stable as compared to the previous model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*MRZbH2socx_kXsN-fxkO0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*_rphbsUV8vMlAawPB06s3A.png" /><figcaption>Fig 9. Performance tracking for conv neural net model</figcaption></figure><p>This model provides more concrete predictions as compared to the previous one but can still be improved by a powerful LSTM and Glove-based model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b49a687ddc30ea915c16484ed8290234/href">https://medium.com/media/b49a687ddc30ea915c16484ed8290234/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*cb-4ODplPFlB9xGBpE0jiQ.png" /><figcaption>Fig 10. LSTM + Glove neural net-based multi-classification product category prediction model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*f0U0hUaS6l1zFoQ5945FQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*rlY4tf6MUV25sqxsEBg73w.png" /><figcaption>Fig 11. Performance tracking for LSTM + Glove neural net model</figcaption></figure><p>Finally, we can use this API as a REST API which can look something like this:</p><pre>GET /product/categoryPrediction<br>{<br>  &quot;name&quot;:&quot;product name&quot;,<br>  &quot;description&quot;:&quot;product description&quot;<br>}</pre><p>I have also attached a few predictions of the final LSTM+ Glove-based model, which looks most stable and least overfitted as compared to other older models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LbQwcaMQd29hcVeuqij4Tw.png" /><figcaption>Fig 12. Final prediction from LSTM+Glove based model as a product category classifier.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af4fb42aa945" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an E-Commerce Product Category Classifier using Deep Learning — Part 1]]></title>
            <link>https://prakhargurawa.medium.com/creating-an-e-commerce-product-category-classifier-using-deep-learning-part-1-36431a5fbc4e?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/36431a5fbc4e</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Sat, 08 Jan 2022 19:20:41 GMT</pubDate>
            <atom:updated>2022-01-08T19:20:41.554Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating an E-Commerce Product Category Classifier using Deep Learning — Part 1</h3><h3>Problem Description :</h3><p>We aim to create a product category API that utilizes machine learning and deep learning to predict the possible categories/classes for any provided product name and its descriptions. The problem is considered for an e-commerce domain and the dataset used to train our models will contain some products and their labeled categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*9c76Diknb1if7tvSdHe8UA.png" /><figcaption>Fig 1. High-level solution overview of API which takes product name and its description and predicts possible categories.</figcaption></figure><p>This will help the organization to automatically predict categories for any new product included in the inventory and thus reducing the time and effort caused due to manual tagging of product categories. I have tried to follow the CRISP-DM standard for model development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*EmHLiG3fIJgGzGJnT90JVA.png" /><figcaption>Fig 2. The cross-industry standard process for data mining, known as CRISP-DM, is an open standard process model that describes common approaches used by data mining experts.</figcaption></figure><h3>Understanding Dataset :</h3><p>We will consider the BestBuyAPIs open dataset which contains three JSON files: categories.json, products.json, and stores.json.The dataset can be found here: <a href="https://github.com/BestBuyAPIs/open-data-set"><strong><em>https://github.com/BestBuyAPIs/open-data-set</em></strong></a><strong><em>.</em></strong></p><p>The stores.json contains information like store id, type, name, address, hours, etc which is not relevant for this task at this point. The categories.json list different categories from which our predictions will belong, but will not be used for our work. The file used is product.json which contains the product names, description, and their categories, from which our model will learn to tag categories to new products.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c08a5c36ac4ddf7969ef24d54182852/href">https://medium.com/media/8c08a5c36ac4ddf7969ef24d54182852/href</a></iframe><p>The below is an output of a single instance of the product.json file, which basically represents information of a single product in the provided dataset.</p><pre>{&#39;category&#39;: [{&#39;id&#39;: &#39;abcat0300000&#39;, &#39;name&#39;: &#39;<strong>Car Electronics &amp; GPS</strong>&#39;},<br>  {&#39;id&#39;: &#39;pcmcat165900050023&#39;, &#39;name&#39;: &#39;<strong>Car Installation Parts &amp; Accessories</strong>&#39;},<br>  {&#39;id&#39;: &#39;pcmcat331600050007&#39;, &#39;name&#39;: &#39;<strong>Car Audio Installation Parts</strong>&#39;},<br>  {&#39;id&#39;: &#39;pcmcat165900050031&#39;, &#39;name&#39;: &#39;<strong>Deck Installation Parts</strong>&#39;},<br>  {&#39;id&#39;: &#39;pcmcat165900050033&#39;, &#39;name&#39;: &#39;<strong>Dash Installation Kits</strong>&#39;}],<br> &#39;description&#39;: &#39;<strong>From our expanded online assortment; compatible with select GM vehicles; plastic material</strong>&#39;,<br> &#39;image&#39;: &#39;http://img.bbystatic.com/BestBuy_US/images/products/3466/346646_rc.jpg&#39;,<br> &#39;manufacturer&#39;: &#39;Metra&#39;,<br> &#39;model&#39;: &#39;99-4500&#39;,<br> &#39;name&#39;: &#39;<strong>Metra - Radio Dash Multikit for Select GM Vehicles - Black</strong>&#39;,<br> &#39;price&#39;: 16.99,<br> &#39;shipping&#39;: 0,<br> &#39;sku&#39;: 346646,<br> &#39;type&#39;: &#39;HardGood&#39;,<br> &#39;upc&#39;: &#39;086429003273&#39;,<br> &#39;url&#39;: &#39;http://www.bestbuy.com/site/metra-radio-dash-multikit-for-select-gm-vehicles-black/346646.p?id=1210376657731&amp;skuId=346646CC&#39;}</pre><p>From the above example, we can see product name:<strong> Metra — Radio Dash Multikit for Select GM Vehicles — Black </strong>with description: <strong>From our expanded online assortment; compatible with select GM vehicles; plastic material </strong>belongs to categories like<strong> Car Electronics &amp; GPS, Car Installation Parts &amp; Accessories, Car Audio Installation Parts, Deck Installation Parts and Dash Installation Kits.</strong></p><p>For now, information like images is out of scope to predict the product category. Also, we can see that there are so many other important attributes like price, model which can be used to solve some other problem for an e-commerce organization.</p><h3><strong>Data Understanding and Preparation :</strong></h3><p>The only relevant attributes for our problem set are name, description, and category which are extracted and converted to a suitable data frame using the below code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4b225b62955205dc9eaa0d2fd4eccd0/href">https://medium.com/media/a4b225b62955205dc9eaa0d2fd4eccd0/href</a></iframe><p>The output data frame containing the product name, description, and category looks like below. The categories for first instance are like Connected Home and Houseware, Houseware etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RgaYBpg-nt3jRqvmjeTMaA.png" /><figcaption>Fig 3. For the first instance, the product name is Duracell-AAA Batteries with its description and labeled categories.</figcaption></figure><p>There is a total of <strong>51646</strong> products listed in the product.json file. As each instance can belong to multiple categories, so these types of problems are known as a <strong>multi-label classification problem</strong>, where we have a set of target labels. If there are multiple categories but each instance is assigned only one, therefore such problems are known as a <strong>multi-class classification problems</strong>.</p><p>In <a href="https://en.wikipedia.org/wiki/Machine_learning">machine learning</a>, <strong>multi-label classification</strong> and the strongly related problem of <strong>multi-output classification</strong> are variants of the <a href="https://en.wikipedia.org/wiki/Statistical_classification">classification</a> problem where multiple labels may be assigned to each instance. Multi-label classification is a generalization of <a href="https://en.wikipedia.org/wiki/Multiclass_classification">multiclass classification</a>, which is the single-label problem of categorizing instances into precisely one of more than two classes; in the multi-label problem, there is no constraint on how many of the classes the instance can be assigned to.</p><p>Formally, multi-label classification is the problem of finding a model that maps inputs <strong>x</strong> to binary vectors <strong>y</strong> (assigning a value of 0 or 1 for each element (label) in <strong>y</strong>). Multi-class problems acknowledge that all the classes are mutually exclusive, but in our case, it is not as a product can belong to multiple classes/categories.</p><h3>Data Transformation :</h3><p>We would need to transfer out data in a format that can be fitted to a machine learning model. First, we will list the categories separately :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be0a72e60246fe2fffc2f40746148696/href">https://medium.com/media/be0a72e60246fe2fffc2f40746148696/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*o-5z6WeO9FRPG3OCM785mQ.png" /><figcaption>Fig 4. Listing categories for each product separately</figcaption></figure><p>Let us find the number of unique categories/classes as our prediction will belong in this particular set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93b15cd369d0278239b25aeaa8414cc8/href">https://medium.com/media/93b15cd369d0278239b25aeaa8414cc8/href</a></iframe><p>The total number of unique classes/categories comes out to be <strong>1802</strong>. So there are 1802 classes our prediction can take place into. Now comes the major data transformation part where we will unfold the dataset to view all the prediction classes at once.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e23f8a8648c645730cb0e7471c7379e/href">https://medium.com/media/4e23f8a8648c645730cb0e7471c7379e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CV-FjMbBv61m1I3VCIuDOQ.png" /><figcaption>Fig 5. Unfolded dataset with all prediction classes to view all at once. The width of the data frame is 1809 as the first 7 columns are just category label names and the rest all the 1802 classes.</figcaption></figure><p>Now we need to fill the cell as 1 for each row/product for their respective categories. Indicating cell[name, category] need to be 1 if that product belongs to that category. The script for that transformation is below and now the dataset is a sparse 0–1 matrix.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/481a7b847435b1866303bce327a49566/href">https://medium.com/media/481a7b847435b1866303bce327a49566/href</a></iframe><p>The shape of the data frame is (51646, 1804) as there are <strong>51646</strong> products with <strong>1802</strong> classes/categories.</p><h3>Data Analysis :</h3><p>Let us count of occurrence of each category, to check the most frequently occurring categories.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c25a6a434f2b3a2a65c92a4bc9c4c240/href">https://medium.com/media/c25a6a434f2b3a2a65c92a4bc9c4c240/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*XxXp2mbxzvbv6dZqB5p39g.png" /><figcaption>Fig 6. Top 5 categories existing in the dataset as per their frequency of occurrence for all products.</figcaption></figure><p>Let us visualize the category count with a threshold boundary indicated by a marked red line segregating all those calories having a count of more than 500 than those that don&#39;t.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec1474140281f0effe5e8e48f5d382a9/href">https://medium.com/media/ec1474140281f0effe5e8e48f5d382a9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*9CfEMNxKfznlnjS0BO-BCg.png" /><figcaption>Fig 7. Bar plot of categories of product and their counts. The most common category is Appliances.</figcaption></figure><p>We will reduce the number of categories by using a threshold value. So all those categories having an occurrence count of less than 100 will be considered as<strong> ‘other’</strong> category. These all categories will be merged to form a single category to reduce the complexity of the dataset.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5170c510cf289160c921151bd1b12cc9/href">https://medium.com/media/5170c510cf289160c921151bd1b12cc9/href</a></iframe><p>Now our data frame is of dimension (51646, 271), so our number of categories has been reduced by a significant number.</p><p>Similarly, we also do other data analysis like plotting the products with their number of categories. Most products have 3 categories assigned by the manual labelers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*u653j2hCKeE2nvHK0Sm7Iw.png" /><figcaption>Fig 8. There are around 22000 products with 3 categories assigned. This plot basically shows the distribution of categories.</figcaption></figure><p>We also do an analysis of the product description such as how long the description length is in general. For this, a boxplot is utilized, showing most descriptions are of length 150.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*RcuX_6abQzSQITEl7SlXlw.png" /><figcaption>Fig 9. There are few outliers having description lengths greater than 300.</figcaption></figure><p>A word cloud is used to better understand the nature of descriptions of a product, it basically provides the most common words occurring in the descriptions of the product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6vHwPWr14qFearth82Akw.png" /><figcaption>Fig 10. Most occurring words in the descriptions of products. The most occurring one is ‘Compatible’.</figcaption></figure><h3>Data Cleaning :</h3><p>It is important to clean our product name and description using NLP concepts like Stemming, stopwords removal, etc. This reduced the complexity and dimension of data and thus leads to less overfitted models.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/403853a54d600e825ba642ccd1c8297f/href">https://medium.com/media/403853a54d600e825ba642ccd1c8297f/href</a></iframe><p>These functions are applied to both product names and descriptions and finally, a new column ‘information’ is created which is generated by appending the cleaned product name and cleaned product description.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edcacc955d6af4664034c6dfee195969/href">https://medium.com/media/edcacc955d6af4664034c6dfee195969/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_80IBEw3vyMewfWrWYjnQ.png" /><figcaption>Fig 11. Data frame after performing the data cleaning operations.</figcaption></figure><p>Now the column ‘information’ will act as the dependent feature and the category classes as the dependent feature when we will fit them in a machine learning model.</p><h3>Machine Learning Pipeline :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*CEGcBtm12WkC5p6yPom-zw.png" /><figcaption>Fig 12. The machine learning pipeline for the category prediction task.</figcaption></figure><p>To solve multi-label problems, we mainly have approaches:</p><ol><li><strong>Binary classification</strong>: This strategy divides the problem into several independent binary classification tasks. It resembles the one-vs-rest method, but each classifier deals with a single label, which means the algorithm assumes they are mutually exclusive.</li><li><strong>Multi-class classification</strong>: The labels are combined into one big binary classifier called powerset. For instance, having the targets A, B, and C, with 0 or 1 as outputs, we have A B C -&gt; [0 1 0], while the binary classification transformation treats it as A B C -&gt; [0] [1] [0].</li></ol><p>We will work upon the machine learning modeling part in the next part of this blog. You can get the code for this work here: <a href="https://github.com/prakhargurawa/Product-Category-Prediction/blob/main/Product_Category_Prediction.ipynb">Code</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36431a5fbc4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Machine Learning]]></title>
            <link>https://prakhargurawa.medium.com/introduction-to-machine-learning-79f1343f0cd3?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f1343f0cd3</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Tue, 14 Dec 2021 21:13:49 GMT</pubDate>
            <atom:updated>2021-12-14T21:13:49.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kho01cwyjm3KSKmI" /><figcaption>Photo by <a href="https://unsplash.com/@askkell?utm_source=medium&amp;utm_medium=referral">Andy Kelly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Target Audience</h3><p>This article is for students and professionals who have an interest in Machine Learning and are starting their journey in this field. You can consider this article as the gist of machine learning which will help you create basic foundations and clarity regarding this field.</p><h3>What is machine learning?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*rZqpG-NiuU2MRr40KfDMkg.jpeg" /></figure><p>The technical definition of machine learning, Mitchell, 1997: Improvement with experience at some task. For a well-defined ML problem:</p><ul><li>An improvement over task T</li><li>wrt performance measure P</li><li>Based on experience E</li></ul><p>Suppose if you are creating a model which can play chess, your task will be to play chess and win, your performance measure will be whether you are winning the game or not, and finally, the experience will be gained by the number of games/iterations you will play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Rde93VqQkWOONDG4ceONBA.png" /></figure><h3>How is Machine Learning different from Traditional Learning?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*h1fGsT03ymNwX4BMQ3srnQ.png" /></figure><p>In traditional programming, we provided the hardcoded logic/program whereas in ML we try to learn that program based on the data and output provided.</p><h3>Applications of Machine Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*eroWZ7xsHTodQV0l7A-rWQ.jpeg" /></figure><p>You all are already surrounded by Social Media which uses face recognition and content recommendation, e-commerce for products recommendations, virtual personal assistants like Alexa. AI/ML is used for autonomous vehicles and stock price predictions. Check out this interesting site where each time you refresh the machine learning model generates a new face which probably does exist in the world: <a href="https://thispersondoesnotexist.com/">https://thispersondoesnotexist.com/</a>.</p><h3>Types of ML learning</h3><p>There are two kinds of data — labeled data and unlabeled data. Labeled data has both the input and output parameters in a completely machine-readable pattern, but requires a lot of human labor to label the data, to begin with. Unlabeled data only have one or none of the parameters in a machine-readable form.</p><ul><li>Supervised Learning: The machine learning algorithm is trained on labeled data. Even though the data needs to be labeled accurately for this method to work, supervised learning is extremely powerful when used in the right circumstances. (Given: training data + desired outputs aka labels).</li><li>Unsupervised Learning: These algorithms work with unlabeled data, resulting in the creation of hidden structures. Relationships between data points are perceived by the algorithm in an abstract manner, with no input required from human beings. (Given: training data without desired outputs).</li><li>Semi-Supervised Learning: Approach to <a href="https://en.wikipedia.org/wiki/Machine_learning">machine learning</a> that combines a small amount of <a href="https://en.wikipedia.org/wiki/Labeled_data">labeled data</a> with a large amount of unlabeled data during training. Semi-supervised learning falls between <a href="https://en.wikipedia.org/wiki/Unsupervised_learning">unsupervised learning</a> (with no labeled training data) and <a href="https://en.wikipedia.org/wiki/Supervised_learning">supervised learning</a> (with only labeled training data). It is a special instance of <a href="https://en.wikipedia.org/wiki/Weak_supervision">weak supervision</a>.</li><li>Reinforcement Learning: Based on rewarding desired behaviors and/or punishing undesired ones. In general, a reinforcement learning <a href="https://searchenterpriseai.techtarget.com/definition/agent-intelligent-agent">agent</a> is able to perceive and interpret its environment, take actions and learn through trial and error.</li></ul><h3>Major Types of Tasks</h3><ul><li>Classification: Subsequent data will fall into one of the predetermined categories. One of the most common uses of classification is filtering emails into “spam” or “non-spam.”</li><li>Regression: Used to predict continuous values. The ultimate goal of the regression algorithm is to plot a best-fit line or a curve between the data.</li><li>Clustering: Involves the grouping of data points. Given a set of data points, we can use a clustering algorithm to classify each data point into a specific group.</li><li>Co-training: It’s a semi-supervised learning technique, used when there are only small amounts of labeled data and large amounts of unlabeled data.</li><li>Relationship discovery: To find associations between different entities.</li><li>Reinforcement Learning: How intelligent agents ought to take actions in an environment in order to maximize the notion of cumulative reward.</li></ul><h3>Regression</h3><p>To understand how the variation in an independent variable can impact the dependent variable, regression analysis is specially molded out. Example: Simple Linear Regression. <strong><em>Y = bX+C</em></strong>, where Y is a dependent variable and X, is the independent variable, that shows a best fitted straight line(regression curve) having b as the slope of the line and C intercept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*iQtlXePci2hu0MIdayYGMg.png" /></figure><p>Multiple linear regression: we need to find values of theta in such a way that the error is minimum between the actual values and predicted values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*eBBGgftR8IGzz_q6zTRwtw.png" /></figure><h4>How are weights calculated?</h4><p>Weights are found using least square fits. <strong>Learning objective: </strong>find values for <strong><em>θ </em></strong>such that the value output by <em>h</em><strong>θ</strong>(<strong><em>x</em></strong>) for a given vector <strong><em>x </em></strong>is as close to <em>y </em>as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*Vebki2IsCxWwtwPPmdviDA.png" /></figure><p>J is convex with a single minimum ( example: y = x)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*S1OZS97LP0efSyXoRCuNWw.png" /></figure><p>Optimal weights are found using the Gradient Descent Algorithm. Gradient Descents: finding a local minimum of any continuously differentiable function. Take incremental steps ‘downhill’ with step size by learning rate alpha until little/no change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*5KkAdlAU7AoB77exmpyz1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*55cpHGkuJNHufzMmqfMdQw.png" /></figure><h4>Polynomial Regression</h4><p>By its nature, linear regression only looks at linear relationships between dependent and independent variables. That is, it assumes there is a straight-line relationship between them. Sometimes this is incorrect. For example, the relationship between income and age is curved, i.e., income tends to rise in the early parts of adulthood, flatten out in later adulthood, and decline after people retire. When to execute a model that is fit to manage non-linearly separated data, the polynomial regression technique is used. In it,<em> </em>the best-fitted line is not a straight line, instead, a curve that best-fitted to data points. In the below example you can see how a curve is a better choice for hypothesis description and that is why polynomial regression works better in this case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dG6m4wnx3ARPtZPd8qf1tQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*PVDr3B3eQiUFKXpzkJJWtQ.gif" /></figure><h4>Various hypotheses which one to consider</h4><p>At times you will face this dilemma when you have to choose a single hypothesis amongst a number of hypotheses. The Answer: Ockham’s Razor Prefer the simplest hypothesis consistent with data but it depends strongly on how a hypothesis is expressed. There will be a trade-off between the complexity<strong> </strong>of the hypothesis and how well it fits the data, but always prefer the simplest possible hypothesis which for the below case is a straight line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*f2Z2Aus8N5Ee7I239PGVpw.png" /></figure><p><strong>Understanding Bias, Variance, Underfitting, and Overfitting</strong></p><p>One of the most important concepts of machine learning. Variance errors are defined as over-sensitivity to small changes in training data. High variance means the algorithm may fit random noise in training data, rather than real relationships in data which leads to <strong>over-fitting. </strong>Bias errors are due to bad assumptions in the learning algorithm. High bias means algorithm cannot capture all relevant relationships between attributes and output leading to <strong>underfitting.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*mSDLqEpKy84jDQkqBtw1uQ.png" /></figure><p>ML Algorithms with <strong>complex hypothesis language </strong>are prone to <strong>overfitting. </strong>Those with <strong>simpler hypothesis language </strong>are prone to <strong>underfitting. For </strong>example, linear regression involves a simple hypothesis as it uses straight lines, so it is prone to underfitting caused due to high bias and low variance. Whereas polynomial regression uses a more complex hypothesis which can cause a highly overfitted model caused due to higher variance and weaker bias.</p><p>Bias/Variance tradeoff: If our model is too simple and has very few parameters then it may have high bias and low variance. On the other hand, if our model has a large number of parameters then it’s going to have high variance and low bias. So we need to find the right/good balance without overfitting and underfitting the data.</p><h3><strong>Classification</strong></h3><p>Classification is the process of predicting the class of given data points. Classification predictive modeling is the task of approximating a mapping function (f) from input variables (X) to discrete output variables (y). The decision tree is one of the most common classification algorithms. It utilizes an if-then rule set that is mutually exclusive and exhaustive for classification. The rules are learned sequentially using the training data one at a time. A node (where two branches intersect) is a decision point. Nodes partition the data. The terminal nodes are called leaves; these specify the target label for an item. Splits are performed based on some specific metric like entropy. Random forest is basically we are using multiple decision trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*MroZ5VR1fpGIVnBDiTIq4g.png" /></figure><p>For the above dataset, below is the decision tree created using the algorithms that utilize the entropy function to create splits at any point/node of the tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*cyQwzfSXWcfeSEOZoU-mWw.png" /></figure><h4>K-Nearest Neighbour</h4><p>Base prediction on several (<em>k</em>) nearest neighbors. Compute distance from query case to all stored cases, and pick the nearest k <em>neighbors</em>. Neighbors vote on the classification of the test cases. We can use Euclidean or Manhattan distance for finding distance between two points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*Ygsenpa5Bu1hOTsbH0mVxA.png" /></figure><p>1-Nearest Neighbour algorithm: Simplest similarity-based/instance-based method. Choose the nearest one; assign the test case to have the same label (class or regression value) as this one. But to reduce susceptibility to noise, we use more than 1 neighbor.</p><h4>Logistic Regression</h4><p>Suppose we want to build a Yes/No <strong>classification </strong>model. Our Goal: Given sample <strong><em>x</em></strong>, find function f(<strong><em>x</em></strong>) that correctly classifies it. We use activation functions something like sigmoid etc to covert a normal regression model to a logistic regression model which is a classification model. Go from the linear regression formula: <em>h</em><strong><em>θ</em></strong>(<strong><em>x</em></strong>) = <strong><em>θ</em></strong><em>∙ </em><strong><em>x </em></strong>To this: <em>h</em><strong><em>θ</em></strong>(<strong><em>x</em></strong>) = <em>g</em>(<strong><em>θ</em></strong><em>∙ </em><strong><em>x</em></strong>) where <em>g</em>(<em>z</em>)is called the sigmoidal or logistic function. The output from the hypothesis is the estimated probability. The below diagram shows how the sigmoid function changes with respect to input, see how it converts any input into an output of range 0 to 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*4lk2iNAttk5zn5zqOuwSEA.png" /></figure><p>Also, now the cost function for logistic regression cannot be defined using a mean square error function or any other regression-based error function, as we dealing with classes and therefore we use the cross-entropy function defined as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*xlQUuOtC8wm1N3CHrfIIlQ.png" /></figure><h3><strong>Clustering</strong></h3><p>It’s an unsupervised learning method, aims to find meaningful structures and groups in the datasets. Clustering is a Machine Learning technique that involves the grouping of data points. In theory, data points that are in the same group should have similar properties and/or features, while data points in different groups should have highly dissimilar properties and/or features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*H3aOanqQwm7fnEruEgrL1g.png" /></figure><h4>K-Means Clustering Algorithm</h4><p>Most well-known clustering algorithm. Iterative algorithms that divide a group of n data points into k clusters based on the similarity and their mean distance from the centroid of the particular subgroup. You have to decide the value of k (number of clusters to be formed). To process the learning data, the K-means algorithm in data mining starts with the first group of randomly selected centroids, which are used as the beginning points for every cluster, and then performs iterative (repetitive) calculations to optimize the positions of the centroids. Stop when the centroids have stabilized (no change in their values).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*Iu-C7or3NYTmi89uHy1Mpw.png" /></figure><p>The input data and final output after running a clustering algorithm are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*D5j0ixBXuSSWBpSJepnlFg.png" /></figure><h3>Closing remarks</h3><p>Well, this article is just an introduction to machine learning and in this particular section, I have not focused on Deep Learning. The most important giveaway from this work is knowing the most popular kinds of problems machine learning can be used to solve and some common well-known algorithms which can be used to tackle those problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f1343f0cd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Graph Neural Networks are used for Information Extraction?]]></title>
            <link>https://prakhargurawa.medium.com/how-graph-neural-networks-are-used-for-information-extraction-32e9ae0e7acc?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/32e9ae0e7acc</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[graph-convolution]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Wed, 24 Nov 2021 13:36:14 GMT</pubDate>
            <atom:updated>2021-11-24T13:36:14.991Z</atom:updated>
            <content:encoded><![CDATA[<p>In this particular article, we will consider the problem of receipt digitization i.e extracting necessary and important information in form of labels from hardcopy receipts such as medical invoices, tickets, etc. These kinds of models can be highly useful in real life and help users, to better understand data as still a large chunk of our daily work deals with hardcopy receipts. In the world of natural language processing, this task is called sequence tagging, as we are tagging each input entity in some form of predefined class such as for normal receipts for grocery shopping, labels can be TOTAL_KEY, SUBTOTAL_KEY, COMPANY_NAME, COMPANY_ADDRESS, DATE, etc. The below diagram described the general pipeline for these kinds of work which will be described one by one in upcoming section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*AYVsyriPtk6ATiA68l9Kdw.png" /><figcaption>Fig 1. Basic common pipleine from receipt digitization</figcaption></figure><h3><strong>Motivation to use GNN/GCN ?</strong></h3><p>The need to recognize local patterns in graphs, similarly to the way a CNN scans the input data through a small window recognizing local relations between the nodes within the window, a GCN could start by capturing local patterns between neighboring nodes in a graph [7]. Recognizing hierarchies of patterns can be greatly exploited by GCNs.</p><h3>Pipeline Understanding</h3><p>Let us try to understand the basic common pipeline for these kinds of projects:</p><ul><li>The input image is captured in the form or image/video which goes to a number of image proprocessing steps such as cropping a receipt from image, histogram adjustment, brightness adjustment etc. OpenCV is industry standard for these kinds of task. You can learn about image segmentation i.e cropping a receipt from an image from this notebook [1], also learn about few common preprocessing from here [2].</li><li>Ones the image is cropped and proprocessed accordingly, we provide this image to OCR [3] systems. You can use Google’s cloud APIs [4], Tesseract [5] or any OCR system of your choice in your budget, needs and system accuracy.</li><li>After the process of OCR, we have a table which contains the text and their position in the input images. Usually OCR system provides the coordinates of left top point and right bottom point for each detected text.</li><li>Now comes the interesting part, the outputs of OCR i.e the bounding boxes on receipts are used to create the input graph which will be used by graph neural networks. Each text/bounding box is considered to be a node, the edge connection creation can have multiple ways. One of such techniques [6] creates a maximum of four edges for each node, the edges connect each text area to its closest four neighboring text areas in each direction (Up, Down, Left and Right)[7]. Get some idea how this can be coded from here [8].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8K1GvgpUbrSdM7WhcQTMWA.png" /><figcaption>Fig 2. Graph creation using bounding boxes from OCR</figcaption></figure><ul><li>The output of OCR is also used to create embeddings. To create word embeddings we can use glove, or we can encode text segments using a Transformer to get text embeddings. The embeddings are created for each detected text and stored in an node feature matrix. Using image embeddings is optional but they have shown significant improvement in model such as PICK [9] as they can carry useful information like text foxt, text curvatures etc. We can think of this as the model can predict that a text is of category STORE_NAME, if its font size is large because usually store name fonts are larger than the other text present on receipts.</li><li>These two type of embeddings are combined to create a new fusion embedding for better understanding of data and used as node inputs for Graph neural nets. To better understand the use of embedding it is suggested to go through this paper ones [9] and its implementation [10].</li><li>For each ouput text we already have their output classes assigned to them, which will be used for learning. You can search for these kinds of receipts based datasets, one such is [11].</li><li>At this point we have or adjacency matrix (A), feature matrix (x) created using the combination of word and image embeddings for each nodes and finnaly the labels (y). Now we can treat this as a normal machine learning problem where A and x are independent features and y is dependent which needs to be learned and predicted.</li><li>A, x and y will be used to train a graph based neural network models which will learn to classify each node in the possible classes. The GCN, Graph Convolution Neural Network learns to embed node feature vector (combination of word embedding and the connection structure to other nodes) by generating a vector of real numbers that represents the input node as a point in an N-dimensional space, and similar nodes will be mapped to close neighboring points in the embedding space, allowing to train a model able to classify the nodes [7]. This article depects theory related to node classification [15].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*drdaJjy_xDvBy82jA7crKQ.png" /><figcaption>Fig 3. Node classification using graph embedding space technique learned using a graph based neural net model</figcaption></figure><ul><li>Ones the model provides a satisfactory results from test set in terms of accuracy, F1 score etc. It can be used on real world data to extract information from a hardcopy receipts in terms of extracting text and predicting their possible category.</li></ul><p>This is just an overview about how these systems work, I can recommed learning more from [7], [12], [13], [16] and maybe this can be implemented using open source graph learning based libraries like Spektral [14] or any other library of yor choice.</p><h3>References:</h3><ol><li>Image segmentation by OpenCV : <a href="https://www.kaggle.com/dmitryyemelyanov/receipt-ocr-part-1-image-segmentation-by-opencv">https://www.kaggle.com/dmitryyemelyanov/receipt-ocr-part-1-image-segmentation-by-opencv</a></li><li>Pre-Processing from OCR!!! : <a href="https://towardsdatascience.com/pre-processing-in-ocr-fc231c6035a7">https://towardsdatascience.com/pre-processing-in-ocr-fc231c6035a7</a></li><li>Optical Character Recognization : <a href="https://en.wikipedia.org/wiki/Optical_character_recognition">https://en.wikipedia.org/wiki/Optical_character_recognition</a></li><li>Google Vision API : <a href="https://cloud.google.com/vision/docs/ocr">https://cloud.google.com/vision/docs/ocr</a></li><li>Tesseract : <a href="https://github.com/tesseract-ocr/tesseract">https://github.com/tesseract-ocr/tesseract</a></li><li>Effecient, Lexicon free OCR using deep learning : <a href="https://arxiv.org/abs/1906.01969">https://arxiv.org/abs/1906.01969</a></li><li>Information Extraction from Receipts with Graph Convolutional Networks : <a href="https://nanonets.com/blog/information-extraction-graph-convolutional-networks/">https://nanonets.com/blog/information-extraction-graph-convolutional-networks/</a></li><li>Graph Convolution on Structured Document : <a href="https://github.com/dhavalpotdar/Graph-Convolution-on-Structured-Documents/blob/master/grapher.py">https://github.com/dhavalpotdar/Graph-Convolution-on-Structured-Documents/blob/master/grapher.py</a></li><li>PICK : <a href="https://arxiv.org/abs/2004.07464">https://arxiv.org/abs/2004.07464</a></li><li>PICK-pytorch : <a href="https://github.com/wenwenyu/PICK-pytorch">https://github.com/wenwenyu/PICK-pytorch</a></li><li>CORD : <a href="https://github.com/clovaai/cord">https://github.com/clovaai/cord</a></li><li>Automizing Receipt Digitization with OCR and Deep Learning : <a href="https://nanonets.com/blog/receipt-ocr/">https://nanonets.com/blog/receipt-ocr/</a></li><li>Graph Convolution for Multimodel Information Extraction for Visually Rich Documents : <a href="https://arxiv.org/abs/1903.11279">https://arxiv.org/abs/1903.11279</a></li><li>Spektral : <a href="https://graphneural.network/">https://graphneural.network/</a></li><li>Understanding GCN for Node Classifcation : <a href="https://towardsdatascience.com/understanding-graph-convolutional-networks-for-node-classification-a2bfdb7aba7b">https://towardsdatascience.com/understanding-graph-convolutional-networks-for-node-classification-a2bfdb7aba7b</a></li><li>Extracting Structred Data from Invoices : <a href="https://medium.com/analytics-vidhya/extracting-structured-data-from-invoice-96cf5e548e40">https://medium.com/analytics-vidhya/extracting-structured-data-from-invoice-96cf5e548e40</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32e9ae0e7acc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Vehicle Detection and Classification ML pipeline using YOLO and MobileNet transfer…]]></title>
            <link>https://prakhargurawa.medium.com/creating-a-vehicle-detection-and-classification-ml-pipeline-using-yolo-and-mobilenet-transfer-a15f7b1e8ec9?source=rss-c0cd22ec9144------2</link>
            <guid isPermaLink="false">https://medium.com/p/a15f7b1e8ec9</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cars]]></category>
            <dc:creator><![CDATA[Prakhar Gurawa]]></dc:creator>
            <pubDate>Sun, 24 Oct 2021 14:28:24 GMT</pubDate>
            <atom:updated>2021-10-24T14:28:24.120Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a Vehicle Detection and Classification ML pipeline using YOLO and MobileNet transfer learning</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBT2CvG1LVcQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBT2CvG1LVcQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBT2CvG1LVcQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c50d293acb7d9621454f64a0c7488f2e/href">https://medium.com/media/c50d293acb7d9621454f64a0c7488f2e/href</a></iframe><h3>Introduction to Computer Vision pipeline</h3><p>We will be creating a vehicle detection and classification pipeline using machine learning techniques. We will be detecting the number of cars per frame and classify them into two classes SUV and sedan, all in real-time. This article has a few prerequisites such as the basics of machine learning, deep learning, convolution networks, and transfer learning. To design and implement a computer vision pipeline we have bifurcated the pipeline in the following subtasks :</p><ol><li><strong>Video Reading: </strong>For this task, we have used OpenCV to read the video frame by frame and then finally display the original video to the user and then pass a queue of frames for the next task.</li><li><strong>Object Detection: </strong>Used a pretrained state of art object detection model TinyYOLO which is trained on the COCO dataset. The role of TinyYOLO is to detect cars in frames which is one of the classes present in the COCO dataset.</li><li><strong>Car Type Classifier:</strong> Once we get the cars with their bounded box for every frame we need to classify them as either SUV or Sedan. For this, we have used the MobileNetV2 classifier and applied transfer learning concepts to modify the model according to our use case.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*1ACQpEz0BMji-6fa7hCyOw.png" /><figcaption>Figure 1 . Description of computer vision pipeline</figcaption></figure><h3><strong>Pipeline Design, Model Configurations, and Working</strong></h3><ul><li>For <strong>video reading</strong>, we have used OpenCV which reads the video frame by frame at a rate of 30 FPS.</li><li><strong>Dataset Preparation:</strong> The dataset includes images from two classes SUV and Sedan, with <strong>1540 images of Sedan</strong> and <strong>1519 images for SUV</strong>. The images have been collected using google images web scraping and Stanford Car Dataset[1] which contains images of multiple kinds of cars including SUVs and Sedans. All the images collected from web scraping and Stanford dataset were manually checked once to remove all the ones with were irrelevant or highly dubious. This step is a part of data preparation.</li><li>For <strong>Object Detection</strong>, we have preferred TinyYOLO over YOLO as it’s lightweight and faster as compared to later. TinyYOLO can process at 220 FPS whereas YOLO processed 20–40 FPS. Due to the requirement to detect in real-time better to use TinyYOLO.</li><li>Once all the frames are read using OpenCV we pass a queue of frames to the detection function which uses the <strong>YOLO’s detect_image</strong> function to detect classes in any given frame.</li><li>After we get all the detected classes and their position using YOLO we consider only those detected objects whose class is<strong> the car</strong>.</li><li>Finally, the detected car with their positions in any particular frame is passed to a function that <strong>classifies</strong> any car’s image in either SUV or Sedan. This function basically uses the model trained on thousands of SUV and Sean images using the MobileNet model which can be found in MobileNet_TransferLearning.py .</li></ul><h3><strong>MobileNet Model and Transfer Learning</strong></h3><ul><li>The basic structure of MobileNet models looks as depicted in the next figure which is reused using the concept of transfer learning.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*ZFpo1vSBxwcsW3uKl60iDQ.png" /><figcaption>Figure 2 . Structure of original MobileNetV2 Model</figcaption></figure><ul><li>MobileNet model is used as a starting point where we discarded the last layer and added our own layers as shown in figure 2 with two additional hidden layers with 512 neurons, one hidden layer with 256 neurons and finally, a single output layer with a single node as this is a binary classification task.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*ACeWtLcZ8mQefZtrC9cnUA.png" /><figcaption>Figure 3 . Structure of modified model by the addition of extra hidden layers</figcaption></figure><h3><strong>Hyperparameters and Model Tuning</strong></h3><ol><li><strong>Dropout: </strong>Used a regularization method dropout on new layers with a probability of 0.2 which helped to reduce overfitting in the model which can be studied due to less gap between training and validation accuracies and errors.</li><li><strong>Data Augmentation:</strong> Tried using data augmentation which performs a different operation like zooming, shifting, etc but was not giving satisfactory results so dropped this operation.</li><li><strong>Epochs:</strong> The number of epoch set for this model was 20 as a higher number of epoch was not giving satisfactory results on ground truth and the rate of increase of accuracy was also low, could be they were overfitted.</li><li><strong>L1/L2 Regularization:</strong> Tried experimenting with L1 and L2 weight regularization but was giving worse results with very high validation errors and low accuracy.</li><li><strong>Model compilation:</strong> The loss function used is binary cross-entropy with accuracy as a metric to progress. Finally, the model weights are saved with the proper name in the folder saved_models.</li><li><strong>Gradient descent optimization algorithms:</strong> Experimented with two optimization algorithms RMSProp and Adam optimizer. For our use case, Adam was giving satisfactory results so used that. The learning rate used was 0.0001 as a lower learning rate was resulting in slower learning with a demand of higher epochs.</li></ol><h3><strong>Accuracy and Cross-Entropy vs Number of the epoch</strong></h3><p>The variation of accuracy and cross-entropy with respect to time/epoch for optimization Adam and RMSProp is depicted in figure 4 below. Also, we have preferred Adam over RMSProp due to the less overfitted model as the difference between training accuracy and validation accuracy is less as compared to RMSProp. As expected it was giving better results on ground truth with better F1 scores of the number of sedan and SUV cars which also proved that overall it’s a better model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tu3eMydLUUr_6rgoGpN8FA.png" /><figcaption>Figure 4 . Variation of accuracy and cross entropy(loss) wrt to time/ epoch for Adam(left) and RMSProp(right)</figcaption></figure><h3><strong>Final Accuracy for deep learning models</strong></h3><ul><li>Adam optimizer (lr=0.0001) : Training loss = 0.0772, Validation loss = 0.8120, Training accuracy = 0.9733 and Validation accuracy = 0.7605.</li><li>RMSProp optimizer (lr=0.0001) : Training loss = 0.0887, Validation loss = 1.8487, Training accuracy = 0.9721 and Validation accuracy = 0.5905.</li></ul><h3><strong>Pipeline Optimization</strong></h3><ul><li><strong>Producer-Consumer </strong>tried using producer-consumer design pattern but was not giving significant time difference as the producer in our case the frame video reader is much faster as compared to consumer (object detector and classifier) so it is not able to synchronize itself and thus not used in this project.</li><li>Performed experiments with <strong>Non-Maximal Suppression (NMS)</strong> and <strong>Intersection over Union Threshold (IOU)</strong> parameters of the YOLO model to give better results. These parameter changes the threshold of a selection of objects and removes all boxes with low probability and intersection probability. For our use case with TinyYOLO, an NMS Score of 0.2 and IOU of 0.2 were giving better results which finally improves the F1 Score on ground truth.</li><li>We tried detecting cars first using <strong>haar cascades </strong>but it was not giving satisfactory results so we used YOLO for object detection whose performance was much better as compared to the first method. The implementation of first method can be found in Car_Detection_Using_Harr_Cascade.py .</li></ul><h3><strong>Pipeline Output</strong></h3><p>The input of pipeline is any given video that is displayed to the user and output is video with detected cars and their type (SUV/Sedan) as below in figure 5. The output of the system is also an excel sheet with columns Frames, Sedan, SUV, Total Cars which is then compared with ground truth to calculate the F1 Score of the number of cars per frame, F1 Score of sedan cars, and F1 scores of SUV cars which are shown in figure 6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*T86fOtUD_ZE883DAbD4CxA.png" /><figcaption>Figure 5 . Display snapshot out output video with the number of cars with their type attached to cars</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*DuthI61nHLbNUeP3vezygQ.png" /><figcaption>Figure 6 . The F1 Score for Total Cars, SUV and Sedan compared with ground truth on 900 frames in total</figcaption></figure><h3><strong>Execution Time</strong></h3><p>Our system has been slow processing the 900 frames in the time of 450 seconds. The time consumed by the object detection process by YOLO and object classification time by ML model (where the number of cars to detect is a crucial factor ) vs frame is displayed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q6mJ8dz1BU7yz_wzX4w6CA.png" /><figcaption>Figure 7 . Detection and Classification time for each frame wrt time/frame</figcaption></figure><h3><strong>Design Strengths and Weaknesses</strong></h3><ul><li>Even though it’s a computer vision pipeline the implementation of code has been coded on <strong>object-oriented programming standards </strong>with separate classes for video reading, object detection, car classification, etc which promotes reusable programming and will help extend this project.</li><li>Even with multithreading and thread pool the time to process video is significant which can be improved by running this application on <strong>a high-performance system</strong> with CUDA-enabled GPUs.</li><li>Even though the dataset <strong>collected from web scraping and Stanford dataset</strong> is<strong> checked manually</strong> there are a number of images that reduce the quality of the dataset and thus reduce the overall performance of the system but at the same time cannot be removed from the dataset as their count is significant.</li><li>Created a<strong> separate dependency.yml</strong> file so it’s easier for any new user to set up this project as a number of issues arise due to <strong>dependency issues and version clashes.</strong></li></ul><h3>Project Setup</h3><p>The code can be downloaded from the <a href="https://github.com/prakhargurawa/Vehicle-Detection-Classification-YOLO-MobileNet">Github link</a>.</p><p>In the same repository Car_Results.xls is the output excel which contains the number of cars, sedans, SUVs detected and classified per frame with Output.avi as output video.</p><h4>Setup steps :</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4974f33dc45e54c7d0b8814ab46225ac/href">https://medium.com/media/4974f33dc45e54c7d0b8814ab46225ac/href</a></iframe><h3><strong>References</strong></h3><ol><li><a href="https://www.google.com/url?q=https://ai.stanford.edu/~jkrause/cars/car_dataset.html&amp;sa=D&amp;source=editors&amp;ust=1635087070054000&amp;usg=AOvVaw3Qk7ZfsyoJM7Kg5k9oXN1K">https://ai.stanford.edu/~jkrause/cars/car_dataset.html</a></li><li><a href="https://www.google.com/url?q=https://machinethink.net/blog/mobilenet-v2/&amp;sa=D&amp;source=editors&amp;ust=1635087070054000&amp;usg=AOvVaw2o3T8eD1fZtw4XE3f2Bkt_">https://machinethink.net/blog/mobilenet-v2/</a></li><li><a href="https://www.google.com/url?q=https://keras.io/api/applications/mobilenet/&amp;sa=D&amp;source=editors&amp;ust=1635087070054000&amp;usg=AOvVaw1jcrb-tEdsGH2SvaCqtn-q">https://keras.io/api/applications/mobilenet/</a></li><li><a href="https://www.google.com/url?q=https://www.researchgate.net/publication/337339754_VidCEP_Complex_Event_Processing_Framework_to_Detect_Spatiotemporal_Patterns_in_Video_Streams&amp;sa=D&amp;source=editors&amp;ust=1635087070055000&amp;usg=AOvVaw1svF2elcLbMp32iop4rqVr">https://www.researchgate.net/publication/337339754_VidCEP_Complex_Event_Processing_Framework_to_Detect_Spatiotemporal_Patterns_in_Video_Streams</a></li><li><a href="https://www.google.com/url?q=https://medium.com/analytics-vidhya/you-only-look-once-yolo-implementing-yolo-in-less-than-30-lines-of-python-code-97fb9835bfd2%23:~:text%3DYOLO%2520uses%2520Non%252DMaximal%2520Suppression,this%2520NMS%2520threshold%2520to%25200.6&amp;sa=D&amp;source=editors&amp;ust=1635087070055000&amp;usg=AOvVaw0EQFpgCp73I6DsoDP4BtZc">https://medium.com/analytics-vidhya/you-only-look-once-yolo-implementing-yolo-in-less-than-30-lines-of-python-code-97fb9835bfd2#:~:text=YOLO%20uses%20Non%2DMaximal%20Suppression,this%20NMS%20threshold%20to%200.6</a>.</li><li><a href="https://www.google.com/url?q=https://tutorialedge.net/python/concurrency/python-threadpoolexecutor-tutorial/&amp;sa=D&amp;source=editors&amp;ust=1635087070056000&amp;usg=AOvVaw0R62zh1JKdl-3A-cbstOM8">https://tutorialedge.net/python/concurrency/python-threadpoolexecutor-tutorial/</a></li><li><a href="https://www.google.com/url?q=https://machinelearningmastery.com/how-to-calculate-precision-recall-f1-and-more-for-deep-learning-models/&amp;sa=D&amp;source=editors&amp;ust=1635087070056000&amp;usg=AOvVaw3oc3WV-VLEpMold_okqoeD">https://machinelearningmastery.com/how-to-calculate-precision-recall-f1-and-more-for-deep-learning-models/</a></li><li><a href="https://www.google.com/url?q=https://towardsdatascience.com/transfer-learning-using-mobilenet-and-keras-c75daf7ff299&amp;sa=D&amp;source=editors&amp;ust=1635087070056000&amp;usg=AOvVaw2ErSVsO9XJcZRUJgXsdd8D">https://towardsdatascience.com/transfer-learning-using-mobilenet-and-keras-c75daf7ff299</a></li><li><a href="https://www.google.com/url?q=https://www.kaggle.com/vasantvohra1/transfer-learning-using-mobilenet&amp;sa=D&amp;source=editors&amp;ust=1635087070057000&amp;usg=AOvVaw30yonm1luwtCw-Bljririf">https://www.kaggle.com/vasantvohra1/transfer-learning-using-mobilenet</a></li><li><a href="https://www.google.com/url?q=https://keras.io/api/layers/regularizers/&amp;sa=D&amp;source=editors&amp;ust=1635087070057000&amp;usg=AOvVaw32LjQ3N3zuHvyPbxRpWfDs">https://keras.io/api/layers/regularizers/</a></li><li><a href="https://www.google.com/url?q=https://machinelearningmastery.com/how-to-reduce-overfitting-in-deep-learning-with-weight-regularization/&amp;sa=D&amp;source=editors&amp;ust=1635087070058000&amp;usg=AOvVaw261TYnwMgC-zPfaP9tWbDf">https://machinelearningmastery.com/how-to-reduce-overfitting-in-deep-learning-with-weight-regularization/</a></li><li><a href="https://www.google.com/url?q=https://medium.com/analytics-vidhya/you-only-look-once-yolo-implementing-yolo-in-less-than-30-lines-of-python-code-97fb9835bfd2%23:~:text%3DYOLO%2520uses%2520Non%252DMaximal%2520Suppression,this%2520NMS%2520threshold%2520to%25200.6&amp;sa=D&amp;source=editors&amp;ust=1635087070058000&amp;usg=AOvVaw3yAqmNYgK4j9gQbsMW7tE0">https://medium.com/analytics-vidhya/you-only-look-once-yolo-implementing-yolo-in-less-than-30-lines-of-python-code-97fb9835bfd2#:~:text=YOLO%20uses%20Non%2DMaximal%20Suppression,this%20NMS%20threshold%20to%200.6</a>.</li><li><a href="https://www.google.com/url?q=https://github.com/qqwweee/keras-yolo3&amp;sa=D&amp;source=editors&amp;ust=1635087070059000&amp;usg=AOvVaw3aHVyEbQw7Av8HeCWXonWl">https://github.com/qqwweee/keras-yolo3</a></li><li><a href="https://www.google.com/url?q=https://pjreddie.com/darknet/yolo/&amp;sa=D&amp;source=editors&amp;ust=1635087070059000&amp;usg=AOvVaw3px8w1s9_z6b-lZW6dfMnQ">https://pjreddie.com/darknet/yolo/</a></li><li><a href="https://www.google.com/url?q=https://keras.io/api/applications/mobilenet/&amp;sa=D&amp;source=editors&amp;ust=1635087070060000&amp;usg=AOvVaw3JFaqm9pRFClX0mcw8X8ZS">https://keras.io/api/applications/mobilenet/</a></li><li><a href="https://www.google.com/url?q=https://medium.com/@amarbudhiraja/https-medium-com-amarbudhiraja-learning-less-to-learn-better-dropout-in-deep-machine-learning-74334da4bfc5&amp;sa=D&amp;source=editors&amp;ust=1635087070060000&amp;usg=AOvVaw2NEP-UEzxiMhjTTH_v0WAD">https://medium.com/@amarbudhiraja/https-medium-com-amarbudhiraja-learning-less-to-learn-better-dropout-in-deep-machine-learning-74334da4bfc5</a></li><li><a href="https://www.google.com/url?q=https://github.com/prakhargurawa/Facial-Emotion-Detection-Neural-Net-OpenCV/blob/main/facial_emotion_detection.py&amp;sa=D&amp;source=editors&amp;ust=1635087070061000&amp;usg=AOvVaw1hHKZJNAbL6tMt3kVIzOQV">https://github.com/prakhargurawa/Facial-Emotion-Detection-Neural-Net-OpenCV/blob/main/facial_emotion_detection.py</a></li><li><a href="https://www.google.com/url?q=https://ruder.io/optimizing-gradient-descent/&amp;sa=D&amp;source=editors&amp;ust=1635087070061000&amp;usg=AOvVaw0T4C7MbruWwaMy4mz0gvAB">https://ruder.io/optimizing-gradient-descent/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a15f7b1e8ec9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>