<?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 Theethat Anuraksoontorn on Medium]]></title>
        <description><![CDATA[Stories by Theethat Anuraksoontorn on Medium]]></description>
        <link>https://medium.com/@theethatanuraksoontorn?source=rss-c18dca33f27------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XphYn94mA7JnrAjNJJLMeg.png</url>
            <title>Stories by Theethat Anuraksoontorn on Medium</title>
            <link>https://medium.com/@theethatanuraksoontorn?source=rss-c18dca33f27------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 06:36:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@theethatanuraksoontorn/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[“ChatGPT Profits: A Comprehensive Guide to Monetizing Conversational AI”]]></title>
            <link>https://medium.com/@theethatanuraksoontorn/chatgpt-profits-a-comprehensive-guide-to-monetizing-conversational-ai-583961fda2d8?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/583961fda2d8</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[conversational-ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Wed, 03 Jan 2024 13:52:12 GMT</pubDate>
            <atom:updated>2024-01-03T13:52:12.981Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to “ChatGPT Profits,” your definitive guide to unlocking the untapped potential of conversational artificial intelligence. In an era where seamless communication between humans and machines is no longer science fiction but a thriving reality, the focus has shifted towards harnessing the power of innovative technologies for both business and personal success. At the forefront of this revolution stands ChatGPT, a groundbreaking conversational AI model developed by OpenAI.</p><h3>The Evolution of Conversational AI</h3><p>The journey into the realm of conversational AI has been one marked by rapid evolution and transformative breakthroughs. From early rule-based chatbots to the emergence of machine learning-driven models, the narrative has unfolded with each technological stride. However, it is the advent of transformer-based architectures, exemplified by ChatGPT, that has elevated conversational AI to unprecedented heights.</p><p>ChatGPT, powered by the GPT (Generative Pre-trained Transformer) architecture, signifies a pivotal leap in natural language processing. Its ability to understand context, generate coherent responses, and adapt to diverse conversational scenarios positions it as a game-changer in the field. From GPT-1’s initial foray into language generation to the sophistication of GPT-3 with its 175 billion parameters, ChatGPT has emerged as a versatile tool with applications spanning customer support, content creation, and interactive storytelling.</p><h3>The Motivation Behind This Guide</h3><p>As the capabilities of ChatGPT continue to expand, so does the potential for individuals and businesses to leverage this technology for profit. “ChatGPT Profits” is born out of the recognition that, beyond its technical prowess, ChatGPT holds the key to unlocking innovative business solutions and revenue streams. This guide is designed to be your companion in navigating the intricate landscape of conversational AI, providing insights, strategies, and practical knowledge to turn the power of ChatGPT into profitability.</p><h3>What to Expect in “ChatGPT Profits”</h3><p>This comprehensive guide is structured to take you on a step-by-step journey, starting with an understanding of ChatGPT’s technical intricacies and progressing through strategic methodologies for identifying profitable niches. You will acquire the skills needed to work effectively with ChatGPT, creating compelling conversational products and services. The guide culminates in a detailed exploration of monetization strategies, guiding you on how to turn your ChatGPT applications into viable revenue streams.</p><p>Get ready to delve into real-world case studies, practical exercises, and a wealth of knowledge curated to empower you in the dynamic landscape of conversational AI. Whether you’re a developer looking to enhance your skills, an entrepreneur seeking innovative solutions, or an enthusiast curious about the potential of ChatGPT, this guide is crafted with you in mind.</p><p>The pages that follow are your gateway to the intersection of technology and profitability. “ChatGPT Profits” invites you to embark on a transformative journey where the art of conversation converges with the science of profit. Turn the page, and let the exploration begin.</p><h3>Introduction — Unleashing the Power of ChatGPT</h3><p>Welcome to the transformative journey within the pages of “ChatGPT Profits: A Comprehensive Guide to Monetizing Conversational AI.” In the rapidly evolving landscape of artificial intelligence, one innovation stands out as a beacon of conversational sophistication — ChatGPT. This guide is your compass, navigating the expansive possibilities and profitability woven into the fabric of this groundbreaking technology.</p><p>As we embark on this exploration, it’s crucial to understand the profound impact of conversational AI on our world. The ability to engage in meaningful and dynamic conversations with machines has transcended mere technological advancement. It has become a cornerstone of innovation, revolutionizing industries and reshaping how businesses and individuals interact with information, services, and each other.</p><p>At the heart of this guide lies a recognition: ChatGPT is not merely a sophisticated language model; it is a catalyst for profitability across diverse sectors. This journey is an odyssey through the capabilities, applications, and strategies that render ChatGPT not just an AI marvel but a potent tool for driving financial success.</p><p>Our introductory chapter unveils the foundational narrative of conversational AI and ChatGPT’s pivotal role within it. We begin with a historical retrospective, tracing the origins of conversational AI from its nascent stages to the contemporary sophistication exemplified by ChatGPT. Understanding this evolution sets the stage for appreciating the significance of integrating ChatGPT into business strategies for profitability.</p><p>As we transition to a forward-looking perspective, we delve into the unique features that define ChatGPT, examining the various iterations from GPT-1 to the cutting-edge GPT-3. Each iteration represents a quantum leap in capacity and capability, showcasing the commitment of the technology’s creators to push the boundaries of what is possible in natural language processing.</p><p>The applications of ChatGPT are as diverse as they are powerful. This guide aims to unravel the multifaceted nature of ChatGPT, demonstrating its versatility across industries. From enhancing customer support through chatbots to generating creative content and aiding in complex problem-solving, ChatGPT has left an indelible mark on sectors ranging from healthcare to marketing.</p><p>Real-world case studies serve as windows into the tangible impact of ChatGPT. We witness how businesses and organizations have leveraged this technology to streamline processes, improve customer interactions, and spark innovation. These case studies not only illustrate the immediate benefits but also highlight the adaptability of ChatGPT across different use cases.</p><p>As we embark on this journey, it’s essential to acknowledge that understanding ChatGPT is not solely about comprehending its technicalities and applications. It’s about envisioning the potential it holds for the future. This guide is an invitation to envision how ChatGPT can be harnessed as a driving force for profitability, influencing decision-making, and reshaping the dynamics of industries.</p><p>The subsequent chapters will be the keystones of our expedition. They promise a deep dive into the technical intricacies of ChatGPT, strategic methodologies for identifying profitable niches, and the development of essential skills to navigate and create within this AI-driven landscape. With each page, we peel back the layers of ChatGPT, revealing not just a powerful language model but a gateway to innovation, profitability, and a future shaped by the art of conversation with machines. Are you ready to turn the page and venture into the transformative realm of ChatGPT Profits?</p><h3>The Evolution of Conversational AI</h3><p>Before we plunge into the intricate details of ChatGPT and its profitable applications, it’s crucial to grasp the evolution of conversational AI. The genesis of this technology traces back to rudimentary rule-based chatbots that attempted to simulate human-like interactions. While these early attempts were commendable, they fell short in capturing the nuances of natural language and context.</p><p>The turning point came with the advent of machine learning-driven models that could learn from vast datasets, paving the way for more sophisticated conversational agents. However, the true watershed moment arrived with the introduction of transformer-based architectures, where attention mechanisms enabled models to process input sequences in parallel, capturing dependencies and relationships more effectively.</p><p>ChatGPT, a product of OpenAI’s dedication to pushing the boundaries of AI, stands as a testament to this evolution. Its journey began with GPT-1, a precursor that showcased the potential of pre-trained language models. Subsequent iterations, including GPT-2 and the monumental GPT-3, marked substantial advancements in capacity, allowing the model to handle more complex tasks, understand context with greater finesse, and generate human-like responses on an unprecedented scale.</p><p>The key innovation lies in the sheer scale of GPT-3, armed with a staggering 175 billion parameters. This massive neural network enables ChatGPT to generalize patterns from diverse datasets, making it a powerhouse for natural language understanding and generation. It’s this capability that positions ChatGPT as a versatile tool with applications extending far beyond conventional AI boundaries.</p><p>ChatGPT in Action: From Customer Support to Creative Endeavors</p><p>ChatGPT’s applications span a broad spectrum, redefining how businesses approach communication and problem-solving. In customer support, it serves as an intelligent chatbot, providing users with timely and relevant information. Its natural language generation capabilities enable it to craft responses that not only answer queries but also engage users in a manner reminiscent of human conversation.</p><p>Beyond pragmatic applications, ChatGPT ventures into the realm of creativity. Content creation, whether in the form of articles, stories, or poetry, becomes an art form when guided by ChatGPT. The model’s ability to understand context and generate coherent and contextually relevant text opens up new horizons for writers, marketers, and creators.</p><p>Interactive storytelling is another arena where ChatGPT shines. By responding dynamically to user inputs, it creates immersive and personalized narratives. This not only showcases its technical prowess but also underlines its potential for crafting engaging user experiences in fields ranging from entertainment to education.</p><p>As we explore “ChatGPT Profits,” keep in mind the remarkable journey of conversational AI that has led us to this juncture. The evolution from rule-based systems to transformer architectures has laid the groundwork for the profitable applications we will uncover in the chapters ahead. Let’s turn the page and delve deeper into the intricacies of ChatGPT, unlocking the doors to innovation and profitability in the realm of conversational AI.</p><h3>Navigating the Technical Seas of ChatGPT</h3><p>With a foundational understanding of the evolution of conversational AI and the pivotal role played by ChatGPT, our journey now delves into the technical intricacies of this powerful model. At its core, ChatGPT operates on the GPT architecture, a sophisticated framework designed to understand and generate human-like text.</p><p>This chapter serves as a compass through the neural landscape of ChatGPT. We embark on a journey through the architecture’s nuances, exploring the principles that enable ChatGPT to decipher context, understand language intricacies, and generate coherent responses. From attention mechanisms to fine-tuning processes, readers will gain insights into the inner workings that set ChatGPT apart in the realm of natural language processing.</p><p>As we navigate this technical voyage, we also trace the evolutionary footsteps of ChatGPT, from its early iterations to the groundbreaking GPT-3. The sheer scale of GPT-3, with its 175 billion parameters, grants ChatGPT an unparalleled ability to generalize patterns, making it a versatile tool for various applications.</p><p>Understanding the technical foundations of ChatGPT is not just an academic exercise; it’s a prerequisite for unlocking the full potential of this AI marvel. Armed with this knowledge, readers will be better equipped to tailor their interactions with ChatGPT, optimizing its performance for specific tasks and industries.</p><h3>Crafting Conversational Experiences</h3><p>Having navigated the technical seas, we now set sail into the practical realm of creating conversational products and services. Chapter 4 unfolds as a practical guide to transform technical knowledge into tangible, marketable solutions.</p><p>Our journey commences with an exploration of user-centric design principles for conversational interfaces. Whether developing chatbots for customer support or creating immersive storytelling experiences, the emphasis is on crafting interactions that prioritize user experience. Real-world case studies illuminate successful design thinking, demonstrating how businesses have aligned ChatGPT applications with user needs and preferences.</p><p>Interactive storytelling takes center stage as we explore how to weave narratives enriched by ChatGPT’s unique capabilities. Readers gain insights into constructing compelling story arcs that captivate users, striking a harmonious balance between technology and creativity. Practical tips and examples showcase how businesses can leverage ChatGPT to create engaging, user-focused experiences that transcend the limitations of traditional content creation.</p><p>Additionally, we delve into the development of personalized virtual assistants, showcasing how ChatGPT can serve as the backbone for AI companions tailored to individual needs. Case studies spotlight instances where virtual assistants have not only enhanced productivity but also elevated user experiences across diverse industries.</p><p>By the end of this chapter, readers will have gained not only a technical understanding of ChatGPT but also practical insights into creating market-ready conversational solutions. The stage is set for the subsequent chapters, where we will explore strategies for monetization, turning these innovative creations into viable revenue streams.</p><h3>A Prelude to Profitability</h3><p>As we conclude the initial chapters of “ChatGPT Profits,” we find ourselves at the crossroads of technical prowess and practical application. The journey thus far has been a voyage of discovery, navigating the seas of conversational AI’s evolution, understanding the intricacies of ChatGPT, and crafting engaging user experiences.</p><p>The pages ahead promise to unravel the mysteries of monetization, offering strategic insights and real-world examples to guide you in transforming your ChatGPT applications into profitable ventures. The convergence of technology and profitability awaits as we turn the page, inviting you to embark on the next phase of this transformative journey into the heart of ChatGPT. The art of conversation, now poised on the brink of profitability, beckons you to continue the exploration. Are you ready for the next chapter?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=583961fda2d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Capture Motion with Pose Estimation and Optical Flow]]></title>
            <link>https://python.plainenglish.io/image-processing-with-pose-estimation-and-optical-flow-4e7cabc04ea2?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7cabc04ea2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Mon, 25 Oct 2021 15:23:59 GMT</pubDate>
            <atom:updated>2021-10-28T05:07:12.436Z</atom:updated>
            <content:encoded><![CDATA[<p>The simplest way to say whether Artificial Intelligence can be applied to solve the problem with computer vision or image processing is the following quote:</p><blockquote>“ If humans can <strong>rapidly</strong> identify the motion or the caption of the image to separate the things from each other, the computer can also do the same.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*IITtbvsmz4xrXAMd.png" /></figure><p>Yes, if humans can rapidly see something and identify something, computers can also do so. However, it must not be related to common sense or his memory from other events; it can only identify something on the spot.</p><p>However, the work of computer vision is lacking in terms of pattern recognition, it needs other things to help it identify more about the object and motion. So in this article, I will help you understand how image processing captures motion.</p><p>Several image processing models exist that help the final task be more accurate. Here I pick two of the most common models that are used in the industry: Pose estimation and Optical flow.</p><h3><strong>Pose Estimation</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gO3vkZ66jUrvWLXN.jpg" /><figcaption>Mediapipe</figcaption></figure><p>Pose estimation is a computer vision technique that predicts and tracks the location of a person or object. This is done by looking at a combination of the pose and the orientation of a given person or object.</p><p>This is typically done by identifying, locating, and tracking the number of <strong>key points or landmarks </strong>on a given object or person. For objects, this could be corners or other significant features. And for humans, these <strong>key points</strong> represent major joints like an elbow or knee.</p><p>Several AI-powered products nowadays use pose estimation as the input of their model, so their deep model can diverge and learn the pattern quickly. It is used in many applications such as gesture recognition, sign language detection, action recognition, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O_oYjQ4s_jZlrwUR.png" /></figure><p>Mediapipe is one of the pre-trained open-source pose estimation models that are commonly used by many to train their deep learning which also is accessible via the OpenCV library.</p><h3>Optical Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*62ceUy1vSvh1lUa4.png" /></figure><p><strong>Optical flow</strong> or <strong>optic flow</strong> is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer and a scene.</p><p>It is used to identify the motion flow of the object based on the static (motion or moving frame) and non-static or dynamic (motion).</p><p>The optic flow helps to remove the non-useful elements from the frame without working on the data augmentation or the green screen to crop the background if those are not moving. It converts all those pixels into zero or black pixels. With these, the model can use these as input and generalize the whole idea as humans faster.</p><h3>Use Case: Google Automatic Sign language (ASL) Detection</h3><p>One of the world-leading AI-powered companies, Google developed the ASL detection with Pose estimation and Optical flow as the input of its Deep learning model to improve its convergence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*SOCCWp3CO4O6RlMH_Wo9jQ.png" /></figure><p>They use this model because it is a lightweight model as they need to fit in other applications for video conferences, so their need to input will be as little as possible. <br>They reduce the pixel of the frame to pose estimation then put it in the optical flow and the flow of the pose keypoints movement and train those as input for their deep learning.</p><p>With these techniques, it reduces a huge processing time and memory which allow google to fit all this inside other application to monetize their Algorithm.</p><h3>EndNote</h3><p>If you are interested in those and want to code along with examples, follow me as my next article will explore these techniques and go step by step on how to implement these techniques in the Deep learning models.</p><p>And don’t forget to follow to read more of my amazing article!</p><p>Thank you for reading!</p><p><em>More content at </em><a href="http://plainenglish.io/"><em>plainenglish.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e7cabc04ea2" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/image-processing-with-pose-estimation-and-optical-flow-4e7cabc04ea2">How to Capture Motion with Pose Estimation and Optical Flow</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Python Data Manipulation Tricks in Pandas]]></title>
            <link>https://python.plainenglish.io/5-should-known-data-manipulation-tricks-with-pandas-d86743790f04?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/d86743790f04</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Fri, 15 Oct 2021 08:51:20 GMT</pubDate>
            <atom:updated>2021-10-21T16:06:11.742Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are involved with data and using Python programming, chances are that you have heard of, used and spent hours practising the pandas library. Even though pandas is a vast library used by millions, the user mostly uses a shallow version of its features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZciwtTQc--0k-8lTQxCIXA.png" /></figure><p>The foundational library pandas is used for analytics, data processing, and data science. It’s a huge project with a lot of options and depth.</p><p>Today, I will help you explore five features that will help you increase your productivity, reduce your workload, and reduce the pain of over-coding.</p><h3>1. apply()</h3><p>When working with pandas, you will encounter columns and rows of data called DataFrame. Data practitioners will alter the data they have at hand like changing the date-time format, changing the value, changing a string, or creating functions to manipulate the data.</p><p>The code for using a loop to manipulate data is given as follows:</p><pre>def crazy_func(x):<br>    return x.crazy</pre><pre>list =[]<br>for i in df[&#39;columns&#39;]:<br>   list.append(crazy_func(i))</pre><pre>df[&#39;columns&#39;] = list <br></pre><p>The apply() method of pandas library is a better way to insert the function:</p><pre>def crazy_func(x):<br>    return x.crazy</pre><pre>df[&#39;columns&#39;] = df[&#39;columns&#39;].apply(crazy_func) </pre><p>If you need to use other built-in modules and libraries, you just need to use the lambda function like:</p><pre>df[&#39;columns&#39;] = df[&#39;columns&#39;].apply(lambda x : x.lower())</pre><p>With these features, you can reduce a lot of processing time or ease the manual data manipulation.</p><h3>2. Logical Operation in Data Selection</h3><p>Here I assume that you are familiar with the .loc, .iloc and .ix which is the module to select a part of the dataframe. By selecting the pandas library, if you do not know how to select or and and with logic you created to select only the data you like. Pandas creates a logical operation inside those selection modules like this:</p><pre># AND &amp;<br>df.loc[(df.columns &gt;= 10) &amp; (df.columns2 == &#39;abc&#39;) ].columns</pre><pre>#OR |<br>df.loc[df.loc[(df.columns &gt;= 10) | (df.columns2 == &#39;abc&#39;) ].columns</pre><pre>#NOT ~<br>df.loc[df.loc[~(df.columns2 == &#39;abc&#39;) ].columns</pre><p>The first logical operation AND or &amp; selection will return the columns Series of the dataframe that satisfy the condition that columns are more than or equal to 10 <strong>and</strong> columns2 equal to abc.</p><p>The first logical operation OR or | selection will return the columns Series of the dataframe that satisfy the condition that columns more than or equal to 10 <strong>or</strong> columns2 equal to abc.</p><p>The first logical operation NOT or ~ selection will return the columns Series of the dataframe that satisfy the condition that columns2 is <strong>not</strong> equal to “abc”.</p><h3>3. Str Module</h3><p>In pandas, it has a variety of string manipulation that you might not know such as:</p><p>str.contain() this module will use a regular expression to find the substring inside the series and return the Boolean output. They are similar of this as str.find(), str.findall(), str.fullmatch() and else.</p><pre>pd.Series.str.contain(&#39;str&#39;)</pre><p>str.isalpha() this module run through the Series and find which of its row is all alphabetic or not as Boolean output. The similar module that find something like this are str.islower(), str.isdigit(), istitle() and else.</p><pre>pd.Series.str.isalpha()</pre><p>str.casefold() this module convert strings in the Series/Index to be capitalized and more. It is the bundle of string transformation module such as str.lower(), str.capitalize(), str.upper(), str.lower(), str.title() and else.</p><pre>pd.Series.str.lower()</pre><h3>4. Read data from Clipboard</h3><p>There are time when you see a table of data, and you want to turn it into dataframe to your further use. But most of the time, you will likely to copy or manually type and then import to your code, as follows:</p><pre>pd.read_clipboard()</pre><p>The function use the memory of your copy clipboard and read from that memory as input and show as the dataframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*Qn7WIA1M4yogT0i5imolEQ.png" /></figure><p>Suppose you copy this clipboard of the Delivery type and its abbreviation:</p><pre>pd.read_clipboard()</pre><pre>    Delivery type                      Abbreviation  <br>0  Care of post office                   1.0000  <br>1  Community mail box                    7.3891  <br>2  General post box(in capital cities)   54.5982  <br>3  Mail service                          403.4288  </pre><h3>5. Column manipulation</h3><p>Sometime you want to swap the position of the axis in the DataFrame, this simple can, many times, cause you a huge headache. Some might try to add the axis at to dataframe and trying to reposition the data by add and delete. That will take you at least 10–20 minutes in case of simple dataframe, but for large dataframe it is a tedious task.</p><p>Pandas has a solution for their problem which is the .swapaxes() module which simply put, swaps the parameters of the 2 axes:</p><pre>pd.DataFrame.swapaxes(axis1,axis2,copy=True)</pre><h3>Conclusion</h3><p>With this you can improve your data journey with lesser tedious work, yet this is not all the should-known features. There are many more Pandas can offer, but that is much more advance to put it here for friendly article. I hope you enjoy reading this and wish you a productive day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d86743790f04" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/5-should-known-data-manipulation-tricks-with-pandas-d86743790f04">5 Python Data Manipulation Tricks in Pandas</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 Tips for Building Data Science Projects to Get a Job]]></title>
            <link>https://python.plainenglish.io/4-tips-for-building-data-science-projects-to-get-a-job-97619056e3e0?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/97619056e3e0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Tue, 21 Sep 2021 14:55:49 GMT</pubDate>
            <atom:updated>2021-11-03T11:15:01.070Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>A guide to getting the right start to your dream job.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bIxPmVmtFsBeHBmD.jpg" /></figure><p>For anyone who wants to get into this data science field, especially one who does not have a Data Science degree, need to find a perfect substitute for a project.</p><p>If you ask someone in the Data Science field about what is the most factor to get you to this job except the degree, they will properly say Data Science project. In the tech field, a certificate or online course is the way for you to learn, you can show these in your resume and HR might seem interested and contact you. However, the Data scientist lead is the one who decides who gets a job, between you who learn Data science courses or the one who builds a Data Science project, the odd is not in your favour.</p><p>Here are the 4 tips to get you closer to your dream job.</p><h3>1. Show Your Approach in the Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*mEdf91AVg4JdPlhd.png" /></figure><p>Building your project from scratch shows many different aspects of data science tasks, starting from the problem, the solution to implementation. They will see your approach to tackling the data science problem and see if you are up for the task at their company. Most of the time that you go to the interview with the project, they will ask a lot about your project. Keep in mind that this is your perfect chance to show your approach and find a way to impress them.</p><p>You must deliberately tell them at the start how you find this problem solvable by Machine learning, then go for the Model selection, Data collection, Data Cleaning, and Modelling, then the implementation. Make sure to mention the challenge during the time you build the project to show them the thrill or the problem in your approach.</p><h3>2. Build Industry-oriented Project for the Company</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1EFsAKSbYixN7DhY.jpg" /></figure><p>When you decide what project to start with, you cannot simply find the one that is easy or the one that happens to be in someone tutorial so that you can copy and paste. That is too common and the company you go interview will probably already know from other candidates and find you no different from them.</p><p>The trick is that you specifically craft the project that is suitable for the industry that you want to enter and create an easy but creative project. Simply put, this project is enough to win the spot in the job market because it is simple, industry-oriented, and one-of-a-kind. This shows them your data science skills in creativity, problem-solving and domain expert, which are suitable for their company than other candidates.</p><h3>3. Focus on One Expertise</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*v2Kp3uulSivLhs17.jpg" /></figure><p>To get the job, you cannot be an all-rounder data scientist, most of the time company are expecting an expert on a specific skill, such as Natural Language Processing (NLP), Computer vision (CV), Signal processing, etc. You must find the sweet spot in your country that is less effort for you to fit it. So if you are not in an English-speaking country, having Natural Language Processing (NLP) as the expertise will raise your value a lot more than other expertise. Because CV and others are relatively the same and abundant in talent than the NLP.</p><p>But if you want to walk on other parts, just make sure you are an expert in the expertise you selected. You have to know the basic library they are using, the basic practice they expect to hear from you during the interview, and the ability to solve the problem using your expertise with sound and implementable solutions.</p><h3>4. Find the Insight from Your Data as Much as Possible</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*wy2Fl4kMgv46KitX" /></figure><p>People mostly misunderstand that data science is only to build a model to solve the problem. It is only the requirement for the data science task, for a great data scientist, he must know what is his data more than others who just see the data. You must show that you get the insight from the data as much as possible as you can tell other the story about this data. Interviewers do not want to hear only the accuracy, f1-score or other metrics. They mostly will ask what is the insight from this data is.</p><p>For example, you do fraud detection on an e-commerce website with machine learning, you need to explain that what is the common fraud case that happens on the e-commerce website, how much that fraud has cost the company, what are the most common characteristics of the fraud. This is the insight that is applicable and reproducible so that you show them your critical analysis, data insight, and data understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SzJuHGfUhNw-7QSI.jpeg" /></figure><h3>Goodbye Notes</h3><p>If you follow my tips, I can guarantee you that you will have a very high chance to stand out and get a job as a data scientist within a few months. Hope you like this article, and please follow me more for tips or review my old post for inspiration for a data science project.</p><p><em>More content at </em><a href="http://plainenglish.io/"><em>plainenglish.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97619056e3e0" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/4-tips-for-building-data-science-projects-to-get-a-job-97619056e3e0">4 Tips for Building Data Science Projects to Get a Job</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Price Control by Humans?]]></title>
            <link>https://medium.com/codex/is-price-control-by-human-9670ddd68082?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/9670ddd68082</guid>
            <category><![CDATA[pricing-strategy]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Tue, 14 Sep 2021 04:24:13 GMT</pubDate>
            <atom:updated>2021-09-14T11:19:44.073Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R5qmxMWZ00rbEZN9" /></figure><p>I bet everyone who clicks on this article finds themselves involved in the price optimization problem in mathematics, we once were studying in math class or more specific calculus class and asked <strong>“what is the use of this optimization problem?”</strong>, we were curious, as we seek the application and empirical study from the learning process where we had been suffered from the unknown use of the thing we tried to achieve. If you are involved in Computer science, economics, applied mathematics, engineer degree, or the mathematical application toward the real world you get a pretty much chance facing this problem more than others. I have the answer you once sought to find by providing evidence of the price optimization application.</p><h3><strong><em>What is price optimization? Its definition from Wikipedia is…</em></strong></h3><blockquote>“ <a href="https://en.wikipedia.org/wiki/Price_optimization#Price_optimization_software"><strong>Price optimization</strong></a> is the use of mathematical analysis by a company to determine how customers will respond to different prices for its products and services through different channels. It is also used to determine the prices that the company determines will best meet its objectives such as maximizing operating profit. The data used in price optimization can include survey data, operating costs, inventories, and historic prices &amp; sales. Price optimization practice has been implemented in industries including retail, banking, airlines, casinos, hotels, car rental, cruise lines, and insurance industries.” …Wikipedia…</blockquote><p>To put it simply, it is the price which is the maximum it should be charge according to the demand, supply, and the externality which can affect the profitability of the company, the price can be high if the profit can be an increase from the increase in price and low if it is otherwise. There are many factors that affect profitability( i.e. the number of firms, substitute products, brand loyalty, quality and etc.) and it is seemingly impossible that humans can control the price to its best potential result, assume the math is correct, that’s right! someone which more caliber has to step in and take this job, so humans create them, the invention of the price optimization software. It is a simple process, you can try in Microsoft Excel, given that you have data you can optimize it manually with machine computation power but recently, the era of the data-centric create a more powerful technology than just a computation power but the ability to compute and operate with dynamic self-operation while improve itself by an increase in training data or so-called machine learning and Artificial intelligence that create software of algorithm pricing.</p><h3>Why we should concern?</h3><p><strong>First of all</strong>, everyone has to admit <a href="https://insight.kellogg.northwestern.edu/article/principles_of_pricing">pricing is one of the most crucial pillars in the business world.</a> A lot of tasks we had to perform for many decades had been replaced by the better repetitive and brute force species, the robot. Those are the tasks where they require brute force or require pure computation power, the introduction of the MACHINE which will replace the job is simply because MACHINE can achieve what humans can’t in those tasks. The algorithm pricing is the software that serves the order by maximizing the given objective( exposure, profit, market share and etc. ), this introduction of algorithm <a href="https://www.kantify.com/article/3">pricing</a> is <a href="https://competitoor.com/dynamic-pricing-how-works/">changing the whole commerce </a>in many industries, mostly e-commerce and data-driven business. It has been for a long time ago that the businessman charges the price according to their knowledge, some charge from guessing between a certain range, some imitate the competitor. There are many pricing strategies out there but not a single one choose the price that optimization throughout time according to all relevant factors that updated as that factor change, price normally, that handled by human, changes period by period with the stability, but if AI is the one who controls the price, it will change as the information its receive updated the knowledge to the best outcome. Imagine that businessman had charge you a high price, but that high price you are still willing to pay, if AI charge that price with respect to profit maximization price, the outcome would be they trying to rip every piece of benefits it can gain and making sure people still buy it. It is not it is influenced to the daily business life at a slow pace but now many companies and start-ups had found the price optimization software company and compete which each other to provide a better algorithm pricing at better quality and lower price to the level that any small company can buy. <strong>For example</strong><a href="https://www.pricefx.com/site/"> Pricefx</a> for price competition, <a href="https://www.ibm.com/th-en/marketplace/omni-channel-pricing">IBM Omnichannel intelligence pricing</a> specialize in pricing and promotion and, <a href="https://www.intelligencenode.com/">IntelligenceNode</a> for e-commerce business and Technology.</p><h3>How Pricing Algorithm work</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*KECno37ZCywkb6JJ" /></figure><p>One empirical algorithm pricing that monopolizes its platform is <strong>Airline flight tickets </strong>algorithm pricing. The airline industry is one of the most innovative adaptive industries, but this innovation does not help the consumer for the better, faster, or cheaper service, it helps the airline achieve the impossible task for human, pricing strategy. It works to serve the objective, maximize profit from the <a href="https://flightfox.com/tradecraft/how-do-airlines-set-prices">demographics and available data.</a></p><p>First, it defines the price range from the airfare class such as business, economics, and premium. The more privileged class the more money its charges to the consumer, this is basic human still able to perform, the second step is selling according to profit maximization. To achieve maximum profit, AI has no need to charge one consumer at the same price as other consumers, it keeps the number of available seats. When the available seat starts to drop or scarce, it charges a higher price, for every ticket bought, the price of other tickets rise and if you try to buy a lot of ticket at one time, all of your tickets are averagely charged higher than buying one ticket. Not only its charge <a href="https://en.wikipedia.org/wiki/Price_discrimination">price discrimination</a>, the notion that charging a different price to a different consumer with the same product is provided. Ok, this might arguably that they might cost more if the consumer buys the ticket the closer to the day airline departure, it might increase the management, ordering and preparing food, human resource, and asset allocation or another argument as the closer the fight date the higher the demand. The third one is optional refundable add-on price, it plays with the uncertainty preference of the consumer but a still a minor one, the fourth one is much more clever, a golden combination of the profit is the price and cost, thus what it did is restrict the available seats so that it can both charge the high price of monopoly and reserve the fuel for the connecting route, for example, you travel from London to Miami at $1000 the which Miami is connected route to Bogota, but the AI price the ticket from London to Miami more than one trip direct to Bogota, even though the time travel is lesser. What it did is to discourage people from reserve those seats and keeping that seat to lower the fuel usage and restrict the output it maximizes profit while at the same time keep the seat available so people from Miami can reserve the seat support with the prediction analysis they perform, the amount it should reserve for a future seat that can jack up the price to maximize profit,<a href="https://www.cnbc.com/2018/08/03/how-do-airlines-price-seat-tickets.html"> for further read</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9zJmpGDSXj0jyVaD" /></figure><p>Not only the airline price ticket is controlled by the AI, but the e-commerce platform, Retail store that uses ePayment, Supply Chain industry, Insurance, and Healthcare. Not only it can perform price optimization to the level that is far superior to human-being, but it can also use the tactic of collusion or corporate pricing. In economics, corporate pricing is the price where the firm decides to corporate and lessen the competition in the market so that all the firms can enjoy the high price with no consideration of price competition or price war. The research from <strong>Calvano</strong>, <strong>Calzolari</strong>, <strong>Denicolò</strong>, and <strong>Pastorello</strong> run experiments with AI agents powered by reinforcement learning in controlled environments (computer simulations) and find the uncommunicative AI agent perform the tactic collusion. Even though there are still no evidence support of tactic collusion in the real world or we still lack the ability to detect it.</p><h3>Can algorithm pricing be good for society?</h3><p>All of these are controlling be algorithm pricing and the antitrust or the <strong>Federal Trade Commission</strong> still not able to find the proper way to against the technology as they cannot simply stop the technology if they don’t know the consequence of the regulation. It looks like I have said the bad stuff about the Algorithm pricing, the algorithm is not a bad machine that should be destroyed or keep in inventory or the manipulation of an evil action, it is tools which depends on the use. as we know it solves the optimization toward the objective function which I had referred to the bad side of the story, the profit side so if I told only the side that the technology is bad by injecting the greedy objective the whole society will be greedy pricing, but if the algorithm can be regulated using the social welfare function or the function which in economics stand for the social benefit of the whole population in the market rather than maximizing the private benefit but the social benefit. But who would like to maximize their profit by restricting to the social benefits, here is not rational for the businessman to do so but if the government regulation to fixed the level of profit maximization or they create AI that can detect any collusion or the monopoly abusive pricing and punish that could be a solution for controlling the Algorithm pricing.</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/price-control-human-theethat-anuraksoontorn/"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9670ddd68082" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/is-price-control-by-human-9670ddd68082">Is Price Control by Humans?</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Word similarity extraction with Machine learning Python]]></title>
            <link>https://medium.com/geekculture/word-similarity-extraction-with-machine-learning-python-b90c8cfc7c73?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/b90c8cfc7c73</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[word2vec]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Tue, 14 Sep 2021 03:48:57 GMT</pubDate>
            <atom:updated>2021-09-14T13:11:30.943Z</atom:updated>
            <content:encoded><![CDATA[<p>Machine learning, Deep learning, and AI had been around you for a decade, however it is now more visible than any other past such that everyone are using the AI-product from every day life such as IG filter, Netflix movie recommendation, Junk-mail detection and many more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PKizpeUoLkZCKdl_.jpg" /></figure><p>In recent past, this technology are now using mostly for marketing to acquire, retain and grow their customer. It used to be replace the tedious and repetitive task, but now it goes to analytic and creative. And one is surprising soar in few AI-powered start-up is the text extraction.</p><p>Text is one of the way the user experiences to express their thought in the internet or read the document inside your product. For us to be able to gain the useful information of the text documents is another level, it is helpful for us and leading us to more information about the word usage by user or consumer.</p><p>I do not want to fix the data for you guys, so I will use a web scraping technique so that you can use any website you want for this word similarity extraction.</p><h3>Getting Data with Beautiful soup</h3><p>Beautifulsoup is one of the strongest Python library for web scraping, it is the perfect job for getting the data from the HTML, XML, and other Markup language website. To get the Beautifulsoup run this line on your command line. For those who like to explore more about this library check <a href="https://programminghistorian.org/en/lessons/intro-to-beautiful-soup">their site here</a>.</p><pre>pip install beautifulsoup4</pre><p>You also need to install the “parser” for interpreting the HTML element inside the website. You can run the pip to install <strong>lxml</strong> parser.</p><pre>pip install lxml</pre><p>First, import the library require for getting the data from the website. One is the Beautifulsoup which is bs4, another one is the urllib module which is the library for handling the fetching URLs. But we will use only the request protocol to opening and reading the URLs.</p><pre>import bs4 as bs<br>import urllib.request</pre><p>The code to get the data has three step on getting data from the Wikipedia website (you can choose any other website if you want).</p><ol><li>Send the URL request with the urllib to open and read the website, here I use the Wikipedia about machine learning you just change the parameter to any website you like.</li><li>Read the article with bs4 parser, here is when the bs4 will work to load the HTML of the website, then we will select a part that contain the text information to work on later. The text part is contain inside the paragraph tag of the HTML.</li><li>After we get the paragraph tag we need to remove the HTML markup language along with it, and keep only the text.</li></ol><pre># send the url request to open and read the website<br>scrapped_data = urllib.request.urlopen(&#39;<a href="https://en.wikipedia.org/wiki/Machine_learning">https://en.wikipedia.org/wiki/</a>Machine_learning&#39;)</pre><pre># read the article with beautiful soup lxml parser<br>article = scrapped_data.read()<br>parsed_article = bs.BeautifulSoup(article,&#39;lxml&#39;)</pre><pre># parse only the paragraph tag inside the website HTML<br>paragraphs = parsed_article.find_all(&#39;p&#39;)<br></pre><pre># get the string of the website from the paragraph tag<br>article_text = &quot;&quot;<br>for p in paragraphs:<br>    article_text += p.text</pre><p>If you use the same url as me what you see will be looks like this.</p><pre>print(article_text)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3KyUahXyaMv5ldTxEhOgg.png" /></figure><h3>Text Preprocessing</h3><p>For those who not familiar with the NLP or ML with text, before you jump into getting the word similarity, first thing we have to do is to prepare the unstructured text into structure format. I will use the Natural-Language-Toolkit or NLTK for the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*empClzN19ZXvk1bz.jpeg" /></figure><p>In the text preprocessing or Natural Language Processing, before we can use text in machine learning task we need to do one thing first, which is tokenization.</p><p>Computer do not actually understand the text or string as human do, what the tokenization do is separate the word out of the sentence so that the computer can remember each word. The tokenized word will then be used as a id or number for computing in the code.</p><pre>import nltk<br>nltk.download(&#39;punkt&#39;)</pre><pre>import string</pre><p>In using nltk, some part of the module need to be download manually outside the pip install. Here is the ‘punkt’, which is the punctuation tokenization, that do not purely tokenize word from the sentence but take the punctuation into the consideration.</p><pre>from nltk.corpus import stopwords<br>from nltk.tokenize import sent_tokenize, word_tokenize</pre><pre>processed_article = article_text.lower()<br>processed_article = re.sub(r&#39;\s+&#39;, &#39; &#39;, processed_article)<br>processed_article = re.sub(r&#39;[!&quot;#$%&amp;\&#39;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~]&#39;,&#39;&#39;, processed_article)</pre><pre># Preparing the dataset<br>all_sentences = sent_tokenize(processed_article)</pre><pre># <br>all_words = [word_tokenize(sent) for sent in all_sentences]</pre><p>Another thing we just need to do is removing the stopwords, it is the group of word that use in the language to serve purely on the purpose of grammatical usage, it does not really generate meaningful relationship or insight to us human.</p><pre>import nltk<br>from nltk.corpus import stopwords</pre><pre>nltk.download(&#39;stopwords&#39;)</pre><pre># Removing Stop Words<br>stops = set(stopwords.words(&#39;english&#39;))<br>for i in range(len(all_words)):<br>    all_words[i] = [w for w in all_words[i] if w not in stops]</pre><p>After we remove the stopwords, we can use the list of word to calculate the text similarity by using the Word2Vec model.</p><h3>Word2Vec</h3><p>Word2Vec is the algorithm that turn word into vector. By turning it to vector, it allow the word to be computed, quantifiable and measurable. This allow a word to show the relationship with another word of how far away each other are. We can use this to see how the word in our text have any meaning related to another word.</p><p>The similarity of the word is insightful because when we use a world in life, we tend to use many different word but mean the same things. It is the same when you sell your product online, you call it “SuperProduct” from your company “SuperSeller”. Consumer like your product, but normally they will change the name to fit it with their foe, it will become like “ I but an SP from the green store.”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*H2WQPZu-_fzIfDry.png" /></figure><p>In this case, the SP is the abbreviation of the “SuperProduct”, this is the common human communication that trying to minimize the language usage to the level that it still can be used for the communication. The “green store” is your company or store called by your customer. In term of marketing, this information is insightful but most of the marketing already know the word customer use for calling their product or company.</p><p>However, these kind of thing will always happen every time the company expose new information to the customer, by having marketing team follow and track campaign for every feedback comment is time-consuming and ineffective. The real application is to automate the process and reduce time for the marketer for finding these new synonym create by customer so that the marketer can work on improve customer satisfaction, acquisition, or target repositioning.</p><h3>Word similarity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*nxjINwyic27gOb8j.png" /></figure><p>Gensim is a free open-source Python library for representing documents as semantic vectors, as efficiently (computer-wise) and painlessly (human-wise) as possible. To use the word2vec algorithm for our data, we need to train the word2vec model with our data.</p><pre>from gensim.models import Word2Vec</pre><pre>word2vec = Word2Vec(all_words, min_count=2)</pre><p>Importing the Word2Vec module and declare the parameter as our words, and the minimum count or frequency that will be keep in the model. The trianing time depends on your data, but if you use the same Wiki text as me, it should be less than a few minutes.</p><pre>vocabulary = word2vec.wv.vocab</pre><p>After we create the model, we can access all the word to query by using the wv.vocab but when we want to see the word similarity, we will use wv.most_similar(str). Here I put string “data” inside to see what is the word that have semantic relationship as “data”.</p><pre>word2vec.wv.most_similar(&#39;data&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*pQ-NlaLkj6MfiF6QvWLtOw.png" /></figure><p>The result shows all the word related to the word data, with the similarity score from 1 to 0, the higher the score the more similar the word. It seem that wikipedia have a low variance of topic when it specific on the context. So the similarity does not reflect to the extent of apply to the real world, but when we go with wider and diverse mind of consumer data, that will be a great data to mine the keywords.</p><h3>Thank note and further work</h3><p>Thanks you all for reading, If you enjoy my work, follow me for more article about applied ML. I am currently working many projects, but if you guys want to read anything in particular, comments and I will write one for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b90c8cfc7c73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/word-similarity-extraction-with-machine-learning-python-b90c8cfc7c73">Word similarity extraction with Machine learning Python</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Estimate the Price of a Book by Its Cover Using Image Regression and CNN in Python]]></title>
            <link>https://python.plainenglish.io/judge-the-book-price-by-its-cover-with-image-regression-using-cnns-python-770707e4fe67?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/770707e4fe67</guid>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 11:06:05 GMT</pubDate>
            <atom:updated>2021-10-27T03:07:12.073Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0oKyx1FYzjl1DvAH.jpg" /></figure><p>Today I will introduce you to the Deep learning application of Computer vision to simply estimate the worth of a book in dollars, entirely on the book cover. I do not see many articles on Image Regression so I’m writing this for you guys.</p><p>Note: It has been a long time since my last post, I have to admit being a Data Scientist leaves me less time for a side-project or writing articles (or, maybe it’s just my laziness).</p><p>If you’re interested in coding alongside this article go check this <a href="https://github.com/Thundertung/Book-Price-regression-CNNs">GitHub</a>.</p><h3><strong>Data</strong></h3><p>The data that will be used here can be downloaded from the Kaggle dataset provided <a href="https://www.kaggle.com/lukaanicin/book-covers-dataset">here</a>. It contains the data of books’ characteristics from the BookDepository website, but we will mainly use the book cover image to train the deep learning model. Now let’s see what the book data look like.</p><pre>import pandas as pd <br>df= pd.read_csv(&#39;main_dataset.csv&#39;)</pre><pre>df</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6r1F99h3WkhrEZMoipJOA.png" /></figure><p>The data has a shape of (32581, 11) but in this article, we will solely focus on Book cover image data and the price tag which is given in columns “image” and “price” ( not the old price). If we see carefully the data we’ve loaded, we will find that we do not have the image data with us except the image URLs as given in the “image” column. The reason is that image data is unstructured data that cannot be the same format as other data.</p><p>Leaving those reasons aside, how can I access the image data in this format? I need to create a function to fetch the images from those URLs and load all of them to the folder image.</p><h3>Take a Look at the Image</h3><pre>from matplotlib import pyplot as plt<br>import numpy as np<br>import urllib<br>import cv2</pre><pre>def show_image_from_url(https://medium.com/image_url):</pre><pre>&quot;&quot;&quot;<br>  Fetches image online from the image_url and plots it as it is using matplotlib&#39;s pyplot&#39;s image show<br>  &quot;&quot;&quot;</pre><pre>response = urllib.request.urlopen(image_url)<br>  image = np.asarray(bytearray(response.read()), dtype=&quot;uint8&quot;)<br>  image_bgr = cv2.imdecode(image, cv2.IMREAD_COLOR)<br>  image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)<br>  plt.imshow(image_rgb), plt.axis(&#39;off&#39;)</pre><p>This function will fetch you the image from the image URL and use the matplotlib and OpenCV libraries to show you the image. Let’s see how the function works:</p><pre>plt.figure()<br>show_image_from_url(https://medium.com/df[&#39;image&#39;].loc[10])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*iOscfmkrwEOK4VczJho5Jg.png" /></figure><p>We got The Clever Guts Diet’s cover written by Michael Mosley. Now you see that we can display the image from the given URL, it is time for us to fetch the image and load it to your computer for putting it in Deep learning.</p><h3>Image Preprocessing</h3><pre>def image_processing(image_url):</pre><pre>&quot;&quot;&quot;Converts the URL of any image to an array of size 100x1 <br>    The array represents an OpenCV grayscale version of the original image<br>    The image will get cropped along the biggest red contour (4 line polygon) tagged on the original image (if any)<br>    &quot;&quot;&quot;</pre><pre>#Download from image url and import it as a numpy array<br>    response = urllib.request.urlopen(image_url)<br>    image = np.asarray(bytearray(response.read()), dtype=&quot;uint8&quot;)</pre><pre>#Read the numpy arrays as color images in OpenCV<br>    image_bgr = cv2.imdecode(image, cv2.IMREAD_COLOR)</pre><pre>#Convert to HSV for creating a mask<br>    image_hsv = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2HSV)</pre><pre>#Convert to grayscale that will actually be used for training, instead of color image <br>    image_gray = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2GRAY)</pre><pre>#Create a mask that detects the red rectangular tags present in each image<br>    mask = cv2.inRange(image_hsv, (0,255,255), (0,255,255))</pre><pre>#Get the coordinates of the red rectangle in the image, <br>    #But take entire image if mask fails to detect the red rectangle<br>    if len(np.where(mask != 0)[0]) != 0:<br>        y1 = min(np.where(mask != 0)[0])<br>        y2 = max(np.where(mask != 0)[0])<br>    else:<br>        y1 = 0                                     <br>        y2 = len(mask)</pre><pre>if len(np.where(mask != 0)[1]) != 0:<br>        x1 = min(np.where(mask != 0)[1])<br>        x2 = max(np.where(mask != 0)[1])<br>    else:<br>        x1 = 0<br>        x2 = len(mask[0])</pre><pre>#Crop the grayscle image along those coordinates<br>    image_cropped = image_gray[y1:y2, x1:x2]<br>    if image_cropped.size ==0:<br>        print(image_url)<br>        return image_cropped<br>    else:<br>    #Resize the image to 100x100 pixels size<br>        image_100x100 = cv2.resize(image_cropped, (100, 100))</pre><pre>#Save image as in form of array of 10000x1<br>        image_arr = image_100x100.flatten()</pre><pre>return image_arr</pre><p>That is quite a long function because it is not just loading the image, but also doing the image preprocessing — converting to grayscale, cropping, and resizing the image. All this preprocessing is to make the cover data more consistent, and suitable for the upcoming deep learning.</p><p>The stages of preprocessing are:</p><h4><strong>Grayscale</strong></h4><p>The main reason why grayscale representations are often used for extracting descriptors instead of operating on colour images directly is that <strong>grayscale simplifies the algorithm and reduces computational requirements. </strong>Most of the time, colour does not matter in HSV format, grayscale can do the same job with much less effort.</p><h4><strong>Cropping</strong></h4><p>Image Cropping is a common photo manipulation process, which <strong>improves the overall composition by removing unwanted regions. </strong>It is obvious that the corner of the image is not the focal point of how humans perceive the image, we only focus on the centre. The book cover’s corner does not leave any explanatory power to the price of its book and mostly it is the same.</p><h4><strong>Resizing</strong></h4><p>To facilitate mini-batch learning, we <strong>need to have a fixed shape for the images inside a given batch</strong>. This is why an initial resizing is required. We first resize all the images to (300 x 300) shape and then learn their optimal representation for the (150 x 150) resolution. The resizing does not help us in any way for improving the model, it is just the way data pass through the neural network, which requires the same structure.</p><h3>Load the Data</h3><pre>from tqdm import tqdm</pre><pre>for url in tqdm(df[&#39;image&#39;].tolist()[:]): # 3000 urls is enough<br>    image_list.append(image_processing(url))</pre><p>Now we apply the function to the image URL column to get the image data. Please take note that this will take you an hour or two to load the whole dataset. If you want to work fast you can load at least 2000 URLs which will take you about 20 to 30 minutes.</p><p>Noted it here, that your image is no longer a PNG or JPEG. It is now vectors of pixels with grayscale in NumPy object. That is what you need to pass along in your Deep learning model.</p><pre>X = np.array(image_list)<br>np.save(&#39;processed_100x100_image.npy&#39;,X/255,allow_pickle=True)</pre><pre>book_array = np.load(&#39;processed_100x100_image.npy&#39;,allow_pickle=True)</pre><p>Now that you load the data and save it in image_list, it is just stored in your code, which is bad practice, because you have to waste 30 minutes every time you want to get those data again. So here you need to save those processed image data into your local computer.</p><h3>Drop Images of Different Dimension and Clean the Price Tag</h3><p>To pass along the data into the deep learning model, all of them need to be at the same dimension which is 100x100. But when I look at the processed image NumPy array I find that there is some error that some images do not have the same dimension as the others so we need to remove those before going to train the model.</p><pre>#remove non 10000 dimension out of the numpy array<br>X =[]<br>exclude =[]<br>for i in range(len(book_array)):<br>    if book_array[i].shape == (10000,):<br>        X.append(book_array[i])<br>    else:<br>        exclude.append(i)<br>X =np.array(X)</pre><pre>#also remove from the dataframe<br>df.drop(df.index[exclude],inplace=True)</pre><p>Here, I remove the one that does not have the same dimension as 100x100 and also remove those data from the dataframe as we need to use the price tag data where we don’t want any complicated data mapping or mismatch.</p><pre>import re</pre><pre>df[&#39;price&#39;] = df.price.apply(lambda x :re.sub(&quot;[^0-9.]&quot;,&#39;&#39;,x)).apply(float)</pre><p>In the price tag, there will be a non-numeric value such as ‘$’, ‘dollars’, etc., which is not applicable for running the deep model. I will use the regex to keep only the numbers.</p><h3>Sample Preprocessed Image</h3><pre>np.random.seed(17)<br>for i in np.random.randint(0, len(book_array), 2):<br>    plt.figure()<br>    plt.imshow(book_array[i].reshape(100, 100), cmap=&#39;gray&#39;), plt.axis(&#39;off&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*wu00WNHHikJaZp1y1-aSTg.png" /></figure><h3>Convolutional Neural Network</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pIXFqqu1Ehcf68We.jpeg" /></figure><p>To estimate the price of the book, in this task I will use Convolutional Neural Networks or CNN, one of the most effective deep learning models for <strong>any type of prediction problem involving image data as an input</strong>.</p><p>To put it simply, the CNN algorithm will <em>reduce the images into a form that is easier to process, without losing features that are critical for getting a good prediction.</em></p><pre>from tensorflow.keras.utils import to_categorical<br>from tensorflow.keras.models import Sequential<br>from tensorflow.keras.layers import Conv2D, MaxPool2D, BatchNormalization<br>from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense<br>from tensorflow.keras.losses import categorical_crossentropy<br>from tensorflow.keras.optimizers import Adam<br>from tensorflow.keras.callbacks import ModelCheckpoint<br>from tensorflow.keras.models import load_model</pre><pre>#Define a Convolutional Neural Network Model<br>model = Sequential()</pre><pre>model.add(Conv2D(filters = 16, kernel_size = (3, 3), activation=&#39;relu&#39;,<br>                 input_shape = input_shape))<br>model.add(BatchNormalization())<br>model.add(Conv2D(filters = 16, kernel_size = (3, 3), activation=&#39;relu&#39;))<br>model.add(BatchNormalization())<br>model.add(MaxPool2D(strides=(2,2)))<br>model.add(Dropout(0.25))<br>model.add(Conv2D(filters = 32, kernel_size = (3, 3), activation=&#39;relu&#39;))<br>model.add(BatchNormalization())<br>model.add(Conv2D(filters = 32, kernel_size = (3, 3), activation=&#39;relu&#39;))<br>model.add(BatchNormalization())<br>model.add(MaxPool2D(strides=(2,2)))<br>model.add(Dropout(0.25))</pre><pre>model.add(Flatten())<br>model.add(Dense(512, activation=&#39;relu&#39;))<br>model.add(Dropout(0.25))</pre><pre>model.add(Dense(1024, activation=&#39;relu&#39;))<br>model.add(Dropout(0.4))<br>#model.add(Dense(n_classes, activation=&#39;softmax&#39;))<br>model.add(Dense(1, activation=&#39;relu&#39;))<br>learning_rate = 0.001</pre><pre>model.compile(loss = &#39;mse&#39;,<br>              optimizer = Adam(learning_rate))</pre><pre>model.summary()</pre><pre>Model: &quot;sequential_1&quot;<br>_________________________________________________________________<br>Layer (type)                 Output Shape              Param #   <br>=================================================================<br>conv2d_4 (Conv2D)            (None, 98, 98, 16)        160       <br>_________________________________________________________________<br>batch_normalization_4 (Batch (None, 98, 98, 16)        64        <br>_________________________________________________________________<br>conv2d_5 (Conv2D)            (None, 96, 96, 16)        2320      <br>_________________________________________________________________<br>batch_normalization_5 (Batch (None, 96, 96, 16)        64        <br>_________________________________________________________________<br>max_pooling2d_2 (MaxPooling2 (None, 48, 48, 16)        0         <br>_________________________________________________________________<br>dropout_4 (Dropout)          (None, 48, 48, 16)        0         <br>_________________________________________________________________<br>conv2d_6 (Conv2D)            (None, 46, 46, 32)        4640      <br>_________________________________________________________________<br>batch_normalization_6 (Batch (None, 46, 46, 32)        128       <br>_________________________________________________________________<br>conv2d_7 (Conv2D)            (None, 44, 44, 32)        9248      <br>_________________________________________________________________<br>batch_normalization_7 (Batch (None, 44, 44, 32)        128       <br>_________________________________________________________________<br>max_pooling2d_3 (MaxPooling2 (None, 22, 22, 32)        0         <br>_________________________________________________________________<br>dropout_5 (Dropout)          (None, 22, 22, 32)        0         <br>_________________________________________________________________<br>flatten_1 (Flatten)          (None, 15488)             0         <br>_________________________________________________________________<br>dense_3 (Dense)              (None, 512)               7930368   <br>_________________________________________________________________<br>dropout_6 (Dropout)          (None, 512)               0         <br>_________________________________________________________________<br>dense_4 (Dense)              (None, 1024)              525312    <br>_________________________________________________________________<br>dropout_7 (Dropout)          (None, 1024)              0         <br>_________________________________________________________________<br>dense_5 (Dense)              (None, 1)                 1025      <br>=================================================================<br>Total params: 8,473,457<br>Trainable params: 8,473,265<br>Non-trainable params: 192</pre><p>We will create a CNN model with four Convolutional layers with filters of [16,16,32,32] and then this architect will convert pooled feature map to a single column that is passed to the fully connected layer.</p><pre>save_at = &quot;model_regression.hdf5&quot;<br>save_best2 = ModelCheckpoint (save_at, monitor=&#39;val_accuracy&#39;, verbose=0, save_best_only=True, save_weights_only=False, mode=&#39;max&#39;)</pre><pre>#set up the x, y for training </pre><pre>Y = np.array(df.price.tolist())<br>X_test = X[30000:,]<br>Y_test = Y[30000:,]<br>X_train, X_val, Y_train, Y_val = train_test_split(X[:30000,], Y[:30000,], test_size=0.15, random_state=13)</pre><pre>img_rows, img_cols = 100, 100<br>input_shape = (img_rows, img_cols, 1)</pre><pre>X_train = X_train.reshape(X_train.shape[0], img_rows, img_cols, 1)<br>X_test = X_test.reshape(X_test.shape[0], img_rows, img_cols, 1)<br>X_val = X_val.reshape(X_val.shape[0], img_rows, img_cols, 1)</pre><p>The first three lines are setting parameters for saving the model when the training is finished. The rest is to set up the target or the price as y for both training and testing set. And now we are training the model with 15 epochs and batch_size of 100. If your computer is resourceful enough go ahead and put as much as batch_size then run the following code:</p><pre>history = model.fit( X_train, Y_train, <br>                    epochs = 15, batch_size = 100, <br>                    callbacks=[save_best2], verbose=1, <br>                   validation_data = (X_val, Y_price_val))</pre><p>Here you can see the model is working overfitting, you can see that the green line or validation loss is around 200 while the red line or training loss stays lower and lower. As I set the model to save the lowest validation loss, our model performance will be saved at the seventh epoch.</p><pre>plt.figure(figsize=(6, 5))</pre><pre># training loss<br>plt.plot(history.history[&#39;loss&#39;], color=&#39;r&#39;)</pre><pre>#validation loss<br>plt.plot(history.history[&#39;val_loss&#39;], color=&#39;g&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*d8XRJtDAilYB149YeP9Qyw.png" /></figure><p>Let see what our model result will be:</p><pre>Y_pred = np.round(model.predict(X_test))</pre><pre>np.random.seed(23)<br>for rand_num in np.random.randint(0, len(Y_test), 10):<br>    plt.figure()<br>    plt.imshow(X_test[rand_num].reshape(100, 100),cmap=&#39;gray&#39;), plt.axis(&#39;off&#39;)<br>    if np.where(Y_pred[rand_num] &lt; 10)[0].sum() == np.where(Y_test[rand_num] &lt;10)[0].sum():<br>        plt.title(str(Y_pred[rand_num]) +&#39; dollars&#39;, color=&#39;g&#39;)<br>    else :<br>        plt.title(str(Y_pred[rand_num]) +&#39; dollars&#39;, color=&#39;r&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*6oWWb-GVoWfyZax8l-4k1w.png" /></figure><h3>Further Work</h3><p>I have co-built with you a book cover price predictor, hope you can apply this to other applications as well. Just note here that this model still needs adjusting for overfitting to make it work well for the real world. Here is what you can continue with the model for solving overfitting in CNN.</p><ol><li>Add more data</li><li>Use data augmentation</li><li>Use architectures that generalize well</li><li>Add regularization (mostly dropout, L1/L2 regularization are also possible)</li><li>Reduce architecture complexity.</li></ol><p>I hope you guys enjoy this reading week project on deep learning. If you guys want to explore more about my past and future work, click follow! I will now publish two ML/DL articles every week.</p><p><em>More content at </em><a href="http://plainenglish.io/"><em>plainenglish.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=770707e4fe67" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/judge-the-book-price-by-its-cover-with-image-regression-using-cnns-python-770707e4fe67">How to Estimate the Price of a Book by Its Cover Using Image Regression and CNN in Python</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Speech-To-Text API Tutorial with Python]]></title>
            <link>https://medium.com/codex/google-speech-to-text-api-tutorial-with-python-2e049ae3f525?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e049ae3f525</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Wed, 08 Sep 2021 13:47:24 GMT</pubDate>
            <atom:updated>2021-09-11T11:19:06.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*GZM4aMrNlWSqjVXU.png" /></figure><p>Recently, I had the opportunity to explore one of the greatest deep learning algorithm, Speech-to-text, for my company project to transcript the audio voice and remove the sensitive and personal data.</p><p>If you are first time user of the google API like me, I will walk you through I will guarantee that out of this article you will be able to use the google API.</p><h4>What is API? According to Wikipedia API is</h4><blockquote>“An <strong>application programming interface</strong> (<strong>API</strong>) is a connection between <a href="https://en.wikipedia.org/wiki/Computer">computers</a> or between <a href="https://en.wikipedia.org/wiki/Computer_program">computer programs</a>. It is a type of software <a href="https://en.wikipedia.org/wiki/Interface_(computing)">interface</a>, offering a service to other pieces of <a href="https://en.wikipedia.org/wiki/Software">software</a>.<a href="https://en.wikipedia.org/wiki/API#cite_note-1">[1]</a> A document or standard that describes how to build such a connection or interface is called an <em>API specification</em>. A computer system that meets this standard is said to <em>implement</em> or <em>expose</em> an API. The term API may refer either to the specification or to the implementation.”</blockquote><p>To put it simply, it is the usage of other software (API) by connecting your computer to their computer to request for usage of that specific software (API). Yes, google let everyone borrow or rent their APIs in exchange of the price and sometime free. If we want to use the service on we can simply visit their site and test it for free, but if you want to use it in order to integrate with your program or code you need to sign up on the Google Cloud platform.</p><p>First thing first you have to go to this website : <a href="http://cloud.google.com/">cloud.google.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nU3OLOhq0bpX9AV18cUNrg.png" /></figure><p>For a first cloud platform timer. A Cloud platform refers to the operating system and hardware of a server in an Internet-based data center. It allows software and hardware products to co-exist remotely and at scale. Think of the cloud platform as the place where you can put your code their to work without worrying about the server, maintenance and etc., but in this article what we use the cloud is to borrow their software of the speech-to-text and their computing power to operate the speech-to-text API on our computer.</p><h3>Entering Google cloud platform</h3><p>To enter their google cloud platform click “<strong>Go to Console</strong>” button. And you will enter this landing page of the GCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNKQ6wbhShE_Y0_rb3X5LQ.png" /></figure><p>This page is the summary page for the usage of the GCP including the APIs, billing and the project. Before using any of their service, you have to setup your credit card on you gmail account for google service. But here you do not need to worry on the price because GCP will give you the $300 credit for usage and will not automatically use your credit card if the free credit is exceeded.</p><p>To use the API in GCP, you first click the <strong>APIs and Service</strong> on the right hand side. You will find this page and click on <strong>Library </strong>to search for the API that you looking for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUsOrfEn-zSZZh8pySsOlQ.png" /></figure><h4>Search the Cloud speech-to-text API</h4><p>At first it will show the blue button as <strong>Enable </strong>after you click it, it will allow your account to connect to the API. Then it will change to <strong>Manage </strong>now you already access one step of google API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*higVyis1Ru0SXgi7eHapCQ.png" /></figure><p>The last thing you have to do in order to use GCP with APIs is to get the credential keys. Go back to <strong>APIs and Service page</strong> and click <strong>Credentials<br></strong> now click on your S<strong>ervice Accounts</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fC5GtTFl47FKEnegSIT8_Q.png" /></figure><p># Now it is quite sensitive for me to share picture for the following detail. <br>I will not show the picture to access and create the credential.</p><h3>How to get the google service account credentials</h3><p>After you access the <strong>Service Accounts</strong> page,</p><ol><li>you click on <strong>Key </strong>tab</li><li>Click on <strong>Add Key</strong> and select <strong>Create new key</strong></li><li>Select <strong>JSON </strong>to download the key as json file to use for accessing GCP api</li><li>save your JSON file to google_secret_key.json or other name if you prefer</li></ol><p>Now you have all set and ready to use the API on your code.</p><h3>Cloud Speech-to-text API on python</h3><p>To use the API in python first you need to install the google cloud library for the speech. By using pip install on command line.</p><pre>pip install google-cloud-speech</pre><p>Now you are accessing the API of the GCP let’s write some code. First we import the minimum require code for using the APIs.</p><pre>from google.cloud import speech<br>import os<br>import io</pre><p>Create a client instance for sending the request API and setting the Google credentials for the API request. Here is the code to let your os know what file contain the google credentials. you have to put the credential file within the same folder as your code or set the path to that json file.</p><pre>#setting Google credential<br>os.environ[&#39;GOOGLE_APPLICATION_CREDENTIALS&#39;]= &#39;google_secret_key.json&#39;</pre><pre># create client instance <br>client = speech.SpeechClient()</pre><p>Read the audio file, you can try other audio format than the WAV file but to ensure it is workable I recommended to stay with WAV or MP3 format. If you want to test the same audio as me you can go to this <a href="https://www.voiptroubleshooter.com/open_speech/american.html">open source audio file</a>.</p><pre>#the path of your audio file<br>file_name = &quot;OSR_us_000_0010_8k.wav&quot;</pre><pre>with io.open(file_name, &quot;rb&quot;) as audio_file:<br>    content = audio_file.read()<br>    audio = speech.RecognitionAudio(content=content)</pre><p>Now to use the speech first we need to put the configuration for the speech-to-text engine that we will you can look into the parameter at <a href="https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig">here</a>.</p><pre>config = speech.RecognitionConfig(<br>    encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16,<br>    enable_automatic_punctuation=True,<br>    audio_channel_count=2,<br>    language_code=&quot;en-US&quot;,<br>)</pre><p>Now is the part that we send the request to the google to transcribe the audio for us</p><pre># Sends the request to google to transcribe the audio<br>response = client.recognize(request={&quot;config&quot;: config, &quot;audio&quot;: audio})</pre><pre># Reads the response<br>for result in response.results:<br>    print(&quot;Transcript: {}&quot;.format(result.alternatives[0].transcript))</pre><p>The output of the result would look like this</p><pre>Transcript: The Birch canoes slid on the smooth planks.<br>Transcript:  Glue the sheet to the dark blue background.<br>Transcript:  It is easy to tell the death of a well.<br>Transcript:  These days, a chicken leg is a verb dish.<br>Transcript:  Rice is often served in round bowls.<br>Transcript:  The juice of lemons makes find punch.<br>Transcript:  The box was down beside the park truck.<br>Transcript:  The Hogs of food shop, corn and garbage.<br>Transcript:  4 hours of study work Facebook.<br>Transcript:  A large size in stockings is hard to sell.</pre><p>This method I just show you is covered only method for small scale audio (<strong>less than 1 minute audio or 10 MB</strong>), so that you can run on your local computer. If you want to run longer audio file you need to put your audio file in the <strong>Google Cloud Storage</strong> which is another API for storing data on cloud so that it can use more resources on computing.</p><h3>Now you are all set for applying speech-to-text to your application and your code Enjoy!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e049ae3f525" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/google-speech-to-text-api-tutorial-with-python-2e049ae3f525">Google Speech-To-Text API Tutorial with Python</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wine quality prediction with python]]></title>
            <link>https://medium.com/analytics-vidhya/wine-quality-prediction-with-python-695939d34d87?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/695939d34d87</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[wine]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Mon, 21 Sep 2020 14:05:17 GMT</pubDate>
            <atom:updated>2020-09-21T16:13:30.104Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*fi8BwVknwMhlkVgaU2vSjQ.png" /></figure><blockquote>Warning: This is long article for those who seek only machine learning code, please just go right to the the last section, but for those who actually come to learn something from the data please carefully read the whole process and prepare a question for me.</blockquote><p>First, let’s call the elephant in the room, “Why we have to detect the quality of wine?” And “Can quality be predictable?”. These latter question arises from the subjective perspective of person toward a preference of wine testing, in acquiring the quality of the wine, we will focus only on the objective part which is the actual quality such as balance, aroma, not the flavors. The former question arises from the person who has not enter to the realm of wine drinking before, the quality of the wine cannot simply be classified as good or bad as same as other food, it needs many metrics to consider.</p><h3>Now is the real question in this statistics acquisition</h3><blockquote>“Can quality of wine be determined without using wine testing techniques, in other words, can we used predictive technique of machine learning to quantify the wine quality with scale and lesser expertise?”</blockquote><p>The question whether statistical techniques can be used to determine the quality of wine without the need for individual inspection of wine tester will be carry out in this article.</p><h3>DATA</h3><p>This dataset is common in Kaggle open sources however, you might actually find articles in medium that used the cool and advance machine learning algorithm for solving this problem like Random Forest, Neural network and Support Vector machine and telling you what is the accuracy, precision, recall and f-1 score of the model without actually doing the proper knowledge acquisition of where quality of wine derived from. Of course, the power of machine learning do not require the one who implement it to actually know the input and give a great result. But it sure will help the machine learns better if the one who supervised the machine understand what are the relationships of inputs to output.</p><p>Let’s do the machine learning in the proper way like statistics, now our data is the red and white wine data with their physio-chemical properties. The grape that used in the wine is the Portuguese varietal of <em>Vinho Verde </em>and the document for data mining study can be found <a href="https://www.sciencedirect.com/science/article/abs/pii/S0167923609001377">here</a>. First, let explore the overview of physio-chemical feature.</p><h3>Understanding data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*yvGPg7uube8n4tRs92UkGQ.png" /></figure><p><strong>Fixed acidity</strong>: The non-volatile acid found in wine whihc are tartaric, malic, citric, and succinic. All of these acids originate in grapes with the exception of succinic acid, which is produced by yeast during the fermentation process.</p><p><strong>Volatile acidity</strong>: the acidic elements of a wine that are gaseous, rather than liquid, and therefore can be sensed as a smell, showing an aroma, rather than found on the palate.</p><p><strong>citric acid</strong>: a weak organic acid, which is often used as a natural preservative or additive to food or drink to add a sour taste and freshness to food.</p><p><strong>residual sugar</strong>: the amount of sugar remaining after fermentation stops, it’s rare to find wines with less than 1 gram/liter and wines with greater than 45 grams/liter are considered sweet.</p><p><strong>chlorides</strong>: the amount of salt in the wine</p><p><strong>free sulfur dioxide(SO2)</strong>: SO2 is used throughout all stages of the wine-making process to prevent oxidation and microbial growth. Excessive amounts of SO2 can inhibit fermentation and cause undesirable sensory effects.</p><p><strong>total sulfur dioxide</strong>: amount of free and bound forms of S02S02; in low concentrations, SO2SO2 is mostly undetectable in wine, but at free SO2SO2 concentrations over 50 ppm, SO2SO2 becomes evident in the nose and taste of wine</p><p><strong>density</strong>: the density of water is close to that of water depending on the percent alcohol and sugar content</p><p><strong>pH</strong>: Winemakers use pH as a way to measure ripeness in relation to acidity. Low pH wines will taste tart and crisp, while higher pH wines are more susceptible to bacterial growth. Most wine pH’s fall around 3 or 4.</p><p><strong>Sulphates</strong>: a wine additive which can contribute to sulfur dioxide gas (S02S02) levels, which acts as an antimicrobial and antioxidant.</p><p><strong>alcohol</strong>: the percent alcohol content of the wine.</p><p>Now we have a rough understanding of our features, let’s look at the our dataset.</p><h3>RED VS. WHITE</h3><p>In the world of wine, the difference between red and white wine is not just its color, but the ingredient, the method of wine-making and aging. Because of these differences, the physio-chemicals will be different determinant when it comes to quantify the quality of wine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZf4I6Ft2EHsfPjCJOtZ6A.jpeg" /></figure><p>In white and red wine dataset, we have 4898 and 1599 data points respectively. They all contains same. Luckily, the data collection is well-defined with no missing data and prepare for analyst right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*G7HXBm54GJp1v2G7UFQszA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*upCZD0_pA95kfcnXc6Xlag.png" /></figure><h3>Bar Chart to show the quality rating of white and red</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*2HQnt7i_-Gw5xCOOTSFZNg.png" /></figure><p>The picture below show the white and red wine quality rating. The top picture illustrates the white wine quality and the bottom illustrates the red wine quality. As you can see both have similar distribution, it is rare to see the wine have higher quality than 7 and lower quality than 5. This makes sense, in the world of wine making it require a lot of process, technique and class. To create such a bad wine is seemingly as hard as great wine. But to make a fine wine (5, 6 quality) is acceptable and common. At first, we might think making bad wine is hard or people are hardly make bad wine, but it is more likely that many people made bad wine. A lot of bad wine maker just went bankrupt and those who still have enough revenue stays in the business. In the other hand, the high quality wine maker might be rare or it is the capital intensity wine making process that those who have money can only produce wine. If we want to find out we need more inspection on wine making process by backward engineer on the chemical to reach the conclusion that capital is required to make great wine. Unfortunately, I would not like to drag the article to those wine making process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*XGNJuGG5HwoM41aotyFlMQ.png" /></figure><h3>Now look at the most correlated features with our target</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*I2zSVHxO3HdOcVG5A3rhqQ.png" /></figure><p>The boxplot tells us the average(mean) of alcohol by each quality of both white(top) and red(bottom) wine, from this boxplot we can assume some relationship between quality and alcohol to be positive correlation and non-linearity. As you can see the alcohol seem to exhibit the negative relationship on wine quality 3, 4 ,and 5 while exhibits positive relation on 5,6,7, and 8. This give us the intuition that alcohol does a pretty job for prediction but will have a confusing threshold and overlapping of data around quality 3, 4, 5,and 6.</p><p>With this knowledge of the co-occurrence between the data, we know at least that machine learning will able to use this information as predictive power. However, the good predictive model should be able to perform at least better than null prediction( use most frequent class as predicted value for all data) or random prediction( use the probability distribution to randomly assign the predicted value). So let’s say our accuracy benchmark to whether the classifier is good or not should be more than 44.87 percent. This number tells the probability of someone with no knowledge about wine and give the most frequent quality that he/she found to any given wine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*aceDpu_vaIV8wtzRnNkJGA.png" /></figure><p>The randomly assign predictor should have mean around the same as most-frequent predictor however, the randomness can exhibit some range of uncertainty to the prediction and giving a range of variation around mean accuracy instead of a single value.</p><h3>Model</h3><p>So the model just need to be better than 44 percent and that is the threshold that we can said model is done a pretty good job at prediction. I perform two model: Decision tree classifier and multinomial logistic regression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*6m-MliI2BPNnd4EGa9GJXQ.png" /></figure><p>The logistic regression gives us the accuracy of 52.34 which is 8 percent more than most-frequent predictor and Decision tree accuracy of 61.43 percent which is 17 percent more than most-frequent prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*JiTljHKqAc9ydnmOZDgawg.png" /></figure><p>With the feature importances of decision tree, the most influence variable is the alcohol at 16 percent followed by volatile acidity and free sulfur dioxide at 11 percent.</p><p>These are pretty good model however, it should be able to explain the phenomena which is needed to make better wine quality. And that will be explained in next week for other model and data.</p><p><a href="https://github.com/Thundertung/Wine-quality-prediction/upload">CODE</a></p><p>Reference</p><p>Residual sugar: <a href="https://www.decanter.com/learn/residual-sugar-46007/">https://www.decanter.com/learn/residual-sugar-46007/</a></p><p>Difference between Red and White wine <a href="https://winefolly.com/tips/red-wine-vs-white-wine-the-real-differences/">https://winefolly.com/tips/red-wine-vs-white-wine-the-real-differences/</a></p><p>Sulfur dioxide: <a href="https://www.laboratoire-obst.com/so2-total-en.html">https://www.laboratoire-obst.com/so2-total-en.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=695939d34d87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/wine-quality-prediction-with-python-695939d34d87">Wine quality prediction with python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Movie search algorithm: NLP part 1]]></title>
            <link>https://medium.com/analytics-vidhya/movie-search-algorithm-nlp-part-1-7002fc52a9a8?source=rss-c18dca33f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/7002fc52a9a8</guid>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Theethat Anuraksoontorn]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 20:52:39 GMT</pubDate>
            <atom:updated>2020-08-26T13:24:30.131Z</atom:updated>
            <content:encoded><![CDATA[<p>To be honest, this search algorithm is purely an accident that I mistook the recommendation as search engine. The idea start from that I want to create a recommendation system that based on Natural language processing which is not respond to your implicit data(past movie history, like, review, etc.) but the explicit one. I imagine recommendation that just tell you what movie you would like given the explicit data you give to them, such as “the movie that has alien”, “a lot of fight, no drama”. And what I just describe is NLP search engine, not recommendation system. And this mean this time we will working on the an unstructured data, and partially quote from Wikipedia it is</p><blockquote><strong><em>The information that is not pre-defined data model or does not organize in pre-defined manner.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*H_dX221_TEw--CvMUZ1kcQ.jpeg" /></figure><p>The sentence simply mean that the unstructured data is a mess that needed transformation into a set of number for us to continue our task.</p><p>Imagine that you are about the use data, first thing in mind is that it need to be able to compute and it must be either categorical or numerical value. This is not when you face a sentence, text, paragraph. Those is simply a list of string combined.</p><h3>Why we need computer to compute</h3><p>That is because we are doing Machine learning, and for a computer to learn, it firstly needs to understand the data. Let’s first explain what is machine learning: Machine learning is simply how a computer create a rule without explicitly programmed. The rule we are talking about is how a computer make a decision, in this case, we are trying to make it decide what movie should it search for you when it receive a text.</p><p>To transform a text into a quantitative data, we firstly need to transform it to number. This is the same as when we transform categorical variable such as gender of male and female into male {1,0} and female {0,1}, in statistics, this is called Dummy variable, but in programming it is called One-hot encoding. As I mentioned this whole process of transforming unstructured text data into a trainable and processable data is called encoding. However, the simple but significant difference between the encoding in the most case, the encoding of text data go for every the words in your dataset. This vastly and literally change everything because one text paragraph could contain more than 200 characters or 40 unique words. Now, enough with learning preparation, let’s do some programming!</p><h3><strong>Movie Data</strong></h3><p>Go to <a href="https://data.world/iliketurtles/movie-dataset">Data.world</a> site, it is a one of the very diverse open-source dataset repository, and download “Hydra-Movie-Scrape.csv”. By using pandas library will firstly explore a peak of our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*KZsj-aueZxVGIA-I71oSDw.png" /></figure><p>As you can see it contains data about a movie which are Title of the movie, release year, movie summary, the short summary, rating,genre and else. Only those I have mentioned are potentially be useful and interested in our task.</p><p>Firstly, when we trying to encode a word we firstly have to separate a word first. This is simple we can either use “re” library in string to separate word for the sentence or using “nltk” library word_tokenize function to do it for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*3Go_RVykBlfH447CnyDZmQ.png" /></figure><p>You can see these are the dummy variables we create in one single data point. There are total of 44 new variables created, imagine that we tokenize all the data points of 3,940 movies, that would be a total nightmare for most of ML beginner’s computer. However, there are options: change datasets or preprocessing. We can opt in the Short summary to save us sometime, however, the trade-off is that we lose some information of the summary for this shorter version.This emphasizes the point of choosing a proper training data which is purely to optimize signal-to-noise ratio or useful-to-useless ratio. As obvious as they are, a noise is something totally random and useless for our task and a signal is the data point which give us a clean cut for our generalization in the model. To compare the noise, we first look at number of characters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*m9txxqcBP6nIDw1Vsb61SA.png" /></figure><p>This show that the Summary are 3 times bigger than its short versions, this length difference does not give us a clear look whether it differ because of noise or signal, we need a further look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*nxFSWnRwYtqkedYylfRlxQ.png" /></figure><p>This is clearly not what we want, it reduce a noise but also the useful information to our task. Luckily, we have another option.</p><p>Preprocessing, the text data preprocessing is totally same idea to other data preprocessing, we just need to increase signal-to-noise ratio. By that let’s define what is really a noise in text, a set of word that contain near-absolute meaning or value but needed to be in the text for a purpose. This leads us to word such as “a”, “the”, “is-am-are”, “with”, or the verb-to-be, preposition and punctuation, as collectively is called stop-words. This is the noise which is used purely for aesthetic and grammatical purposes, by removing the stop-words, we surely can minimize the noise while keeping all the signal.</p><p>These leads to more of what is efficiently able us to keep signal while reduce noise, the next thing come in mind is the synonyms, such as “fire and flame”. . ( sure they might be used differently but semantically the same) If the words are sharing the same meaning, we should just make it the same word to reduce our model processing runtime. This process in NLP is called Lemmatization and Stemming, the former is what I explain to you, the latter is the reduction of the word to its stem such as changing, changes-&gt; change.</p><p>Disclaimer: I will not demonstrate the hard-core stuff such as NNs for the POS and word embedding.</p><p>And this is it! for the first part of my search algorithm in movie dataset!, I hope you guys stay tuned and wait for the next part next week.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7002fc52a9a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/movie-search-algorithm-nlp-part-1-7002fc52a9a8">Movie search algorithm: NLP part 1</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>