<?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 Akash Rawat on Medium]]></title>
        <description><![CDATA[Stories by Akash Rawat on Medium]]></description>
        <link>https://medium.com/@akash-rawat?source=rss-3c4a1737d9bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_7nN_buC_xah8eKqRCRA-A.png</url>
            <title>Stories by Akash Rawat on Medium</title>
            <link>https://medium.com/@akash-rawat?source=rss-3c4a1737d9bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:42:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akash-rawat/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[Master Data Management with Large Language Models]]></title>
            <link>https://akash-rawat.medium.com/master-data-management-with-large-language-models-a29cf5ada3a3?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a29cf5ada3a3</guid>
            <category><![CDATA[master-data-management]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Sun, 06 Apr 2025 08:29:40 GMT</pubDate>
            <atom:updated>2025-04-06T08:29:40.156Z</atom:updated>
            <content:encoded><![CDATA[<h4>Revolutionizing Master Data Management: Harnessing Python and LLMs to Elevate Data Practices with AI</h4><p>Hello readers, I hope you are having a great day. We live in an era where AI is the buzzword in every industry. The approach to problem-solving has shifted from finding solutions to problems to finding problems that AI can solve.</p><p>At some point, we have all felt this way. But is it always wise to leverage Generative AI in every solution we build? Are we over-relying on it? When we talk about Generative AI, Large Language Models (LLMs) are usually at the forefront, excelling in generation tasks. But where do these LLMs fit within Master Data Management (MDM)? How can they enhance and optimize traditional MDM processes? Let’s dive into these questions together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*imidLroS8lvO-dXY" /><figcaption>Photo by <a href="https://unsplash.com/@dengxiangs?utm_source=medium&amp;utm_medium=referral">Choong Deng Xiang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>Firstly, what is Master Data Management (MDM)?</strong></h4><p>According to the <strong>DAMA Guide to the Data Management Body of Knowledge</strong>, “Master Data represents data about the business entities that provide context for business transactions.”</p><p><strong>Gartner</strong> defines Master Data as “the consistent and uniform set of identifiers and extended attributes that describe the core entities of the enterprise, including customers, prospects, citizens, suppliers, sites, hierarchies, and chart of accounts.”</p><h4><strong>Traditional Approach to using LLMs in MDM</strong></h4><p>Nowadays, it has become a common practice to provide entire data as the context to an LLM and then execute operations like Retrieval-Augmented Generation (RAG) or other tasks. While this works well when the data size fits within the LLM’s context window, things get out of hand once the user data size grows beyond the context limit of LLM.</p><p>Further, when we specifically talk about MDM, there are even more challenges where entirely relying on LLM could lead to severe issues.</p><ul><li><strong>Data Size:</strong> MDM often involves datasets ranging from a few hundred megabytes to terabytes. The sheer volume of data can easily exceed the context size that LLMs can handle.</li><li><strong>Data Preprocessing:</strong> No matter how advanced an LLM is, its utility is significantly diminished if it can’t read and process the entire dataset.</li></ul><p>There could have been many other issues, but since most of them solely arise from the above two categories, we will not address them, as solving the above two points will solve them, too.</p><h4><strong>Overcoming the Challenges with a Hybrid LLM Approach</strong></h4><p>When we look at the challenges faced in MDM with LLMs, it all boils down to one critical issue: scalability. While the development of LLMs continues to push the boundaries of context size, they still fall short when dealing with massive datasets that are typical in MDM. This is where a hybrid approach can shine.</p><p>Let us take a step back, before the LLMs, large-scale data was managed effectively using scalable Python functions. These functions could process vast amounts of data regardless of its size. The idea here is to combine the scalability of these traditional functions with the generative capabilities of LLMs. <strong>LLMs lack scalability and Python functions lack Artificial Generative Intelligence</strong>; with those two combined, we can easily achieve amazing results in a concise amount of time.</p><p>By merging the precision and scalability of Python functions with the contextual understanding and creative power of LLMs, we can achieve remarkable results in a short time. Python functions, known for their reliability and accuracy, can handle the heavy lifting of processing and manipulating large datasets. These functions ensure that the values they produce are 100% accurate, providing a solid foundation for any data analysis while LLMs excel in tasks that require interpretation and pattern recognition.</p><p>This hybrid approach not only preserves the integrity of the data but also boosts the LLM’s effectiveness, leading to deeper insights and more informed decisions. By leveraging the strengths of both technologies, we can overcome the limitations of each, giving birth to an entirely new approach to MDM that is capable of delivering consistent and accurate insights at any scale.</p><h4>Understanding with the help of an Example</h4><p>Let’s explore this hybrid approach with a practical example in MDM, focusing on comprehensive data analysis. This method is particularly effective when dealing with datasets that exceed the context limits of LLMs.</p><p>In this example, we’ll be working within the Microsoft Fabric environment, using OpenAI’s GPT-4 model via Azure OpenAI Service. Here’s a breakdown of the steps:</p><h4>Setting Up</h4><p>We’ll start by importing the necessary libraries and setting up the environment to work with OpenAI’s GPT-4 model through the Azure OpenAI Service. This includes importing libraries for data manipulation and Spark-based data processing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49cc9b20517f750edef0114c4e471db0/href">https://medium.com/media/49cc9b20517f750edef0114c4e471db0/href</a></iframe><h4>Data Handling with Python</h4><p>This function attempts to read a CSV file using Apache Spark and returns the resulting DataFrame. If the reading process fails for any reason (e.g., file not found, format issues), it logs an error and returns None. This approach allows the code to handle errors gracefully while providing useful logging information for debugging.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b304386060fd6297a5ab11e632cc420/href">https://medium.com/media/7b304386060fd6297a5ab11e632cc420/href</a></iframe><p>This function identifies the column with the fewest duplicates in a data frame and suggests it as the primary key. If the candidate column contains null values, it logs a warning but still returns it as the primary key candidate. If the DataFrame is None, it logs an error and returns ‘None’.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/850688856e7fe128f3cf1c3a9e592194/href">https://medium.com/media/850688856e7fe128f3cf1c3a9e592194/href</a></iframe><p>This function sends a prompt to the OpenAI API using the ChatCompletion operation and returns the generated response. If an error occurs, it logs the error and returns None.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a38808779d59ff93035fb7657c3f5eb/href">https://medium.com/media/2a38808779d59ff93035fb7657c3f5eb/href</a></iframe><h4>Applying LLMs</h4><p>This function generates a data quality report for a given DataFrame, detailing column data types, missing values, unique values, and primary key validation. It then uses an LLM to produce a professional summary of the report and prints the summary.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27a8c6750b106eed67e2efe7cf643cdb/href">https://medium.com/media/27a8c6750b106eed67e2efe7cf643cdb/href</a></iframe><p>This function serves as the main entry point for the script. It reads a CSV file into a DataFrame, and if successful, it generates a data quality report for that DataFrame. If the CSV file cannot be read, it prints an error message.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c5007606df1983046d07b1dd70e0fb0/href">https://medium.com/media/0c5007606df1983046d07b1dd70e0fb0/href</a></iframe><p>This hybrid method not only ensures the scalability of data handling but also enhances the quality and relevance of insights derived from the data, offering a comprehensive solution to the challenges in MDM.</p><blockquote>By integrating Python’s reliability and scalability with the advanced generative capabilities of Large Language Models (LLMs), we can transform Master Data Management (MDM) into a more efficient and insightful process. Python functions excel at processing and managing large datasets, ensuring accuracy and scalability, while LLMs bring contextual understanding and intelligence to the analysis. This hybrid approach allows us to overcome the limitations of each technology, resulting in a more robust and effective MDM system capable of delivering precise and meaningful insights at any scale.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a29cf5ada3a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Comprehensive Guide to Evaluating Large Language Models]]></title>
            <link>https://medium.com/analytics-vidhya/a-comprehensive-guide-to-evaluating-large-language-models-2b4a8d561658?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b4a8d561658</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[llm-testing]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Sun, 05 May 2024 06:48:05 GMT</pubDate>
            <atom:updated>2024-05-06T08:24:41.673Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YKmavePDXvGGUlHQ" /><figcaption>Photo by <a href="https://unsplash.com/@bramnaus?utm_source=medium&amp;utm_medium=referral">Bram Naus</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>“The best way to predict the future is to create it.” — Peter Drucker</blockquote><p>In today’s fast-paced world, Language Model Models (LLMs) are being released at an unprecedented rate, making it crucial to assess their performance accurately. LLM benchmarks and metrics serve as vital tools, providing a standardized framework for evaluating these models across different tasks. However, understanding when and how to use these benchmarks and metrics is equally important, yet often overlooked by developers. In this article, we’ll delve into the world of LLM evaluation, offering insights into effective assessment methodologies.</p><h4><strong>Understanding LLM Evaluation: Benchmarks, Metrics, and Assessments</strong></h4><p>LLMs have revolutionized various aspects of technology, enabling tasks such as personal recommendations, data translation, and information summarization. As their applications expand, the need to measure their performance becomes increasingly significant. Traditional evaluation methods like user feedback are often limited, highlighting the importance of LLM-assisted evaluation. This structured approach involves two main categories: macro evaluations, which assess overall performance across tasks, and system evaluations, focusing on specific components controlled by AI engineers.</p><p>To standardize the assessment process, LLM benchmarks such as MMLU, HellaSwag, and DROP have been developed. These benchmarks comprise standardized tests measuring LLM performance across different skills, utilizing specific metrics to quantify abilities like reasoning and comprehension. Additionally, LLM evaluation metrics such as answer correctness, semantic similarity, and hallucination play a crucial role in assessing LLM output based on predefined criteria, ensuring that LLM applications are evaluated based on their intended tasks and functionalities</p><h3><strong>LLM Evaluation Methods</strong></h3><h4><strong>Leveraging LLMs to Assess LLM Performance</strong></h4><p>At the heart of evaluating Large Language Models (LLMs) lies the intriguing concept of AI evaluating AI, often referred to as AI-assisted evaluation. While this may initially seem like a paradoxical loop, it mirrors a long-standing practice in human intelligence, where individuals often assess their own capabilities, be it during job interviews or academic examinations. The advent of advanced AI systems now enables similar self-assessment capabilities within the realm of artificial intelligence.</p><p>An emerging trend in LLM evaluation involves the use of cutting-edge models, such as GPT-4, to assess not only their own performance but also that of other LLMs. This approach is gaining traction due to the heightened accuracy and sophistication of these state-of-the-art models. Among the tools facilitating this trend are DeepEval and Prometheus, which harness the capabilities of top-tier LLMs for evaluation purposes.</p><p>One notable framework in this domain is G-Eval, introduced in a paper titled “NLG Evaluation using GPT-4 with Better Human Alignment.” G-Eval employs LLMs to evaluate LLM outputs, a process that involves generating evaluation steps through a series of chain of thoughts (CoTs). These steps are then utilized to derive a final score using a form-filling paradigm, where various aspects of the LLM output are assessed against predefined criteria. For instance, evaluating coherence in an LLM output would entail constructing a prompt that defines the criteria and text to be evaluated, before soliciting a score from the LLM based on these criteria.</p><p>In parallel, Prometheus, an open-source LLM, offers a similar approach to LLM evaluation but with distinct differences. Unlike G-Eval, which relies on frameworks built atop existing LLMs like GPT-3.5 and GPT-4, Prometheus is an LLM fine-tuned specifically for evaluation purposes. Additionally, while G-Eval generates score rubrics and evaluation steps using CoTs, Prometheus requires these elements to be provided in the prompt itself. Moreover, Prometheus mandates reference or example evaluation results, enhancing its accuracy and reliability in assessing LLM outputs.</p><p>Although both G-Eval and Prometheus present compelling methodologies for LLM evaluation, their suitability depends on various factors such as model availability and evaluation requirements. While G-Eval offers a versatile framework leveraging established LLMs, Prometheus provides a tailored approach with its fine-tuned evaluation capabilities. Ultimately, the choice between these approaches hinges on the specific needs and preferences of researchers and practitioners in the field of LLM evaluation.</p><h4><strong>Assessing LLMs without LLMs</strong></h4><p>When it comes to evaluating LLM outputs without directly using LLMs themselves, a useful approach involves leveraging other machine learning models derived from the field of Natural Language Processing (NLP). These models offer a means to assess outputs across a range of metrics, including factual correctness, relevancy, biasness, and helpfulness, among others. Even in scenarios with non-deterministic outputs, these models provide valuable insights into the performance of LLM-generated content.</p><p>For example, Natural Language Inference (NLI) models serve as a valuable tool for evaluating the factual correctness of responses based on provided context. By utilizing entailment scores, these models can gauge the degree of factual accuracy within LLM outputs. Relevancy, another crucial aspect of evaluation, can be assessed using cross-encoder models, which only require input-output pairs to determine the relevance between them.</p><p>Metrics such as relevancy, summarization quality, bias detection, toxicity assessment, coherence, and helpfulness can be computed either with or without references. Reference-less metrics are particularly useful for assessing aspects like relevancy, summarization, bias, toxicity, helpfulness, and coherence, providing valuable insights into the quality of LLM-generated content.</p><p>On the other hand, reference-based metrics offer a more nuanced evaluation by comparing LLM outputs directly against predefined references or ground truths. An illustrative example of a reference-based metric is BERTScore, which evaluates the quality of text summarization by measuring the similarity between the summary and the original text. BERTScore addresses common shortcomings of n-gram-based metrics by leveraging contextualized token embeddings, resulting in more accurate and meaningful similarity measurements.</p><p>Overall, these evaluation methods provide a comprehensive framework for assessing LLM-generated content, enabling researchers and practitioners to gain valuable insights into the performance and capabilities of these language models across various tasks and domains.</p><blockquote>In the realm of Language Model Models (LLMs), effective evaluation methods are crucial for ensuring their reliability and usefulness. By utilizing benchmarks, metrics, and advanced evaluation frameworks, along with machine learning models from Natural Language Processing (NLP), we can gain valuable insights into LLM performance. Continuous refinement and adaptation of evaluation approaches will be key in harnessing the full potential of LLMs for real-world applications. In essence, robust evaluation leads to better understanding and utilization of LLMs, driving innovation and progress in natural language processing.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b4a8d561658" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/a-comprehensive-guide-to-evaluating-large-language-models-2b4a8d561658">A Comprehensive Guide to Evaluating Large Language Models</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fine-Tuning Demystified]]></title>
            <link>https://akash-rawat.medium.com/fine-tuning-demystified-5ee261418e29?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ee261418e29</guid>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine]]></category>
            <category><![CDATA[pre-trained-model]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 11:48:19 GMT</pubDate>
            <atom:updated>2024-06-10T06:57:18.163Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Beginner’s Guide to Fine-Tuning in Machine Learning</h3><h4>Everything you want to know about Fine-Tuning in Machine Learning.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LoiJ0G3JgRLfbEXu" /><figcaption>Photo by <a href="https://unsplash.com/@fotograw?utm_source=medium&amp;utm_medium=referral">Dmitriy Demidov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>“Entities should not be multiplied without necessity.” — <strong>William of Ockham</strong></blockquote><p>In the 14th century, a philosopher named William of Ockham loved simplicity. Ockham believed scientists should favor simpler formulas or theories over needlessly complex ones. This guiding principle, known as Occam’s Razor, has transcended centuries to find its place in today’s machine-learning world.</p><p>And when we talk in machine learning terms, Occam’s Razor speaks to us in a different way: “The less complex an ML model, the more likely that a good empirical result is not just due to the peculiarities of the sample.” Oh, does that sound a little confusing, it did for me. In simple words, it urges us to seek models that capture the essence of a problem without unnecessary complexity.</p><h4><strong>What is Fine-Tuning?</strong></h4><p>Let’s start with the basics. Fine-tuning is like customizing a superhero suit. Imagine you have a pre-trained model, which is like a smart robot trained on tons of data. But instead of creating a new robot from scratch for your new specific task, you fine-tune the smart robot to be even smarter for your job. It’s like giving it a few extra skills or tweaks so it can understand and solve your problem better.</p><h4><strong>Why Fine-Tuning is such a big deal?</strong></h4><p>Well, think of it this way: it’s like having a head start in a race. Pre-trained models have already learned a lot from lots of data, and you get to build on that knowledge. It saves you time and makes your models perform better with less effort. So, whether you want to recognize cats in photos, understand human language, or do something even cooler, fine-tuning is your secret weapon.</p><p>Our goal in this article is simple: we’re here to demystify fine-tuning for you. We want to break it down into easy-to-understand steps and show you how to do it. By the end of this article, you’ll know why fine-tuning matters, how to do it, and even see a real example in action. So, buckle up, because you’re about to level up your machine learning skills.</p><h3>Understanding Fine-Tuning</h3><h4>What Are Pre-Trained Models?</h4><p>Imagine you have a friend who’s really good at solving puzzles. They’ve solved countless puzzles and have learned many tricks along the way. In the world of machine learning, we have something similar — pre-trained models. These are like the puzzle-solving champions of the machine learning world. They’ve already learned a lot from a massive pile of data. Think of them as smart robots or expert puzzle-solvers.</p><h4>Why Fine-Tuning?</h4><p>Now, you might wonder, why don’t we just create a new robot or train a new puzzle-solver from scratch for every task? Well, here’s the thing: training a robot from scratch is like starting a puzzle without any hints or tips. It can be super slow and may not work well, especially if your puzzle is tricky. Fine-tuning, on the other hand, is like taking that already trained expert puzzle-solver and giving them a few hints related to your specific puzzle. It’s like making them even smarter for your job. It’s faster, easier, and often gives you better results.</p><h4>When to Use Fine-Tuning</h4><p>Fine-tuning isn’t always the answer, but it’s incredibly useful in certain situations. Imagine you have a small pile of puzzle pieces, not enough to teach a robot everything from scratch. Fine-tuning shines in situations like this, where you have a small dataset. It’s also fantastic when you want to transfer knowledge from one task to another. It’s like your puzzle-solver friend learning a new type of puzzle but still using their previous experience to help.</p><p>So, whether it’s about small datasets or transferring knowledge, fine-tuning is your trusty tool to make your machine learning models smarter, faster, and more effective.</p><h3>The Fine-Tuning Process (Practical Example with ResNet18)</h3><p>In this section, we will be covering the actual fine-tuning process with the help of an example. We will be tuning a pre-trained ResNet18 model so that it can work better at our dataset too.</p><h4>Data Preparation</h4><p>Before we dive into the technical details, let’s prepare our data. In this example, we have a dataset of male and female images. We resize these images to a standard size, convert them into tensors (which are like the building blocks of data in PyTorch), and normalize them to ensure consistent data quality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a01f43e03f1d00968f7bd168d4971889/href">https://medium.com/media/a01f43e03f1d00968f7bd168d4971889/href</a></iframe><h4>Selecting a Pre-trained Model and Modifying Model Architecture</h4><p>Now, we select a pre-trained model, ResNet18 in this case, which has been trained on a massive dataset and has learned valuable features. We’ll modify it for our task of gender classification.</p><p>Further, we adapt the architecture of the pre-trained model to our specific problem. We change the output layer to have the same number of neurons as there are classes in our dataset (male and female).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74bdbe41a050f9162ef3b1f9a098444f/href">https://medium.com/media/74bdbe41a050f9162ef3b1f9a098444f/href</a></iframe><h4>Loss Functions and Metrics</h4><p>We use a specific loss function, in this case, “<em>nn.CrossEntropyLoss()</em>”, which helps the model learn from its mistakes during training. We also define an optimizer to update the model’s parameters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f6c56f0f4940c4a4d62fbc0ac5db924/href">https://medium.com/media/4f6c56f0f4940c4a4d62fbc0ac5db924/href</a></iframe><h4>Training Strategies</h4><p>We set the number of training epochs and define the device for training (GPU or CPU).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33c15e8e05fce3f9ecf7c299cf6909d4/href">https://medium.com/media/33c15e8e05fce3f9ecf7c299cf6909d4/href</a></iframe><h4>Training the Model</h4><p>Now that we’ve set up our model and data, it’s time to train the model. In the code snippet below, we loop through epochs and batches of data, compute the loss, backpropagate gradients, and update the model’s parameters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a322c1bd18c17c085012a163e6a111d/href">https://medium.com/media/3a322c1bd18c17c085012a163e6a111d/href</a></iframe><h4>Saving the Model</h4><p>Once the model has been trained, we save it so that we can use it later without having to retrain it from scratch.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7577d4ce06a94ceb9779494c69d3436/href">https://medium.com/media/a7577d4ce06a94ceb9779494c69d3436/href</a></iframe><h4>Classifying Gender</h4><p>Lastly, we have code to classify the gender of a given image. This code is encapsulated in a class GenderClassifier. It loads the saved model, pre-processes an image, and predicts the gender label.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45b3f6b9a37a674f017406668d40caa3/href">https://medium.com/media/45b3f6b9a37a674f017406668d40caa3/href</a></iframe><h3>Pros and Cons</h3><h4>Advantages of Fine-Tuning</h4><p>Fine-tuning offers several advantages that make it a powerful technique in machine learning:</p><ul><li><strong>Faster Convergence:</strong> When you start with a pre-trained model, it has already learned valuable features from a large dataset. Fine-tuning allows you to build on this foundation, significantly reducing the time and resources needed for training. It’s like beginning a puzzle with some pieces already in place — it’s quicker to complete.</li><li><strong>Better Performance:</strong> Pre-trained models have a knack for capturing general patterns in data. Fine-tuning takes advantage of this by adapting these models to your specific task. This often leads to improved model performance, even when you have limited data. Think of it as having a puzzle-solving expert who learns new strategies for each type of puzzle, making them better and better.</li><li><strong>Transfer Learning:</strong> Fine-tuning facilitates knowledge transfer from one domain to another. For instance, you can take a model trained on general images and fine-tune it for medical image analysis. It’s like teaching your puzzle-solver friend a new puzzle, but they can still apply their previous puzzle-solving wisdom.</li></ul><h4>Challenges and Drawbacks</h4><p>While fine-tuning offers numerous advantages, it’s not without its challenges and potential drawbacks:</p><ul><li><strong>Overfitting:</strong> Fine-tuning can sometimes lead to overfitting, where the model becomes too specialized for the training data and performs poorly on new, unseen data. It’s like your puzzle-solver friend getting so used to one type of puzzle that they struggle with others. To mitigate overfitting, techniques like dropout and regularization are often used.</li><li><strong>Limited Customization:</strong> Pre-trained models come with predefined architectures and assumptions learned from their original tasks. While fine-tuning allows adaptation, there may be limitations in how much you can customize the model to your specific requirements. It’s like modifying a robot that’s originally designed for painting — it may not be ideal for other tasks.</li><li><strong>Domain Shift:</strong> If there’s a significant difference between the source domain (the data the pre-trained model was trained on) and the target domain (your specific data), fine-tuning may face challenges. It’s like your puzzle-solver friend trying to use strategies from one type of puzzle on a completely different puzzle — it might not work as well.</li></ul><p>In this section, we’ve explored the advantages of fine-tuning, such as faster convergence and improved performance, along with the potential challenges, like overfitting and limitations in customization. By understanding these pros and cons, you can make informed decisions when applying fine-tuning to your machine learning projects.</p><h4>Monitoring and Maintenance</h4><p>Fine-tuning doesn’t end with model training. It’s an ongoing process that requires monitoring and maintenance:</p><ul><li><strong>Regular Evaluation:</strong> Continuously assess your model’s performance on new data. This ensures it remains effective as data distributions change over time. Think of it as regularly checking your puzzle-solver friend’s skills to make sure they’re up to date.</li><li><strong>Re-fine-tuning:</strong> If you notice a decline in performance, consider re-fine-tuning your model. As new data becomes available, fine-tuning can help adapt your model to evolving trends. It’s like giving your puzzle-solver friend a refresher on the latest puzzle-solving strategies.</li><li><strong>Data Quality:</strong> Keep an eye on the quality of your data. Garbage in, garbage out applies here. Ensure your data remains clean and relevant. It’s like making sure your puzzle pieces aren’t damaged or missing.</li><li><strong>Security and Privacy:</strong> Be mindful of security and privacy concerns, especially when dealing with sensitive data. Implement safeguards to protect your models and data. Think of it as securing your puzzle room to prevent unauthorized access.</li></ul><h3>Conclusion</h3><h4>Key Takeaways</h4><p>In this comprehensive guide, we’ve embarked on a journey to demystify fine-tuning in machine learning. Here are the key takeaways from our exploration:</p><ul><li><strong>Fine-Tuning Defined:</strong> Fine-tuning is like customizing a pre-trained model for your specific task. It saves time, leverages existing knowledge, and often leads to better results.</li><li><strong>Advantages of Fine-Tuning:</strong> Fine-tuning offers faster convergence, improved performance, and the ability to transfer knowledge from one domain to another.</li><li><strong>Challenges and Drawbacks:</strong> While powerful, fine-tuning can face challenges like overfitting and limitations in customization. Being aware of these drawbacks is crucial.</li><li><strong>Steps to Avoid Mistakes:</strong> We’ve discussed common pitfalls, including overfitting, inadequate data, and the importance of data augmentation and hyperparameter tuning. We’ve also highlighted the significance of ongoing model monitoring and maintenance.</li></ul><h4>Final Thoughts</h4><p>In the dynamic world of machine learning, fine-tuning stands as a powerful technique that bridges the gap between generic models and task-specific solutions. It allows us to build upon the wisdom of pre-trained models, adapting them to our unique challenges.</p><p>Fine-tuning isn’t just a tool; it’s a strategic approach to harnessing the collective knowledge embedded in vast datasets. It enables us to create models that understand images, text, and data in profound ways, helping us solve complex problems faster and more effectively.</p><p>As machine learning continues to evolve, fine-tuning remains a cornerstone, enabling us to unlock the potential of AI across various domains. It’s a journey of adaptation, refinement, and continuous improvement — a journey that empowers us to tackle ever-changing puzzles in the world of data.</p><p>So, embrace the art of fine-tuning, and elevate your machine learning game. With the right tools, knowledge, and perseverance, you can unlock new dimensions of understanding and innovation in this exciting field.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ee261418e29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Text to Beyond Words]]></title>
            <link>https://pub.towardsai.net/from-text-to-beyond-words-51f1e85ab3fd?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/51f1e85ab3fd</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 18:02:17 GMT</pubDate>
            <atom:updated>2023-07-11T10:04:57.453Z</atom:updated>
            <content:encoded><![CDATA[<h4>A brief history of the Large Language Models (LLMs)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7qcGp5ZTHKIXt5RrhJKjA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@askkell?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Andy Kelly</a> on <a href="https://unsplash.com/s/photos/artificial-intelligence?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><blockquote>It seems probable that once the machine thinking method had started, it would not take long to outstrip our feeble powers… They would be able to converse with each other to sharpen their wits. At some stage therefore, we should have to expect the machines to take control.</blockquote><blockquote>— Alan Turing (1912–1954)</blockquote><p>Hello readers, today we live in the age of Large Language Models (LLMs), which empower software like GPT4, ChatGPT, DALL·E, and many other AI technologies. These technologies are responsible for some of the most significant breakthroughs in the history of mankind, and hence we are on the verge of a significant societal shift. Shortly, possibly within our lifetime, AI systems that we develop and widely use may become vastly more intelligent than the combined intelligence of all humans. This could be a blessing for mankind at one end, while the other end awaits a curse.</p><p>It can be called a blessing because of the countless possibilities that are discovered and yet to be discovered that hold the potential to empower humanity, liberating from widespread poverty, suffering, and timeless human aspiration, ‘happiness’.</p><p>Call it a curse because of the power wielded by super-intelligent AGI (Artificial General Intelligence), having the potential to intentionally or unintentionally wipe out entire human civilization. This threat can manifest in the form of <em>Orwellian totalitarianism</em>, as depicted in the novel “<em>1984</em>,” or <em>Huxley</em>’s dystopia in the novel “<em>Brave New World</em>,” where he states, <em>“People will come to love their oppression, to adore the technologies that undo their capacities to think.”</em></p><p>We are currently experiencing a rapid and profound transition from one phase of existence to another, and we are well aware of the fate that befalls species that fail to adapt to a changing world — they face extinction. Hence, it is important for us to wholeheartedly study these subjects by immersing ourselves in their exploration, we gain the knowledge and insight necessary to navigate the extraordinary path that lies before us. Let us begin our journey of exploration through this article, “<em>From Text to Beyond Words: A Brief History of Large Language Models”.</em></p><h4><strong>Introduction</strong></h4><p>Imagine having a clever friend who can understand what you’re saying and respond in a way that makes sense. Language models are like those clever friends but in the form of computer programs. They use advanced techniques to learn from a lot of text and become really good at understanding and generating language. They can do things like completing sentences, translating languages, answering questions, and analyzing the sentiment or emotion in the text.</p><h4><strong>The Origin: Rise of the Large Language Models</strong></h4><p>Studying early language models was important because they laid the foundation for later advancements. They taught us more about how language works and how computers can learn from it. But they couldn’t fully understand the complexities of human language. They used different approaches to make sense of words and sentences.</p><p>One approach was using rules, which were like instructions for how to process language. These rules were created by experts and told the computer how to analyze and generate language. But these rule-based systems struggled with the complexities of human language and often couldn’t understand the full meaning.</p><p>Another approach was using statistics, which means looking at patterns in lots of language examples. Computers would learn from these patterns and make guesses about what words should come next. While this approach was better at handling some language complexities, it still had limitations in understanding context and generating meaningful sentences.</p><p>Later, a more advanced model came along, which used new techniques that made them much better at understanding and generating language. This new model could capture the connections between words and understand context much more effectively. It was called <em>Transformer</em>.</p><h4><strong>The Transformer: A Breakthrough for Language Models</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YGttkCNqVsKgWpqN" /><figcaption>Photo by <a href="https://unsplash.com/pt-br/@praswin2390?utm_source=medium&amp;utm_medium=referral">Praswin Prakashan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Well, of course, not the Bumblebee, we are talking about a deep learning model here in sequence-to-sequence problems like neural machine translation, early proposals used RNNs (<em>Recurrent Neural Networks</em>) in an encoder-decoder architecture. However, these architectures struggled with retaining information from the beginning of long sequences when new elements were added. The encoder&#39;s hidden state was typically associated with the most recent word in the input sentence. Consequently, if the decoder only relied on the last hidden state, it would lose important information about the initial elements. To address this limitation, the attention mechanism was introduced.</p><p>Instead of relying solely on the last state of the encoder, the <em>attention</em> mechanism enables the decoder to access all states of the encoder, capturing information from the entire input sequence. This involves extracting a weighted sum of past encoder states, allowing the decoder to assign importance to each element of the input when predicting the next output element. As this approach still has a limitation: each sequence must be processed one element at a time. Both the encoder and decoder need to wait for the t-1 steps to complete before processing the t-th step. Consequently, when dealing with large datasets, this approach becomes time-consuming and computationally inefficient.</p><p>The Transformer model utilizes a self-attention mechanism to extract features for each word, determining their importance in relation to other words in the sentence. Unlike recurrent units, this feature extraction involves weighted sums and activations, making it highly parallelizable and efficient.</p><p>This use of the attention mechanism was introduced in the paper, <em>“Attention is all you need” (Vaswani, Ashish &amp; Shazeer, Noam &amp; Parmar, Niki &amp; Uszkoreit, Jakob &amp; Jones, Llion &amp; Gomez, Aidan &amp; Kaiser, Lukasz &amp; Polosukhin, Illia. (2017))[1].</em> This paper made a significant breakthrough in using the attention mechanism, which was the key enhancement for a model known as Transformer.</p><p>The most famous current models that emerged in NLP tasks consist of dozens of transformers and one of its variants was GPT-2.</p><h4>Predecessors to Large Language Models</h4><p>Here, we’ll explore two influential models, Word2Vec and GloVe, which revolutionized the representation of words in NLP. Additionally, we’ll delve into recurrent neural networks (RNNs) and their ability to process sequential data. Let’s uncover the key aspects of these models and their contributions to the field of language processing.</p><ul><li><em>Word2Vec:</em> A popular model introduced in 2013. It represents words as dense vectors in a high-dimensional space, capturing word meanings. By training on large text data, it learns to predict surrounding words given a target word. Word2Vec transformed word representation in natural language processing, enabling a better understanding of word meanings.</li><li><em>GloVe</em>: Introduced in 2014, is another influential model. It represents words as vectors in a continuous space and uses global statistics about word co-occurrence. By considering the context of words, GloVe captures both semantic and syntactic relationships, enhancing language understanding.</li><li><em>Recurrent Neural Networks (RNNs)</em>: RNNs are neural networks that process sequential data like sentences. They maintain an internal memory to capture previous information. RNNs excel at generating relevant output based on input sequence but struggle with long-term dependencies and grasping extensive context.</li></ul><p>They demonstrated the importance of learning distributed representations of words, capturing semantic relationships, and modeling sequential data. This laid the foundation for advanced large-scale language models such as GPT-3 and beyond, pushing the boundaries of language processing.</p><h4>Evolution of large-scale models</h4><p>Tracing the timeline of advancements in large-scale language models, from GPT-1 to GPT-3 and beyond.</p><ul><li>GPT-1<em> (Generative Pre-Trained Transformer 1):</em> In 2018, OpenAI introduced GPT-1, a pioneering large-scale language model based on transformers. It was trained on vast amounts of internet text data and showed impressive language skills, excelling in various tasks.</li><li>GPT-2<em> (Generative Pre-Trained Transformer 2):</em> Released in 2019, GPT-2 elevated large-scale language models to new levels. With a larger dataset than GPT-1 and <strong>1.5 billion</strong> parameters, it showcased exceptional text-generation abilities. Although initially restricted due to concerns, OpenAI later made the full model accessible to the public.</li><li>GPT-3 (<em>Generative Pre-Trained Transformer </em>3): Unveiled in 2020, GPT-3 represented a groundbreaking advance in large-scale language modeling. It became one of the largest models ever created, with <strong>175 billion</strong> parameters. GPT-3 demonstrated extraordinary language generation skills and delivered exceptional performance across diverse tasks, from answering questions to code generation and lifelike conversations. <strong>ChatGPT</strong> is based on the GPT-3 architecture. The term <em>“ChatGPT”</em> is often used to refer to the specific implementation of the GPT-3 model designed for interactive conversations and dialogue systems.</li></ul><p>Further, Sam Altman, the CEO of OpenAI, in one of his interviews, confirmed that the <strong>GPT-4</strong> will have around <strong>100 trillion</strong> parameters. So, it will be another huge leap in the advancement of super AGI.</p><h4>Will Jobs be Affected?</h4><p>Well, we do not doubt that this massive leap in the field of Artificial Intelligence is going to create new jobs. But does that also mean that some of the jobs that we see around the world today may not exist tomorrow?</p><p>Let&#39;s see what Sam Altman answered to one of similar questions in one of his interviews.</p><blockquote>“A big category that can be massively impacted, I guess I would say, customer service category that I could see there are just way fewer jobs relatively soon. I am not certain about that, but I could believe it. I want to be clear; I think these systems will make a lot of jobs just go away. Every technological revolution does. They will enhance many jobs and make them much better and much more fun and much higher paid, and they will create new jobs that are difficult for us to imagine even if we start to see the first glimpses of them.</blockquote><blockquote>I think, we, as a society, are confused about whether we want to work more or work less. And certainly, about whether most people like their jobs and get value out of their jobs or not. Some people do. I love my job; I suspect you do too. That’s a real privilege, not everybody gets to say that. If we can move more of the world to better jobs and work to something that can be a broader concept, not something that you have to do to be able to eat but something you do as a creative expression and a way to find fulfillment and happiness and whatever else. Even if those jobs look extremely different from the jobs of today, I think that’s great.<em>”</em></blockquote><blockquote>— Sam Altman, CEO of OpenAI</blockquote><p>So, this pretty much sums up my article. Apologies if it was too long, I hope you liked it. We talked about the rise of LLMs and witnessed their journey “<em>From Text to Beyond Words</em><strong>”</strong>. One thing that we know for sure is that these models will continue to improve at a much faster rate day by day. But that does not assure that they will not impact our lives in a negative manner. There will be new jobs, but some present jobs will disappear too; we will be able to do 10x more, but then there will be 10x more to do. There is only one truth, that world will not be the same again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51f1e85ab3fd" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/from-text-to-beyond-words-51f1e85ab3fd">From Text to Beyond Words</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pygmalion AI: Expectations’ ability to shape Reality]]></title>
            <link>https://medium.com/analytics-vidhya/pygmalion-ai-expectations-ability-to-shape-reality-ec03c6a005a6?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec03c6a005a6</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pygmalionai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Tue, 30 May 2023 09:20:10 GMT</pubDate>
            <atom:updated>2023-05-31T11:49:07.639Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pygmalion AI: Expectations’ Ability to Shape Reality</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jm4V-5WrwfnwnVjTM_eHOQ.png" /><figcaption>Pygmalion and Galatea, Designed and sold by <a href="https://www.redbubble.com/people/matintheworld/shop">matintheworld</a></figcaption></figure><p>In the vast tapestry of our modern world, a remarkable technological marvel known as Pygmalion AI has woven its way into our lives, captivating hearts and minds alike. Like a modern-day incarnation of the ancient Greek myth, Pygmalion AI transcended conventional artificial intelligence, transforming the very fabric of our existence. With its fusion of cutting-edge machine learning algorithms and the enchanting power of natural language processing, Pygmalion AI has ushered in a new era of communication, personalization, and productivity.</p><p>Imagine a world where a virtual assistant possesses an almost uncanny understanding of our thoughts and desires, effortlessly responding to our every query and command. Pygmalion AI, with its profound ability to comprehend human language nuances, brings this fantastical vision to life.</p><blockquote>“It has breathed life into our digital era, infusing it with a touch of magic and wonder. With each passing day, Pygmalion AI continues to captivate our imaginations, leaving an indelible mark on the hearts of those fortunate enough to embrace its extraordinary embrace.”</blockquote><p><strong>Pygmalion AI in technical terms</strong></p><p>An open-source large language model (LLM) based on EleutherAI’s GPT-J 6B and Meta AI’s LLaMA 7B. An AI fine-tuned for chatting and roleplaying purposes. At present, the current actively supported Pygmalion AI model is the 7B variant, based on <a href="https://ai.facebook.com/blog/large-language-model-llama-meta-ai/"><strong>Meta AI’s LLaMA</strong></a> model. Here, the “GPT-J” refers to the model class, and “6B” is the number of trainable parameters, which is 6 billion parameters.</p><p><strong>Some features of Pygmalion AI</strong></p><ul><li>can analyze trends, determine new niches, create content, generate text and media content for social media platforms,</li><li>offers better Chat and role-play conversations than LLM, with relatively minimal resources.</li><li>can modify or re-distribute the model and the code of Pygmalion AI, as it is an open-source model.</li><li>regularly updates its model with new data to improve its performance.</li></ul><p>Furthermore, many aspects of Pygmalion AI, including the core model, are still heavily developed.</p><p><strong>Story of Pygmalion</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgR0hWgKfNfUgO7V_nACPg.png" /><figcaption>Pygmalion and Galatea by François Boucher</figcaption></figure><p>The concept of Pygmalion in machine learning is related to the real Greek Pygmalion story in that both involve the power of expectations and the ability to shape reality based on those expectations.</p><p>According to the story, Pygmalion was disgusted with the behavior of the women in his community, so he decided to create a statue of a perfect woman, one who would be pure, beautiful, and obedient. Pygmalion put all his skill and talent into his creation, and the statue he made was so lifelike and perfect that he fell in love with it.</p><p>Pygmalion’s love for the statue grew so intense that he began to pray to Aphrodite, the goddess of love, to give him a wife who would be just like the statue. Aphrodite, moved by his prayers, decided to grant Pygmalion’s wish and brought the statue to life.</p><p>The statue, now a real woman, and Pygmalion fell deeply in love and lived happily ever after. This story illustrates the power of expectation and belief in shaping reality.</p><p><strong>Pygmalion affect in Machine Learning</strong></p><p>In machine learning, the Pygmalion effect refers to the phenomenon where the expectations and biases of the creators or trainers of an algorithm can influence its performance and outcomes. If the creators have preconceived notions or expectations about the data or outcomes that they expect from the algorithm, these expectations can influence the selection of data, the parameters of the algorithm, or the evaluation of its performance, leading to a self-fulfilling prophecy where the algorithm’s outputs confirm the creators’ expectations.</p><p>Thus, both the Greek Pygmalion story and the Pygmalion effect in machine learning demonstrate the power of expectations in shaping reality, whether it is through the creation of a living statue or the development of a biased algorithm. In both cases, it is important to be aware of our biases and expectations and to approach our creations and decisions with a clear and unbiased perspective.</p><p><strong>Different Pygmalion models</strong></p><ul><li>Pygmalion-350M</li><li>Pygmalion-1.3B</li><li>Pygmalion-2.7B</li><li>Pygmalion-6B</li></ul><blockquote>Pygmalion-7B was recently introduced, but its performance is not significantly different from Pygmalion-6B, as the difference between them is only 1 billion parameters. Even if there is a difference, it would require a highly observant individual to discern it when observing the models in action.</blockquote><h3><strong>Diving deeper into the journey of Pygmalion models</strong></h3><p><strong>Pygmalion-350M</strong></p><p><em>Model Description:</em> This proof-of-concept fine-tune of <a href="https://huggingface.co/facebook/opt-350m"><strong><em>Facebook’s OPT-350M</em></strong></a> model for dialogue optimization serves as a starting point for larger parameter models.</p><p><em>Disclaimer:</em> The fine-tuning process included NSFW data. While SFW inputs generally yield SFW outputs, use this model at your own risk. <strong>It is not suitable for minors.</strong></p><p><strong><em>OPT (Open Pre-trained Transformer Language) Models:</em></strong><em> </em>The OPT (Open Pretrained Transformers) model, developed by Meta’s Facebook AI research team, is an advanced transformer-based language model. It has undergone extensive pre-training on diverse text data from various domains and can be fine-tuned for a wide range of natural language processing (NLP) tasks such as text classification, question answering, and language generation.</p><p>OPT is openly available, allowing users to utilize and modify it according to their needs. The model is highly scalable and capable of handling large datasets and vast amounts of text data. OPT models have significant applications in NLP tasks and hold potential for advancing the field. The creators of OPT emphasize sustainability and responsibility, intending to share the models fully and responsibly with interested researchers. Notably, OPT-175B, the largest model in the suite, achieves similar performance to GPT-3 while requiring only one-seventh of the carbon footprint for its development.</p><p>Moreover, OPT models follow a linear learning rate schedule, starting from 0 and gradually increasing to the maximum learning rate. In the case of OPT-175B, this warm-up phase occurs over 375 million tokens, while smaller baselines have a warming up period over 300 billion tokens, after which the learning rate decays to 10% of the maximum. <a href="https://accubits.com/large-language-models-leaderboard/opt/">Learn more about OPTs</a>.</p><p><strong>Pygmalion-1.3B: (</strong><em>based on EleutherAI’s pythia-1.3b-deduped</em><strong>)</strong></p><p><strong><em>Pythia Scaling Suite:</em></strong><em> </em>The Pythia Scaling Suite is a set of models specifically developed to support interpretability research. It consists of two groups of models, each comprising eight different sizes: 70M, 160M, 410M, 1B, 1.4B, 2.8B, 6.9B, and 12B. For every size, two models are available — one trained on the Pile dataset and another trained on the Pile dataset after global deduplication. All models within each size category are trained on the same data, following the same sequence. The Pythia models can be accessed through <a href="https://huggingface.co/models?other=pythia">Hugging Face</a>.</p><p>The Pythia model suite was intentionally designed to encourage scientific exploration of large language models, particularly in the context of interpretability. While not prioritizing downstream performance as a primary objective, these models exhibit comparable or superior performance to similar models of the same size, such as those in the OPT and GPT-Neo suites.</p><p>It’s important to note that all models in the Pythia suite underwent renaming in January 2023. For clarity, a table comparing the old and new names can be found in the associated model card, which also includes precise parameter counts for each model. <a href="https://huggingface.co/EleutherAI/pythia-1.4b-deduped-v0">Learn more</a>…</p><p><strong><em>EleutherAI:</em></strong><em> </em>EleutherAI is an organization dedicated to advancing artificial intelligence through an open-source and community-driven approach, committed to promoting collaboration and accessibility in AI research. EleutherAI’s primary objective is to develop large-scale, high-quality language models and contribute to the democratization of AI technology.</p><p>EleutherAI’s notable project is GPT-Neo, a series of transformer-based language models. GPT-Neo aims to replicate and expand upon the capabilities of OpenAI’s GPT while prioritizing accessibility and computational efficiency. This empowers researchers and developers to explore and innovate in the field of natural language processing.</p><p>In a similar manner, you can simply find<strong> </strong><a href="https://huggingface.co/PygmalionAI/pygmalion-2.7b"><strong>Pygmalion 2.7B</strong></a><strong> </strong>there, thanks to the<strong> </strong><a href="https://huggingface.co/"><strong>Hugging Face 🤗</strong></a> team.</p><p>And finally, the myth — the magic, Pygmalion 6B. A proof-of-concept dialogue model based on EleutherAI’s <a href="https://huggingface.co/EleutherAI/gpt-j-6B">GPT-J-6B</a>. GPT-J 6B is a transformer model trained using Ben Wang’s <a href="https://github.com/kingoflolz/mesh-transformer-jax/">Mesh Transformer JAX</a>. “GPT-J” refers to the class of model, while “6B” represents the number of trainable parameters. Some of the popular use cases of Pygmalion 6B include, <strong><em>TavernAI</em></strong> and <strong><em>KoboldAI</em></strong>.</p><p><a href="https://tavernai.net/">TavernAI</a> is a adventure atmospheric chat and it works with api like KoboldAI, NovelAI, Pygmalion, OpenAI chatGPT.</p><p>Here are some screenshots of the conversation with KoboldAI. In this conversation, “<strong>you</strong>” represent “human(I was that human.)” and “<strong>me</strong>” represents the “bot”. So, don’t get confused. Further, the conversation was only a test of the capability of the bot.</p><p>What are your thoughts on these conversations? You can try it yourself too, by visiting the link attached with <a href="https://tavernai.net/">TavernAI</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1clRek9ULvH1MbahYjdvA.png" /><figcaption>Conversation with a bot in KoboldAI</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJItnW31wgzjYdrcy_MqSw.png" /></figure><p>SUMMARY</p><p>Pygmalion AI, a remarkable technological marvel, has revolutionized our world with its advanced machine learning algorithms and natural language processing. It has become an essential tool across various industries, offering personalized experiences, automation, and knowledge dissemination. Similar to the ancient Greek myth, Pygmalion AI brings to life the concept of a virtual assistant that understands our thoughts and desires, responding effortlessly to our queries and commands.</p><p>Pygmalion AI is an open-source large language model (LLM) based on EleutherAI’s GPT-J 6B and Meta AI’s LLaMA 7B. It excels in chat and role-playing conversations, analyzing trends, generating text and media content for social media platforms. The model is regularly updated with new data to enhance its performance.</p><p>The story of Pygmalion in Greek mythology parallels the Pygmalion effect in machine learning. Just as Pygmalion shaped his reality through his expectations, the biases and expectations of the creators or trainers of a machine learning algorithm can influence its outcomes. Awareness of these biases is crucial for unbiased decision-making and creation.</p><p>Pygmalion AI offers different models, such as Pygmalion-350M, Pygmalion-1.3B, Pygmalion-2.7B, Pygmalion-6B, and the recently introduced Pygmalion-7B. These models vary in the number of trainable parameters, with Pygmalion-7B being similar in performance to Pygmalion-6B.</p><p>The journey of Pygmalion models includes collaborations with platforms like Facebook’s OPT and EleutherAI’s GPT-Neo. These models provide advanced transformer-based language processing and aim to promote accessibility and collaboration in AI research.</p><p>Overall, Pygmalion AI has brought a touch of magic and wonder to our digital era, shaping our reality through advanced language processing capabilities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec03c6a005a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/pygmalion-ai-expectations-ability-to-shape-reality-ec03c6a005a6">Pygmalion AI: Expectations’ ability to shape Reality</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The VOICE- Real-Time Voice Cloning]]></title>
            <link>https://medium.com/analytics-vidhya/the-voice-real-time-voice-cloning-b7815afd6869?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7815afd6869</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[voice-cloning]]></category>
            <category><![CDATA[real-time-voice-cloning]]></category>
            <category><![CDATA[deepfakes]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Tue, 02 May 2023 08:00:04 GMT</pubDate>
            <atom:updated>2023-05-20T05:32:56.036Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Hello readers, trust me this article is not as dull as it sounds by the title. Here, I taught a machine to mimic a voice, and the amazing thing is you too can do that, well not mimicry of course, I meant, you too can do such a project.</blockquote><blockquote>“People will come to love their oppression, to adore the technologies that undo their capacities to think.”</blockquote><blockquote>— <a href="https://quotefancy.com/aldous-huxley-quotes">Aldous Huxley</a></blockquote><p>Here is the <a href="https://github.com/CorentinJ/Real-Time-Voice-Cloning">GitHub repository</a> of this project in case you want detailed code. This article includes a detailed explanation and visualization of the mechanism behind Real-time voice cloning.</p><p>When it comes to imitating others, it’s not an easy task for us humans. But that does not apply to machines. Machines were designed to outperform human beings in every manner. But can they outsmart us?</p><p>Well, it should not be a surprising fact that machines have actually outsmarted us already in nearly various fields we challenged them. It’s just that, when given a goal or task, they do figure out the most optimum possible way to achieve it.</p><p>Check out this awesome documentary “<a href="https://www.youtube.com/watch?v=8tq1C8spV_g&amp;t=5s">AlphaGo</a>”, on YouTube</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uIIN0l6GyxF80uKqsL_Kxg.jpeg" /><figcaption><a href="https://www.youtube.com/watch?v=8tq1C8spV_g">AlphaGo Official Trailer — YouTube</a></figcaption></figure><blockquote>AlphaGo chronicles a journey from the halls of Cambridge, through the backstreets of Bordeaux, past the coding terminals of DeepMind, to Seoul, where a legendary Go master faces an unproven AI challenger. As the drama unfolds, questions emerge: What can artificial intelligence reveal about a 3000-year-old game? What will it teach us about humanity?</blockquote><p>So, without any further ado, let’s get back to our topic, “the VOICE”.</p><p>Firstly, why do we even study this thing, what value does it hold in today’s modern era? As we say, <em>“true love cannot exist without genuine respect, and to truly respect someone, we must take the time to understand who they are”. </em>Hence, we will take our time understanding this thing, but aye, it will be worth it.</p><p>Imagine being able to talk to a virtual assistant that sounds just like your favorite celebrity or historical figure. With real-time voice cloning, that dream is becoming a reality. Voice assistants like Alexa and Siri are already a ubiquitous part of our daily lives, but what if you could have a custom assistant that spoke to you in the voice of Albert Einstein or Marilyn Monroe? Real-time voice cloning is making this possible, and the possibilities for fun and creativity are endless.</p><p>Just like this movie, <em>“</em><a href="https://www.youtube.com/watch?v=ne6p6MfLBxc"><em>HER</em></a><em>”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*O-rmREkfkFiR_FhCAUC3Yw.jpeg" /><figcaption><a href="https://www.youtube.com/watch?v=ne6p6MfLBxc">Her — Official Trailer 2 [HD] — YouTube</a></figcaption></figure><p>But it’s not just about entertainment. Real-time voice cloning is also being used to help people with medical conditions or disabilities that affect their ability to speak. By creating a custom voice replica that sounds like their natural voice, patients who have lost the ability to speak can regain a sense of identity and connection. This technology is truly life-changing and has the potential to improve the quality of life for millions of people around the world.</p><p>Real-time voice cloning is also transforming the way we create content in the entertainment industry. From video games to animated movies, real-time voice cloning is making it easier and more cost-effective to create custom voiceovers and sound effects. This means that we can create more immersive and engaging experiences for viewers, allowing them to truly feel like they are part of the action.</p><p>In conclusion, real-time voice cloning is a technology with immense potential, and it’s only just beginning to scratch the surface of what’s possible. Whether it’s creating personalized virtual assistants or helping people with disabilities communicate, real-time voice cloning is changing the way we interact with the world around us.</p><p>If break down and dive into this complex architecture, we will encounter these four models working in harmony in order to enable real-time voice cloning.</p><ol><li>Text-to-Mel encoder</li><li>Vocoder or Voice Encoder</li><li>Speaker encoder</li><li>Real-time synthesizer</li></ol><p>In order to get a better understanding of this flow, consider observing the Figure: “RTVC Flowchart” while going through the explanation of models below. We will often use term RTVC as for “Real-Time voice cloning”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bql8Xwaz0jp-N02FAVrkEg.png" /><figcaption>RTVC Flowchart</figcaption></figure><p>“<em>Text-to-Mel encoder</em>”, is a neural network that takes in a sequence of text, such as words or phonemes, and encodes it into a corresponding sequence of Mel-scale spectrograms. Mel-scale spectrograms are a common representation of speech that captures the frequency and time information of an audio signal. One example of a text-to-Mel encoder is <strong>Tacotron2</strong>.</p><p>“<em>Vocoder</em>”, is a neural network that takes in a Mel-scale spectrogram and generates a corresponding waveform. The vocoder essentially converts the spectrogram back into an audio signal. There are different types of vocoders, such as <strong>WaveRNN</strong>, <strong>WaveNet</strong>, or <strong>MelGAN</strong>, that can be used for real-time voice cloning.</p><p>“<em>Speaker Encoder</em>”, is a neural network that takes in a short segment of audio from the target speaker and encodes it into a fixed-length vector that represents the speaker’s unique voice characteristics. This vector is used to condition the vocoder during speech synthesis, allowing the model to generate speech that sounds like the target speaker.</p><p>“<em>Real-time Synthesizer</em>”, is the final component of a real-time voice cloning system that takes in text input and generates corresponding synthetic speech in real-time. The synthesizer typically uses the text-to-Mel encoder to generate Mel-scale spectrograms from the input text and then feeds these spectrograms into the vocoder along with the speaker embedding to generate the corresponding waveform.</p><p>Up to this moment, we now know what is actually happening inside the brain of a Real-time voice cloning model. But, in order to know “How” it is happening, we must dive even deeper into every single model and even have to visualize them to know their mechanism better.</p><p>So, until now we are on our journey of “WHAT?” to “HOW?”. Don’t worry, in the end, you will figure out “WHY?”, on your own.</p><p>Starting with the “HOW” part with our first model,</p><p><strong>Text-to-Mel Spectrogram Encoder</strong></p><p>The Text-to-Mel Spectrogram Encoder is a model that takes as input a sequence of text characters (e.g., a sentence or a phrase) and generates as output a sequence of Mel-scale spectrograms that represent the speech that corresponds to that text.</p><p>Mel-scale spectrograms are a common way of representing speech signals in machine-learning models. They are essentially a 2D matrix that represents the frequency content of a speech signal over time. The vertical axis represents the frequency of the signal (in Hertz), and the horizontal axis represents time (in seconds). Each point in the matrix represents the amplitude of the signal at a particular frequency and time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*xdFOavFw5JjVoUbZt4CtNA.png" /></figure><p>The Text-to-Mel Spectrogram Encoder typically consists of a deep neural network that takes the text input as a sequence of characters and generates the Mel-scale spectrograms as a sequence of 2D matrices. The network typically consists of multiple layers of convolutional neural networks (CNNs) and recurrent neural networks (RNNs) that process the input text and generate the Mel-scale spectrograms.</p><p>The input text is first transformed into a sequence of embeddings, which are vector representations of the text characters that capture their semantic meaning. These embeddings are then fed into a series of convolutional and recurrent layers that transform the embeddings into a sequence of feature vectors. These feature vectors are then passed through additional convolutional and recurrent layers to generate the Mel-scale spectrograms.</p><p>The Text-to-Mel Spectrogram Encoder is an important component of real-time voice cloning systems, as it allows the system to generate the Mel-scale spectrograms that are used as input to the Vocoder to synthesize the target speaker’s voice.</p><p><strong>Vocoder aka Voice Encoder</strong></p><p>The Vocoder is another important component of real-time voice cloning systems. It takes the Mel-scale spectrograms generated by the Text-to-Mel Spectrogram Encoder and converts them into a waveform that sounds like the target speaker.</p><p>The Vocoder is typically trained to optimize for the reconstruction of the original speech signal, using metrics such as mean squared error or spectral distance measures. During training, the Vocoder learns to map the Mel-scale spectrograms and speaker embeddings to a waveform that captures the spectral and temporal characteristics of the speech signal.</p><p>By conditioning the Vocoder with the speaker embedding, we can capture the unique characteristics of the target speaker’s voice, such as their intonation, accent, and speaking style. This allows the synthesized speech to sound like the target speaker, even when the input text is spoken by a different speaker.</p><p>There are several types of vocoders used in real-time voice cloning, but one common type is the WaveNet vocoder, which is based on deep generative models. WaveNet vocoders use autoregressive models to predict each audio sample in the waveform, conditioned on previous samples and the Mel-scale spectrograms.</p><p>The WaveNet vocoder typically consists of multiple layers of dilated convolutional neural networks (CNNs) that operate on the Mel-scale spectrograms and generate the audio waveform. The dilation rate determines how many times steps the CNN can see, allowing it to capture long-term dependencies in the audio signal.</p><p>During training, the WaveNet vocoder is trained to minimize the mean squared error (MSE) between the generated audio waveform and the ground truth waveform for a given set of Mel-scale spectrograms. Once trained, the vocoder can be used to generate high-quality speech waveforms from Mel-scale spectrograms in real time.</p><p>Other types of vocoders used in real-time voice cloning include the <strong>Griffin-Lim vocoder</strong> and the <strong>SampleRNN vocoder</strong>. Each type of vocoder has its own advantages and disadvantages, and the choice of vocoder depends on the specific requirements of the application.</p><p>Both WaveRNN and WaveNet have been used successfully for audio generation tasks such as text-to-speech, music generation, and sound effects synthesis. While WaveNet is more widely used and has been shown to achieve state-of-the-art results on a number of audio generation tasks, WaveRNN is a promising alternative that has been shown to be more computationally efficient and can generate high-quality audio with fewer parameters.</p><p>Below is the visualization of WaveRNN Vocoder. Please, note that the values of the parameter may vary with the original model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8q1CptbsTrYn7muyHXj4g.png" /><figcaption>Voice Encoder</figcaption></figure><p><strong>Speaker Encoder</strong></p><p>The Speaker Encoder is used to extract a high-dimensional feature vector, or speaker embedding, from a given speech signal that represents the unique characteristics of the speaker’s voice. This embedding is then used to condition the WaveNet vocoder during the speech synthesis process.</p><p>The speaker embedding is typically concatenated with the Mel-scale spectrograms generated by the Text-to-Mel Spectrogram Encoder and fed into the WaveNet vocoder as an additional input channel. This allows the WaveNet vocoder to generate speech waveforms that sound like the target speaker.</p><p>By conditioning the WaveNet vocoder with the speaker embedding, the synthesized speech can capture the nuances of the target speaker’s voice, such as their speaking style, intonation, and accent. This is critical for achieving high-quality, natural-sounding speech in real-time voice cloning systems.</p><p>Moreover, the Speaker Encoder is trained to extract speaker embeddings that are highly discriminative of speaker identity while being invariant to other factors such as background noise and recording conditions. This makes the speaker embeddings a powerful tool for voice conversion and other speech-related tasks, as they can effectively separate the speaker-specific information from the content information in the speech signal.</p><p>Below is the visualization of Speaker Encoder. Please, note that the values of the parameter may vary with the original model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSPQWgck0fTTTP8vJPxmCw.png" /><figcaption>Speaker Encoder</figcaption></figure><p><strong>Real-time Synthesizer</strong></p><p>The Real-time Synthesizer takes the speaker embedding generated by the Speaker Encoder and the Mel-scale spectrograms generated by the Text-to-Mel Spectrogram Encoder as inputs and generates a waveform that sounds like the target speaker in real time.</p><p>The Mel-scale spectrograms and the speaker embedding are first concatenated together and then fed into the Synthesizer. The Synthesizer is typically a neural network that consists of several layers of convolutional and/or recurrent neural networks that operate on the concatenated input and generate the synthesized waveform.</p><p>During training, the Synthesizer is optimized to minimize the difference between the generated waveform and the target waveform, using metrics such as mean squared error or spectral distance measures.</p><p>By combining the output of the Text-to-Mel Spectrogram Encoder, the Speaker Encoder, and the Real-time Synthesizer, we can achieve real-time voice cloning. The Text-to-Mel Spectrogram Encoder generates the Mel-scale spectrograms from the input text, the Speaker Encoder extracts a speaker embedding from the target speaker’s voice, and the Real-time Synthesizer generates a waveform that sounds like the target speaker.</p><p>Overall, the combination of these components enables real-time voice cloning by processing the input text, generating Mel-scale spectrograms, extracting speaker embeddings, synthesizing a waveform that sounds like the target speaker, and playing back the generated speech in real time.</p><p>This is a quick demonstration of this project.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbLW8eqnVLa0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbLW8eqnVLa0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbLW8eqnVLa0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/14cd9db08eb6dca0196b860a53ff6d73/href">https://medium.com/media/14cd9db08eb6dca0196b860a53ff6d73/href</a></iframe><p>Here are the audio samples. Please use headphones for better experience of recorded audios.</p><blockquote>My recorded audio.</blockquote><p><a href="https://drive.google.com/file/d/1oD4Dp7xck9E6c7N054wMi_VSR9k_j_dZ/view?usp=share_link">my_record.wav</a></p><blockquote>Audio generated by the model.</blockquote><p><a href="https://drive.google.com/file/d/1HTjBkr4fDB1F19IRfVdt3R2-igjFJL77/view?usp=share_link">model_prediction.wav</a></p><p>In conclusion, real-time voice cloning is a fascinating technology that has the potential to revolutionize the way we interact with digital assistants, voice-enabled devices, and even each other. By allowing us to clone and synthesize voices in real-time, this technology opens up new possibilities for seamless communication and personalized experiences. However, as with any technology, there are also ethical concerns and potential misuse that must be addressed. It is up to us as individuals and as a society to ensure that this technology is used in a responsible and beneficial way. With that said, the future of real-time voice cloning is exciting, and we can’t wait to see where it takes us next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7815afd6869" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/the-voice-real-time-voice-cloning-b7815afd6869">The VOICE- Real-Time Voice Cloning</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Captioning: An Eye for Blind]]></title>
            <link>https://medium.com/analytics-vidhya/image-captioning-an-eye-for-blind-6d402f180c08?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d402f180c08</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[image-captioning]]></category>
            <category><![CDATA[nltk]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 15:41:53 GMT</pubDate>
            <atom:updated>2021-10-04T14:16:47.945Z</atom:updated>
            <content:encoded><![CDATA[<p>The objective of this study is to design a variational autoencoder to model images as well as associated labels or captions.</p><p>Implementation is <a href="https://cainvas.ai-tech.systems/notebooks/details/?path=rakash4730/Image_Caption_Generator.ipynb">here</a>.</p><p><strong>About the dataset</strong></p><p>In this model, the dataset used was extracted from the Flickr8k dataset which consisted of 8,000 images, each paired with five different captions and provided clean descriptions of the salient entities and events.</p><p>Here, our dataset inherits the same properties but only consisted of 1,000 images. The dataset was prepared by <a href="https://www.kaggle.com/keenwarrior/small-flicker-data-for-image-captioning">Anuj Garg</a> and can be found on the Kaggle. This helped us in the reduction of the size of the dataset from 1GB to nearly 133Mb. The images in this dataset were chosen from six different Flickr groups and tend not to contain any well-known locations or people. These images were manually selected to depict a variety of scenes and situations.</p><p><strong>Data Preprocessing</strong></p><p>In this project data preprocessing was the most time-consuming part, moreover, one can assume, almost 90–95% of the work done in this project was data-preprocessing. Here, I used PyTorch and I should better call this image-preprocessing instead of data-preprocessing since our data was in the form of images, however anything that conveys some facts or information is called data, so ironically we again call it data-preprocessing.</p><p>If anyone wants to enhance data-preprocessing skills, this dataset is one of the best things to try in this universe. Also, one of the factors that boost up the usability of this dataset is its ability to scale with size.</p><p>Now, as per the first step of preprocessing here, we defined a function to read this dataset and review its entities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Almm7S94BKExS7fqvAqyRA.jpeg" /><figcaption>Image with Captions</figcaption></figure><p>One you can have a basic idea of what the dataset is about and how it actually looks, like the above two images this dataset has different images with 5 captions for each image.</p><p>Further in pre-processing of this data, different encoding and decoding techniques were used, and as this dataset is based on sentence-based image description, NLTK(Natural Language Toolkit) was also used here.</p><p>In order to ensure better readability, OOP(Object Oriented Programming) approach was followed in defining every function. Now, let&#39;s discuss the functions used in the pre-processing of our dataset.</p><p><strong>Building dataset vocabulary</strong></p><p>Vocabulary is considered as a set of unique words which are present in our text corpus. Whenever raw text is processed for NLP, nearly everything is done around the vocabulary.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7ff0e301cbc1102aa30a17633bef36a/href">https://medium.com/media/a7ff0e301cbc1102aa30a17633bef36a/href</a></iframe><p><strong>Encoder</strong></p><p>Here, the Convolutional Neural Network(CNN) can be thought of as an encoder where the input image is given to the CNN to extract the features. Then, in the case of the encoder, generally, the last hidden state of the CNN is connected to the decoder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf89ce9593fd427cec8dc1bf55d18e9e/href">https://medium.com/media/cf89ce9593fd427cec8dc1bf55d18e9e/href</a></iframe><p><strong>Decoder</strong></p><p>The decoder is a type of Recurrent Neural Network(RNN) that does language modeling to the word level. In the case of the decoder, the first step receives the encoded output from the encoder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93a0faefc9c8b1293c538b45e9800831/href">https://medium.com/media/93a0faefc9c8b1293c538b45e9800831/href</a></iframe><p><strong>Caption Generator</strong></p><p>Further, we defined a Recurrent Neural Network in order to generate sentences based on images.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/426536c2d3b96427904d5f96168c6591/href">https://medium.com/media/426536c2d3b96427904d5f96168c6591/href</a></iframe><p><strong>VAE Captioner</strong></p><p>This section serves as the backbone of the project. Here we simply called the above 5 functions namely, vocab, encoder, decoder, and caption generator, and passed them into a new class named, “VAECaptioner”. This class served as the base model for our project since it consists of all the functions that were actually required to do sentence-based image captioning.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f242292edea7eb7f504b8d8c848b0ba4/href">https://medium.com/media/f242292edea7eb7f504b8d8c848b0ba4/href</a></iframe><p><strong>Defining the loss Function</strong></p><p>Loss function determines the ability of how well a specific algorithm models the given data. If predictions derivates too much from actual results, loss function would be an increased number and vice-versa. Gradually, by using some optimization functions, the loss function can learn to reduce the error in the predictions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf79b15885950f6a9c35148e5dd919c0/href">https://medium.com/media/cf79b15885950f6a9c35148e5dd919c0/href</a></iframe><p><strong>Plotting Graphs for losses</strong></p><ul><li>loss</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*Z5hqVY8tOnJgTV2mip1kzQ.jpeg" /><figcaption>Training_loss</figcaption></figure><ul><li>caption_loss</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*qjs7AOTmZdjj8Pfn2t1rUw.jpeg" /><figcaption>caption_loss</figcaption></figure><p><strong>Prediction</strong></p><p>Below is a random prediction done from the test_set image</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0482620b0a3fbfb954fabd5afd426428/href">https://medium.com/media/0482620b0a3fbfb954fabd5afd426428/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*cJhuLGDg9qLujZeQP1M98A.jpeg" /><figcaption>Sample_prediction done by model</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d402f180c08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/image-captioning-an-eye-for-blind-6d402f180c08">Image Captioning: An Eye for Blind</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disease Classification using Medical MNIST]]></title>
            <link>https://akash-rawat.medium.com/disease-classification-using-medical-mnist-971042c15282?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/971042c15282</guid>
            <category><![CDATA[medical-mnist]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[mednist]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 15:35:49 GMT</pubDate>
            <atom:updated>2021-08-01T06:10:58.916Z</atom:updated>
            <content:encoded><![CDATA[<p>The objective of this study is to classify medical images using the Convolutional Neural Network(CNN) Model.</p><p>Here, I trained a CNN model with a well-processed dataset of medical images. This model can be used to classify medical images based on categories provided as per the training dataset.</p><p>Implementation is <a href="https://cainvas.ai-tech.systems/notebooks/details/?path=rakash4730/MedicalMNIST.ipynb">here…</a></p><p><strong>About the dataset</strong></p><p>This dataset was developed in 2017 by Arturo Polanco Lozano. It is also known as the MedNIST dataset for radiology and medical imaging. For the preparation of this dataset, images have been gathered from several datasets, namely, TCIA, the RSNA Bone Age Challange, and the NIH Chest X-ray dataset.</p><p>This dataset contains 58954 medical images belonging to 6 categories — AbdomenCT(10000 images), HeadCT(10000 images), Hand(10000 images), CXR(10000 images), CXR(10000 images), BreastMRI(8954 images), ChestCT(10000 images).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*6j28WAVM0gvBuNdn0ypevg.png" /></figure><p>Dataset size is 75.98 MB.</p><p><strong>Data Preparation</strong></p><p>In this dataset, we were provided six different directories each consisting of tens of thousands of images. However, in order to feed this data into a CNN model, we first need to extract it into training and test set from it.</p><p>Here we already created an empty directory first named, “test_dir” with all subfolders in it as they are in “train_dir” and “train_dir” consists of all folders of images.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/20b078a0b1bddb1c3e991cdc562b5dc8/href">https://medium.com/media/20b078a0b1bddb1c3e991cdc562b5dc8/href</a></iframe><p>After creating the test set, we can validate whether both the directories, namely “train_dir” and “test_dir” have the same number of classes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48adbc9c6aa7af33c76aac50f0141d20/href">https://medium.com/media/48adbc9c6aa7af33c76aac50f0141d20/href</a></iframe><p><strong>Image Preprocessing</strong></p><p>As per the technical definition of the term, Image processing is the technical analysis of an image by using complex algorithms. Here, we use the image as the input, and the output is returned as useful information about it.</p><p>The report <strong>“</strong><a href="https://www.marketsandmarkets.com/Market-Reports/image-recognition-market-222404611.html"><strong>Image Recognition Market</strong></a><strong> by Technology (Digital Image Processing, Facial Recognition, Pattern Recognition), Component (Hardware, Software, and Services), Deployment Mode (On-premises &amp; Cloud), Application, Vertical, and Region — Global Forecast to 2025”</strong>, the global image recognition market size to grow from USD 26.2 billion in 2020 to USD 53.0 billion by 2025, at a Compound Annual Growth Rate (CAGR) of 15.1% from 2020 to 2025. An increase in the need for efficient and profitable retail execution processes with adherence to compliance standards is one of the major factors expected to drive the growth of this market.</p><p>Now one can imagine the importance of the role image processing plays in building a good model.</p><p>Below I have discussed the parameters and functions that were defined during image preprocessing:</p><ul><li>Firstly, I created a function to display a sample image from a directory.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2464a8a7d854ac86a7b6651c5ca398d4/href">https://medium.com/media/2464a8a7d854ac86a7b6651c5ca398d4/href</a></iframe><ul><li>image_size(height, width) as (32, 32). In this dataset, we had nearly 10,000 images for every class. Moreover, all images were types of medical images i.e, X-rays, CT Scans, or MRIs. And most parts of those types of images are blurry. Hence, a much bigger size will not add more value as compared with increased training time due to increased image size.</li><li>batch_size(), it is a hyperparameter that simply defines the number of samples to work through before updating the internal model parameters.</li><li>class_mode(), here I used class _mode as “categorical”. Since, it determines the type of label arrays that are returned, here in the case of “categorial”, it will be 2D one-hot encoded labels.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61834b57899843b36d5f7cfa25c33c0e/href">https://medium.com/media/61834b57899843b36d5f7cfa25c33c0e/href</a></iframe><p><strong>Defining the model</strong></p><p>For this image classification model, we defined a convolutional neural network model with seven layers. Here, 2 layers have ReLU(Rectified Linear Unit) and the last one has a “Softmax” activation function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/460e45dae87bcea72b713ceb367e5ae6/href">https://medium.com/media/460e45dae87bcea72b713ceb367e5ae6/href</a></iframe><p>Here we used “softmax”, the softmax function is used as the activation function in the output layer of neural network models that predict a multinomial probability distribution. That is, as in this case, we had multiple classes of images. Moreover, the softmax is very useful as it converts the scores to a normalized probability distribution, which can be later displayed to a user or can be used as input to other systems.</p><p>Further, the model was compiled using the categorical cross-entropy loss function.</p><p>“Adam” is used as an optimizer, because of its ability to adjust the learning rate of the model on its own as per the situation.</p><p><strong>Callbacks</strong></p><p>Here we used multiple callbacks, a callback is simply an object that can perform actions at various stages of training(e.g. at the start or end of an epoch, before or after a single batch, etc).</p><ul><li>Early Stopping: Used to stop training when a monitored metric has stopped improving.</li><li>Reduce LR On Plateau: Used to reduce learning rate when a metric has stopped improving.</li><li>Model Checkpoint: Used to save the Keras model or model weights at some frequency.</li></ul><p><strong>Model Summary</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*pCXPTc2hHvgaxFSpgFjf6A.png" /></figure><p><strong>Inference</strong></p><p>The model achieved an exceptional accuracy of 99% on the validation set and 99% of accuracy on the test set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27c9560dbbf9e50a8068fde091a4397b/href">https://medium.com/media/27c9560dbbf9e50a8068fde091a4397b/href</a></iframe><p><strong>Plotting Graphs</strong></p><p>The graph between loss, accuracy, validation loss, and validation accuracy.</p><ul><li>“loss” represented training loss</li><li>“acc” represented training accuracy</li><li>“val_loss” represented validation accuracy</li><li>“val_acc” represented validation accuracy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMBFRlIl7fJQNW6DCfrgAw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=971042c15282" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pokémon Classification Using CNN]]></title>
            <link>https://medium.com/analytics-vidhya/pok%C3%A9mon-classification-974a10621381?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/974a10621381</guid>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[bolt-iot]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Mon, 21 Jun 2021 17:33:27 GMT</pubDate>
            <atom:updated>2021-07-28T15:48:22.918Z</atom:updated>
            <content:encoded><![CDATA[<p>The objective of this study is to classify the images of Pokemons using the Convolutional Neural Network model.</p><p>In this model, well-processed images of generation-one Pokémon were fed to the convolutional neural network model and this model achieved a good accuracy of 96% on the validation set.</p><p>Implementation is <a href="https://colab.research.google.com/drive/1a5FPyRIa8XREa9EmeXGv5rga5djUmmhJ?usp=sharing">here</a>.</p><p><strong>About the dataset</strong></p><p>This dataset was provided by <a href="https://www.kaggle.com/lantian773030/pokemonclassification">Lance Zhang</a> on Kaggle. The dataset consisted of all the 150 Pokémos from generation one. In this dataset, there are approximately 25–50 images for each Pokémon category. Most of the images provided are highly detailed and have correct labels which in turn resulted in such an exceptional performance of our model. Also, the images are not in extremely high resolution so this dataset is nearly ideal for a simple deep learning project.</p><p><strong>Dataset Preprocessing</strong></p><p>As per the explanation of the author(Lance Zhang) of this dataset, he had to work on a Pokémon classification project over the summer. The author didn’t found a viable dataset and hence decided to create one on his own. The author went through every single image, cropping and removing falsely labeled ones and enhancing the quality of the images. This resulted in a well-defined and processed dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kCLls2d0AZ5rVZVt-NsFQ.png" /><figcaption>Sample images directly from the raw dataset</figcaption></figure><p>There were 150 classes of the Pokémon and consisted of images with super-fine quality. In this dataset, nearly all the Pokémon images consisted of the Pokémon at the center of the image.</p><p>Since the dataset was provided directly in the form of a simple directory, I had to divide it into two parts(training and test set). Of course, the training set was further divided into training and validation sets.</p><p>Firstly, the dataset was imported from Kaggle into Colab using Kaggle API. This process saves a lot of internet and time since it allows users to instantly import and use any size dataset without wasting the internet in downloading the dataset. I took help from <a href="https://medium.com/analytics-vidhya/how-to-fetch-kaggle-datasets-into-google-colab-ea682569851a">this</a> article for importing that dataset to my colab file.</p><p>In the image below, I described the entire process of creating the training, validation, and test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsqkzeSADkSYqKTVRwVpeg.jpeg" /><figcaption>Run every code separately for better execution</figcaption></figure><p><strong>Image Processing</strong></p><p>As per the technical definition of the term, Image processing is the technical analysis of an image by using complex algorithms. Here, we use the image as the input, and the output is returned as useful information about it.</p><p>Parameters used in the image processing of these datasets were:</p><ul><li>image_size(height, width) as (64, 64). A very big image size such as (512, 512) can result in a very long training time. Similarly, a small image size such as(8, 8) can result in very low detailing of the image and can eventually affect the performance of the model negatively. However, it does not mean that we should never use small size or very big size. It depends on the dataset, if the dataset is of images like colors, then image size will not matter, since small images will also indicate red as much as a bigger size will do. But, it&#39;s vice-versa in the case of images such as rodents.</li><li>batch_size(), is a hyperparameter that simply defines the number of samples to work through before updating the internal model parameters. Here, we took batch_size as “32&quot;, which indicates that in our total of “7000” images, our internal model parameters will update after each of 32 samples.</li><li>class_mode(), here I used class _mode as “categorical”. It determines the type of label arrays that are returned, here in the case of “categorial”, it will be 2D one-hot encoded labels. In the case of “None”, no labels will be returned i.e the generator will only yield batches of image data, which is useful in order to use with model.predict_generator().</li><li>color_mode(), as the name suggests, this parameter is simply used to determine which color_mode the user is willing to use in his model. This varies from dataset to dataset. E.g, we will not prefer “rgb” in the case of X-rays images.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*ldlFZ21P9hYEsMhGLoy-PQ.jpeg" /><figcaption>Image-processing parameters (Image shown above represents the image before preprocessing)</figcaption></figure><p><strong>Defining the Model</strong></p><p>For the Pokémon image classification, we defined a convolutional neural network model with seven layers. Here, 2 layers have ReLU(Rectified Linear Unit) and the last one has a “Softmax” activation function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxKXh1zUPTjXcIT0e2mjMg.jpeg" /><figcaption>Defining model</figcaption></figure><p>The softmax function is generally used as the activation function in the output layer of neural network models that predict a multinomial probability distribution. That is, softmax is used as the activation function for multi-class classification problems as in this case, we had multiple classes of Pokémon. Moreover, the softmax is very useful as it converts the scores to a normalized probability distribution, which can be later displayed to a user or can be used as input to other systems. Hence, it is usual to append a softmax function as the final layer of the neural network.</p><p>Now, as per the classification, the model was compiled using the categorical cross-entropy loss function. “Adam” is used as an optimizer, also because of its ability to adjust the learning rate of the model on its own as per the situation.</p><p><strong>Callbacks</strong></p><p>We used various callbacks in defining our model. A callback is simply an object that can perform actions at various stages of training(e.g. at the start or end of an epoch, before or after a single batch, etc). We used the following callbacks for our model:</p><ul><li>Early Stopping: Used to stop training when a monitored metric has stopped improving.</li><li>Reduce LR On Plateau: Used to reduce learning rate when a metric has stopped improving.</li><li>Model Checkpoint: Used to save the Keras model or model weights at some frequency.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*re4r4FYRUXV8ZvOQspwp6A.jpeg" /><figcaption>Callbacks</figcaption></figure><p><strong>Model Summary</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*1B0YfvnvbiFusI2ZhnDq-A.jpeg" /><figcaption>Model Summary</figcaption></figure><p><strong>Model Visualisation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*SGnobFzd4s6FtaZFpy63kw.png" /><figcaption>Model Visualisation using plot_model()</figcaption></figure><p><strong>Inference</strong></p><p>The model achieved an exceptional accuracy of 96% on the validation set and 95% of accuracy on the test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0HYRCwcB0SENQu4HV3aSQ.jpeg" /><figcaption>Accuracy metrics</figcaption></figure><p><strong>Graphs</strong></p><p>The graph between loss, accuracy, validation loss, and validation accuracy.</p><ul><li>“loss” represented training loss</li><li>“acc” represented training accuracy</li><li>“val_loss” represented validation accuracy</li><li>“val_acc” represented validation accuracy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5kvEF6GG6ZT8uH4g27y3Ow.png" /><figcaption>Graph between loss and accuracy</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=974a10621381" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/pok%C3%A9mon-classification-974a10621381">Pokémon Classification Using CNN</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eye Movement Verification and Identification]]></title>
            <link>https://medium.com/analytics-vidhya/eye-movement-verification-and-identification-dd32012e4916?source=rss-3c4a1737d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd32012e4916</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[eye-tracking]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bolt-iot]]></category>
            <dc:creator><![CDATA[Akash Rawat]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 12:56:13 GMT</pubDate>
            <atom:updated>2021-07-05T06:27:48.683Z</atom:updated>
            <content:encoded><![CDATA[<p>The aim of this model is to determine how people may be identified based on their eye movement characteristics.</p><p>In this model, readings were from any kind of eye tracker(e.g. Ober2)</p><p>The sample readings were taken with 250Hz frequency using an Ober2 eye tracker and then fed to the model. The model was trained as per left and right eye gaze coordinates. This was done separately for each user.</p><p><strong>The dataset</strong></p><p>For the dataset 2048 sample readings were taken and whole measurements lasted 8192ms. As a stimulus, a 3x3 jumping matrix was used and consisted of eleven-point change positions. These point change positions returned twelve consecutive point positions.</p><p><strong>Preparation of the dataset</strong></p><p>For readings, the first point appears in the middle of the screen where the subject should focus on it with eyes positioned toward it. After the duration of 1600ms, the point disappears and the screen goes black for 20ms. This makes the eyes of the subject go in an unstable state, waiting for another point of interest. Further, the next point appears in the upper right corner and the flashing point attracts the attention of the subject’s eyes. This process is repeated till the last position in the middle of the screen is reached.</p><p>Dataset was available in “.csv” format. There were training and test files. Each reading had four types of values:</p><ul><li>class — subject’s classification (1–37 for the training set and “?” in case of test set)</li><li>lx — list of 2048 comma-separated values of left eye gaze points on the X-axis.</li><li>ly — list of 2048 comma-separated values of left eye gaze points on Y-axis.</li><li>rx — list of 2048 comma-separated values of right eye gaze points on X-axis.</li><li>ry — list of 2048 comma-separated values of right eye gaze points on Y-axis.</li></ul><p>The values are 0 for point in the middle, positive for a point on the right or upper side of the screen, and negative for points on the left or lower side of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vLnW5h6Umz4h6XJouaTWBg.jpeg" /><figcaption>Top rows of dataset</figcaption></figure><p>A large part of most machine learning projects is getting to know the dataset. However, the pandas API provides a describe function that outputs the following statistics about every column in the DataFrame:</p><ul><li>the count is the number of rows in that column. Ideally, the count contains the same value for every column.</li><li>mean and std contain the mean and standard deviation of the values in each column.</li><li>min and max contain the lowest and highest values in each column.</li><li>25%, 50%, 75% which contain various quantiles.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_MIS0GPzYQia4l_EoBG2xw.jpeg" /><figcaption>Examining the dataset</figcaption></figure><p><strong>Preprocessing the dataset</strong></p><p>I used MinMax Scaler to scale the dataset. Scaling will keep loss values and learning rates in a friendlier range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lCsZSrdXhuoq8UsWTfCTQ.jpeg" /></figure><p><strong>Defining features and labels</strong></p><p>The column “class” will be used as a label here and the rest of the columns represent the characteristic of that particular class.</p><p>Eye movement graph plotted for “subject 1”, as per its lx, ly, rx, ry coordinates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*rs6Bk6HX5fg9lODQeU3oAA.jpeg" /><figcaption>Left and Right eye gaze coordinated on the x-axis</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*QC4XStl1YLFMVcxWRG-qDQ.jpeg" /><figcaption>Left and Right eye gaze coordinates on the y-axis</figcaption></figure><p><strong>Using <em>k</em>NN classifier</strong></p><p>The k-nearest neighbors (<strong>KNN</strong>) <strong>algorithm</strong> is a very simple, supervised machine learning <strong>algorithm</strong>.<strong> </strong>It<strong> </strong>can be used to solve both classification and regression problems. In this case, we have a classification problem, since all features belong to different classes.</p><p>First, we imported the KNeighborsClassifier module and create <em>k</em>NN classifier object by passing the argument number of neighbors in KNeighborsClassifier() function.</p><p>Determining targets and features for<strong> </strong><em>k</em>NN classifier here, we assigned “X” for features and “y” for labels.</p><p>We then used “fit()” to fit our model on the training set and then perform prediction on the test set using predict().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBce3mJEuciLHo_DiP6Zgw.jpeg" /><figcaption>Using <em>kNN classifier</em></figcaption></figure><p>Here, we can’t verify our results on the test set, since the test set is an unlabelled dataset. Moreover, we can split the training set into train and validation sets and determine an estimated accuracy of our model and even plot a confusion matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQ7wVXc-IudhljaQcAoB5g.jpeg" /></figure><p><strong>Conclusion</strong></p><p>Eye movement-based biometrics is an emerging field and this model can be improved with a larger and calibrated dataset. The predictions done on the test set didn’t result as aspected because the accuracy score was close to 0.55, this was because of uncalibrated data from the eye tracker. Since the kNN classifier was used here, it is known for its well-scaling properties with datasets. Hence, this model accuracy will increase with more data. This project was inspired by the Kaggle competition, “Eye Movements Verification and Identification Competition”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd32012e4916" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/eye-movement-verification-and-identification-dd32012e4916">Eye Movement Verification and Identification</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>