<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Artificial Corner: Behind AI 🤖]]></title><description><![CDATA[For everyone: Learn what's behind the AI products you love. No programming knowledge is required. Tech concepts (if any) will be explained in plain English.]]></description><link>https://artificialcorner.com/s/behind-ai</link><image><url>https://substackcdn.com/image/fetch/$s_!JsL9!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3e1cd4a-d846-4e20-ad60-d8573787c94d_1080x1080.png</url><title>Artificial Corner: Behind AI 🤖</title><link>https://artificialcorner.com/s/behind-ai</link></image><generator>Substack</generator><lastBuildDate>Sun, 26 Jul 2026 12:12:22 GMT</lastBuildDate><atom:link href="https://artificialcorner.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Frank Andrade]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[artificialcorner@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[artificialcorner@substack.com]]></itunes:email><itunes:name><![CDATA[Frank Andrade]]></itunes:name></itunes:owner><itunes:author><![CDATA[Frank Andrade]]></itunes:author><googleplay:owner><![CDATA[artificialcorner@substack.com]]></googleplay:owner><googleplay:email><![CDATA[artificialcorner@substack.com]]></googleplay:email><googleplay:author><![CDATA[Frank Andrade]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[What China’s Rise Means for the Future of AI]]></title><description><![CDATA[For many of us, it wouldn&#8217;t be surprising if, in the not-so-distant future, the global center of gravity for AI shifted from Silicon Valley to a Chinese city like Shenzhen or Beijing.]]></description><link>https://artificialcorner.com/p/what-chinas-rise-means-for-the-future</link><guid isPermaLink="false">https://artificialcorner.com/p/what-chinas-rise-means-for-the-future</guid><dc:creator><![CDATA[Kevin Gargate Osorio]]></dc:creator><pubDate>Tue, 25 Mar 2025 17:17:54 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Op_H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Op_H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Op_H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Op_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:241110,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://artificialcorner.com/i/159784940?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Op_H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!Op_H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f4a8400-a7e2-49b2-8fa7-353b9b9c49e1_1024x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image made with DALL-E 3</figcaption></figure></div><p>For many of us, it wouldn&#8217;t be surprising if, in the not-so-distant future, the global center of gravity for AI shifted from Silicon Valley to a Chinese city like Shenzhen or Beijing.</p><p>A series of telling developments in 2025 suggests that China is mounting a serious challenge to the United States' long-standing dominance in artificial intelligence.</p><p>The Chinese AI lab DeepSeek captured global attention in early 2025 when its chatbot app surged to the number one spot on both the Apple App Store and Google Play. This &#8220;DeepSeek moment&#8221; took technologists and Wall Street analysts by surprise. The company&#8212;relatively unknown at the time and based in Hangzhou&#8212;<a href="https://www.reuters.com/technology/artificial-intelligence/deepseek-rushes-launch-new-ai-model-china-goes-all-2025-02-25/#:~:text=The%20Chinese%20startup%20triggered%20a,that%20outperformed%20many%20Western%20competitors">delivered</a> an AI model on par with its Western counterparts, but developed at a significantly lower cost.</p><p>But the rise of DeepSeek has broader implications.</p><p>First, it validated China&#8217;s AI strategy focused on computational efficiency: training large-scale models using less advanced hardware.</p><p>Second, by open-sourcing its model, DeepSeek helped catalyze a new wave of &#8220;open AI&#8221; in China. Almost overnight, dozens of Chinese companies began integrating DeepSeek&#8217;s models into their own products.</p><p>What did that spark?</p><p>A rapid acceleration of domestic AI innovation. What began as a viral chatbot&#8212;with millions of downloads in just a few weeks&#8212;is now evolving into a full-fledged ecosystem.</p><p>And this is only part of the story. There are several other reasons why China is beginning to reshape the future of the global AI industry.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h4><strong>Building the Silicon Great Wall: Chips, Chips, Chips</strong></h4><p>In May 2024, China <a href="https://www.reuters.com/technology/china-sets-up-475-bln-state-fund-boost-semiconductor-industry-2024-05-27/#:~:text=BEIJING%2C%20May%2027%20%28Reuters%29%20,run%20companies%20registry">launched</a> its third state-backed semiconductor fund, totaling 344 billion yuan (about $47.5 billion), bringing its total &#8220;<a href="https://semiengineering.com/asia-government-funding-surges/#:~:text=China%20,48B%29%20for%20about%20%24100B">Big Fund</a>&#8221; investment to roughly $100 billion across three phases. Backed by the Ministry of Finance and major state-owned banks, these funds aim to support everything from chip fabrication plants to advanced lithography R&amp;D.</p><p>This effort is part of President Xi&#8217;s broader push for &#8220;semiconductor self-sufficiency.&#8221; Under the Made in China 2025 initiative, the official goal is for <a href="https://www.fpri.org/article/2024/06/chinas-defiant-chip-strategy/#:~:text=2025%20cset,reducing%20dependence%20on%20foreign%20technology">70%</a> of China&#8217;s chip demand to be met domestically by 2025.</p><p>So, what impact is this having on the chip industry?</p><p>For starters, China&#8217;s chip production is booming in the low- and mid-range segments, flooding the market with affordable chips for cars, home appliances, and Internet of Things (IoT) devices. Despite US sanctions, Chinese firms have also made impressive strides in high-end chips.</p><p>At Tsinghua University, researchers developed ACCEL, a light-based analog AI chip that, in lab tests, completed an image recognition task <a href="https://www.tsinghua.edu.cn/en/info/1569/12965.htm#:~:text=control">3,000</a> times faster than Nvidia&#8217;s A100 GPU&#8212;while using far less power.</p><p>In another breakthrough, a fully optical AI chip called Taichi-II demonstrated a <a href="https://www.impactlab.com/2024/08/19/chinese-scientists-unveil-taichi-ii-worlds-first-fully-optical-ai-chip/#:~:text=original%20Taichi%20chip%20was%20reported,across%20a%20range%20of%20applications">one-million</a>-fold improvement in energy efficiency for certain tasks by training directly with photons.</p><p>Of course, heavy investment doesn&#8217;t guarantee success.</p><p>China <a href="https://www.cnbc.com/2024/09/27/chinas-ambitions-for-chip-self-sufficiency-thwarted-by-lack-of-tools-.html#:~:text=China%27s%20ambitions%20for%20chip%20self,3%20billion">still</a> trails in producing cutting-edge chipmaking equipment, such as extreme ultraviolet (EUV) lithography machines, which are essential for the latest CPUs and GPUs. Still, with billions flowing into startups, new fabrication facilities, subsidies, and talent pipelines, the momentum is hard to ignore.</p><h4><strong>Manus vs the Machines: AI Agents Get Real</strong></h4><p>Manus is a general-purpose AI agent developed by Chinese startup Monica. It made headlines by <a href="https://www.reuters.com/technology/artificial-intelligence/beijing-boosts-ai-startup-manus-china-looks-next-deepseek-2025-03-21/#:~:text=Some%20have%20pointed%20to%20Manus,chatbots%20like%20ChatGPT%20and%20DeepSeek">claiming </a>to be the world&#8217;s first truly autonomous AI assistant&#8212;a system capable of planning and carrying out complex tasks with minimal input.</p><p>Unlike traditional chatbots that respond to one prompt at a time, Manus can browse the web, book appointments, write code, analyze data, and string together actions to achieve a broader objective.</p><p>It&#8217;s no surprise that some observers <a href="https://sifted.eu/articles/manus-ai-china-chatgpt-claude-llm">dubbed </a>Manus&#8217;s launch &#8220;another DeepSeek moment,&#8221; marking what they saw as a significant step forward in AI capabilities.</p><p>What makes Manus especially noteworthy is how it fits into China&#8217;s growing AI ecosystem.</p><p>On one hand, it&#8217;s the product of a small, homegrown startup. But it quickly gained international attention and racked up a waitlist of 2 million users&#8212;accessible by invitation only.</p><p>By March 2025, China&#8217;s state broadcaster CCTV had begun airing reports comparing Manus to DeepSeek&#8217;s chatbot, and Beijing&#8217;s city government fast-tracked regulatory approval for Manus to enter the domestic market.</p><p>Clearly, Chinese authorities see Manus as a potential new flagship for the country&#8217;s AI ambitions&#8212;just as DeepSeek has been&#8212;particularly if it can compete with leading Western products. In fact, Manus recently partnered with Alibaba to integrate with its Qwen AI models, signaling a broader trend of collaboration between China&#8217;s tech giants and up-and-coming startups in the race to build advanced AI agents.</p><p>Manus may be China&#8217;s answer to OpenAI&#8212;or, given the timing, the question that inspired OpenAI&#8217;s answer.</p><p>After going viral on X and impressing analysts with its live demos, Manus sent a clear signal to the West: China could soon lead not only in conversational AI, but in task-oriented AI as well.</p><p>While it&#8217;s not without flaws&#8212;early users have noted that it can be slow or prone to the usual AI errors&#8212;being first to market with a general-purpose agent gives China a potentially powerful edge.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h4><strong>A Quantum Leap: Zuchongzhi-3 vs. Google&#8217;s Willow</strong></h4><p>While China continues to invest heavily in traditional silicon-based chips, it&#8217;s also making significant progress in quantum computing&#8212;a field that could eventually solve problems far beyond the capabilities of even today&#8217;s most advanced supercomputers.</p><p>In 2024, researchers at the University of Science and Technology of China (USTC) introduced <a href="https://www.livescience.com/technology/computing/china-achieves-quantum-supremacy-claim-with-new-chip-1-quadrillion-times-faster-than-the-most-powerful-supercomputers">Zuchongzhi 3.0</a>, a superconducting quantum processor with 105 qubits, putting it roughly on par with Google&#8217;s latest quantum chip, known as &#8220;Willow.&#8221;</p><p>So, why does this matter?</p><p>Zuchongzhi-3 completed a complex task called random circuit sampling in just a few hundred seconds&#8212;a process that would take Frontier, the world&#8217;s second-fastest supercomputer, an estimated 5.9 billion years to complete.</p><p>To put this into perspective, Google&#8217;s Willow achieved a similar milestone in late 2024 using its own 105-qubit processor, marking a significant step toward quantum supremacy. China has now matched that breakthrough&#8212;and may have even raised the bar.</p><p>What does this mean for AI?</p><p>In the near term, quantum computers remain experimental tools, not yet practical for training the next generation of AI models. However, the future of AI could be accelerated by technologies like quantum optimization and quantum neural networks. By establishing an early lead in quantum hardware, China is positioning itself to take advantage of this convergence when it arrives.</p><p>As one Chinese researcher <a href="https://www.livescience.com/technology/computing/china-achieves-quantum-supremacy-claim-with-new-chip-1-quadrillion-times-faster-than-the-most-powerful-supercomputers">put it</a>, this progress &#8220;lays the groundwork for a new era where quantum processors play an essential role in tackling real-world challenges.&#8221;</p><p>Practically speaking, China&#8217;s advances in quantum computing could give its scientists a powerful edge in solving encryption, search, and simulation problems&#8212;capabilities that not only strengthen its research ecosystem but also pose new questions for the future of AI.</p><h4><strong>Final Thoughts</strong></h4><p>China has rolled out record-setting AI models, embraced open-source approaches that challenge the closed ecosystems favored by many Western firms, invested heavily in semiconductor independence, demonstrated parity in quantum computing, and even taken the lead in developing new AI agent paradigms.</p><p>At the same time, US tech giants remain firmly in the race&#8212;continuing to produce many of the world&#8217;s most advanced models and innovations, with strong advantages in chip technology (think Nvidia) and foundational research.</p><p>Rather than declaring a winner too soon, it may be more prudent to keep asking the right questions. After all, AI leadership isn&#8217;t a zero-sum game. Progress in one part of the world can lift the entire field&#8212;but if one side pulls too far ahead, it could also create a widening global divide in AI capabilities.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #8: Here's Everything You Can Do With Python]]></title><description><![CDATA[Python is the language of choice for AI & data science. Discover what other things you can do with Python (plus free tutorials to get started).]]></description><link>https://artificialcorner.com/p/behind-ai-8-heres-everything-you</link><guid isPermaLink="false">https://artificialcorner.com/p/behind-ai-8-heres-everything-you</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Thu, 06 Feb 2025 18:05:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!D4dM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D4dM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D4dM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D4dM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:661103,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D4dM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!D4dM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14f999f-9e19-4c26-81e5-a6b071681f3f_6000x4000.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Pexels</figcaption></figure></div><p>Whether you&#8217;re new to programming or an experienced developer, Python has one or two applications that might interest you.</p><p>The best thing is that you don&#8217;t need to be an expert programmer to get started with Python. Python&#8217;s syntax makes Python code similar to natural language, which makes it even easier for beginners to learn.</p><p>In this article, I&#8217;ll list all the things you can do with Python from simple applications that don&#8217;t require previous knowledge to advanced stuff that requires knowledge in other fields besides programming.</p><p>I&#8217;ll leave links to free tutorials to get you started.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Automation</h3><p>Probably the most fun and easiest application of Python is automation. You don&#8217;t need to become an expert in Python to build simple automation that will save you from doing repetitive tasks.</p><p>The only thing you need to do is find something worth automating and then learn the Python libraries that will help you automate this task.</p><h4>What can you automate with Python?</h4><p>What&#8217;s worth automating? It can be anything. Here are my favorite automation scripts I built so far:</p><ul><li><p>Automating Morning News</p></li><li><p>Sending Emails</p></li><li><p>Automating Boring Excel Reports</p></li><li><p>Whatsapp Messages</p></li><li><p>Tinder</p></li></ul><p>Here&#8217;s how I used Python to send messages on WhatsApp (believe it or not the message is sent by a bot).</p><div class="comment" data-attrs="{&quot;url&quot;:&quot;https://open.substack.com/home&quot;,&quot;commentId&quot;:86738855,&quot;comment&quot;:{&quot;id&quot;:86738855,&quot;date&quot;:&quot;2025-01-17T15:41:42.138Z&quot;,&quot;edited_at&quot;:null,&quot;body&quot;:&quot;If you&#8217;re learning Python, spend your weekends working on projects!\n\nI used to spend my weekends solving Python projects to apply the concepts I&#8217;d learned, and it made a huge difference in my progress. Here are 4 Python automation projects you can finish in a weekend (from beginner to advanced) &#128071; \n\n1. Whatsapp Messages: This is a mini-project for anyone who just started learning Python. Python has a library that automates WhatsApp messages. You only need to type the number of the receiver, the message to be sent, and the time, and this library will send it at the exact hour/minute you set! \n\n&#128073; Where to start? Check out the tutorial embedded in this post\n\n2. Automate Folder Creation: The goal of this project is to automate the creation of a structured folder system for organizing files by year, month, and day. For example, we'll have a folder named 2024 and inside the months January until December and within these months some random days. With this project, we'll learn how to use the Path module. \n\n &#128073; Code + Tutorial: https://www.youtube.com/watch?v=HJwAcvSh_Ls&amp;t=19s\n\n3. Send emails with attachments: Sending emails adds little to no value to our profession. Fortunately, we can automate emails and even add attachments with Python (also schedule it to be sent, say, every morning with crontab/task scheduler)\n\n&#128073; Code + Tutorial: https://youtu.be/OcyZMrMgr-Y?si=i4Wc0WcXpEfn1taW&amp;t=480\n\n4. Spreadsheet Automation: The goal here is to use Python code to perform Excel tasks such as making a pivot table, plotting a chart, applying Excel formulas, and formatting the report sheet. We'll use Python&#8217;s library openpyxl for this. \n\n &#128073; Code + Tutorial: https://artificialcorner.com/p/behind-ai-13-how-to-automate-your&quot;,&quot;body_json&quot;:{&quot;type&quot;:&quot;doc&quot;,&quot;attrs&quot;:{&quot;schemaVersion&quot;:&quot;v1&quot;},&quot;content&quot;:[{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;If you&#8217;re learning Python, spend your weekends working on projects!&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;I used to spend my weekends solving Python projects to apply the concepts I&#8217;d learned, and it made a huge difference in my progress. Here are 4 Python automation projects you can finish in a weekend (from beginner to advanced) &#128071; &quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;1. Whatsapp Messages: This is a mini-project for anyone who just started learning Python. Python has a library that automates WhatsApp messages. You only need to type the number of the receiver, the message to be sent, and the time, and this library will send it at the exact hour/minute you set! &quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;&#128073; Where to start? Check out the tutorial embedded in this post&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;2. Automate Folder Creation: The goal of this project is to automate the creation of a structured folder system for organizing files by year, month, and day. For example, we'll have a folder named 2024 and inside the months January until December and within these months some random days. With this project, we'll learn how to use the Path module. &quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot; &#128073; Code + Tutorial: &quot;},{&quot;type&quot;:&quot;text&quot;,&quot;marks&quot;:[{&quot;type&quot;:&quot;link&quot;,&quot;attrs&quot;:{&quot;href&quot;:&quot;https://www.youtube.com/watch?v=HJwAcvSh_Ls&amp;t=19s&quot;,&quot;target&quot;:&quot;_blank&quot;,&quot;rel&quot;:&quot;nofollow ugc noopener&quot;,&quot;class&quot;:&quot;note-link&quot;}}],&quot;text&quot;:&quot;https://www.youtube.com/watch?v=HJwAcvSh_Ls&amp;t=19s&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;3. Send emails with attachments: Sending emails adds little to no value to our profession. Fortunately, we can automate emails and even add attachments with Python (also schedule it to be sent, say, every morning with crontab/task scheduler)&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;&#128073; Code + Tutorial: &quot;},{&quot;type&quot;:&quot;text&quot;,&quot;marks&quot;:[{&quot;type&quot;:&quot;link&quot;,&quot;attrs&quot;:{&quot;href&quot;:&quot;https://youtu.be/OcyZMrMgr-Y?si=i4Wc0WcXpEfn1taW&amp;t=480&quot;,&quot;target&quot;:&quot;_blank&quot;,&quot;rel&quot;:&quot;nofollow ugc noopener&quot;,&quot;class&quot;:&quot;note-link&quot;}}],&quot;text&quot;:&quot;https://youtu.be/OcyZMrMgr-Y?si=i4Wc0WcXpEfn1taW&amp;t=480&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;4. Spreadsheet Automation: The goal here is to use Python code to perform Excel tasks such as making a pivot table, plotting a chart, applying Excel formulas, and formatting the report sheet. We'll use Python&#8217;s library openpyxl for this. &quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot; &#128073; Code + Tutorial: &quot;},{&quot;type&quot;:&quot;text&quot;,&quot;marks&quot;:[{&quot;type&quot;:&quot;link&quot;,&quot;attrs&quot;:{&quot;href&quot;:&quot;https://artificialcorner.com/p/behind-ai-13-how-to-automate-your&quot;,&quot;target&quot;:&quot;_blank&quot;,&quot;rel&quot;:&quot;noopener noreferrer nofollow&quot;,&quot;class&quot;:&quot;note-link&quot;}}],&quot;text&quot;:&quot;https://artificialcorner.com/p/behind-ai-13-how-to-automate-your&quot;}]}]},&quot;restacks&quot;:3,&quot;reaction_count&quot;:21,&quot;attachments&quot;:[{&quot;id&quot;:&quot;16ac1ec9-fce0-4f24-b214-67e40fa73bb7&quot;,&quot;user_id&quot;:27034992,&quot;comment_id&quot;:86738855,&quot;type&quot;:&quot;video&quot;,&quot;media_upload_id&quot;:&quot;e126e988-5cef-4ceb-8c9b-eef0fffe5f4b&quot;,&quot;mediaUpload&quot;:{&quot;id&quot;:&quot;e126e988-5cef-4ceb-8c9b-eef0fffe5f4b&quot;,&quot;name&quot;:&quot;Project #1 - Substack.mp4&quot;,&quot;created_at&quot;:&quot;2025-01-17T15:37:42.826Z&quot;,&quot;uploaded_at&quot;:&quot;2025-01-17T15:37:47.125Z&quot;,&quot;publication_id&quot;:null,&quot;state&quot;:&quot;transcoded&quot;,&quot;post_id&quot;:null,&quot;user_id&quot;:27034992,&quot;duration&quot;:232.72646,&quot;height&quot;:1080,&quot;width&quot;:1920,&quot;thumbnail_id&quot;:1,&quot;preview_start&quot;:null,&quot;preview_duration&quot;:null,&quot;media_type&quot;:&quot;video&quot;,&quot;primary_file_size&quot;:&quot;36811222&quot;,&quot;is_mux&quot;:true,&quot;mux_asset_id&quot;:&quot;R200mVhJn3Py9PpTJ53Ow8yXVeZRHwapvI5pz8ZU7snc&quot;,&quot;mux_playback_id&quot;:&quot;u4RuMHOD4SEetP46GY2ohfxDxENKkEHXOZh8SG8iJYM&quot;,&quot;mux_preview_asset_id&quot;:null,&quot;mux_preview_playback_id&quot;:null,&quot;mux_rendition_quality&quot;:&quot;high&quot;,&quot;mux_preview_rendition_quality&quot;:null,&quot;explicit&quot;:false,&quot;copyright_infringement&quot;:null,&quot;src_media_upload_id&quot;:null,&quot;live_stream_id&quot;:null}}],&quot;name&quot;:&quot;The PyCoach&quot;,&quot;user_id&quot;:27034992,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F7e88bb4c-081b-43e5-ac8c-a74152215105_1280x960.jpeg&quot;,&quot;user_bestseller_tier&quot;:100},&quot;source&quot;:null,&quot;forumChannel&quot;:null}" data-component-name="CommentPlaceholder"></div><p>After you write a script to automate a task, you can schedule it to be run at any time you want. Forget about doing any boring task manually!</p><p>If you&#8217;re still unsure of where to start, I recommend you start with web automation. There are millions of websites out there that you can automate with a single Python library: Selenium.</p><p>Free Tutorials: <a href="https://youtu.be/HJwAcvSh_Ls">3 automation projects</a></p><h3>Web Scraping</h3><p>Web scraping is all about collecting data from websites. This is a skill that data analysts and data scientists should have, but it can be used in any field where there&#8217;s a need for data.</p><p>Web scraping is a technique that consists in creating scrapers (aka automated bots) that extract millions of data points from the internet. This is similar to copying data from a website and then pasting it into a spreadsheet. That said, it can take us hours to do this task manually, however, a web scraper will do this in a couple of minutes (or seconds!).</p><p>In this <a href="https://youtu.be/dlj_QL-ENJM">video</a>, you can find everything you need to know about web scraping explained in 3 minutes.</p><p>In Python, we can scrape websites using libraries such as Beautiful Soup, Selenium, and Scrapy. Beautiful Soup is an easy-to-learn library but has lots of limitations. Selenium is a web automation library that can scrape JavaScript-driven websites but is a bit slow. In contrast, Scrapy is a robust framework that has multiple functionalities and is faster than the other 2 libraries.</p><p>You can scrape most websites out there. To name a few:</p><ul><li><p>Twitter</p></li><li><p>Amazon</p></li><li><p>Airbnb</p></li><li><p>News Sites</p></li></ul><p>Free tutorials: <a href="https://youtu.be/A1s1aGHoODs">Beautiful Soup</a>, <a href="https://youtu.be/UOsRrxMKJYk">Selenium</a>, <a href="https://youtu.be/ooNngLWhTC4">Scrapy</a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Data Analysis &amp; Data Science</h3><p>Data is one of the most valuable things on the internet. Some even call data &#8220;the new oil of the 21st century.&#8221;</p><p>Regardless of whether that&#8217;s true or not, the large amount of data available on the internet and possessed by big organizations is undeniable. According to <a href="https://www.ibm.com/blogs/journey-to-ai/2020/11/addressing-data-growth-with-scalable-immediate-and-live-data-migration/">IBM</a>, the global volume of data was predicted to reach 35 zettabytes in 2020.</p><p>With so much data out there, there&#8217;s a demand for professionals to work with this data and get value from it. Here&#8217;s when data analysts and data scientists come into play.</p><p>In data analysis, we use Python to clean data, wrangle data and create visualizations. We use Python libraries such as Pandas, Numpy, Matplotlib, and Seaborn to do that.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6rmC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6rmC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6rmC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png" width="386" height="273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/17f85252-4634-4568-992f-f115b5756462_386x273.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:273,&quot;width&quot;:386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6rmC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!6rmC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f85252-4634-4568-992f-f115b5756462_386x273.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>In data science, we usually go one step further and use Python to develop a machine learning model that predicts outputs based on data we feed to our model.</p><p><a href="https://youtu.be/Im6PdzPgnpc">Here</a> is all the Python stuff you need to learn for data science explained in 5 minutes.</p><p>Machine learning is often used in data science, so at least you should learn sklearn, which is the most basic library to do machine learning in Python. This library is the foundation for other advanced Python libraries such as TensorFlow and Keras.</p><p>Some models you can build with machine learning are:</p><ul><li><p>Fake News Detection</p></li><li><p>Credit card fraud detection</p></li><li><p>Customer Churn Prediction</p></li></ul><p>Free Course: <a href="https://youtu.be/WcDaZ67TVRo">Data Analysis with Python</a></p><h3>Web Development</h3><p>If you ever dreamt of building your own website, I have good news for you&#8202;&#8212;&#8202;you can do it with Python!</p><p>Python has some frameworks like Flask and Django that allows us to build the back end of a website with Python. Of course, to build the front end you still need to use HTML, CSS, and JavaScript. That said, you have nothing to worry about since HTML is a very simple language and you could use Bootstrap to avoid implementing CSS and JavaScript code from scratch.</p><p>What websites were built using Python?</p><p>There are many websites out there that use Python for the back-end of their websites. Here are some of them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qQvw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qQvw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qQvw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qQvw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!qQvw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14bee298-95af-475c-9b69-41aeaa96e1f4_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"></figcaption></figure></div><p>Some of these websites used Python in early stages, while others still use it to this date. In fact, Instagram currently <a href="https://instagram-engineering.com/web-service-efficiency-at-instagram-with-python-4976d078e366">features</a> the world&#8217;s largest deployment of the Django web framework (written entirely in Python).</p><p>Below you&#8217;ll find more about how Python powers these websites:</p><ul><li><p><a href="https://www.pythonpeople.nl/how-python-powers-dropbox/">How Python Powers Dropbox</a></p></li><li><p><a href="https://engineering.atspotify.com/2013/03/how-we-use-python-at-spotify/">How we use Python at Spotify</a></p></li><li><p><a href="https://brainsik.net/2009/why-reddit-uses-python/">Why Reddit uses Python</a></p></li></ul><p>Here are some free tutorials to get you started with web development.</p><p>Free Tutorials: <a href="https://youtu.be/dam0GPOAvVI">Python Website Tutorial with Flask</a>, <a href="https://youtu.be/sm1mokevMWk">Django For Beginners&#8202;</a></p><h3>Machine Learning &amp; Artificial Intelligence</h3><p>Machine learning is a branch of artificial intelligence that allows a machine to automatically learn from past data without programming explicitly.</p><p>This isn&#8217;t something that you can learn solely with Python but requires knowledge in linear algebra, calculus, and more. With Python, we can use scientific libraries such as Numpy, Pandas, PyTorch, and TensorFlow to take care of all the math behind a machine learning model. Your job will be to understand the results and make the best decision using your analytical skills.</p><p>Here are some popular machine-learning applications:</p><ul><li><p>Google&#8217;s self-driving car</p></li><li><p>Recommendation systems from Amazon, YouTube, and Netflix</p></li><li><p>Fraud detection</p></li></ul><p>Of course, those are advanced applications. Before you dive into Machine Learning and AI you need to have a solid foundation in calculus, and linear Algebra and know Python libraries such as NumPy, pandas, Matplotlib, and PyTorch.</p><p>Once you familiarize yourself with the basics of machine learning you can learn more advanced Python libraries like TensorFlow and Keras.</p><p>Below are free tutorials that you can take to learn these libraries.</p><p>Free Tutorial: <a href="https://youtu.be/tPYj3fFJGjk">TensorFlow 2.0&#8202;&#8212;&#8202;Python Neural Networks for Beginners Tutorial</a></p><p>Once you acquired the previous skills, the sky is the limit!</p><p>You can use this knowledge to specialize in more advanced topics like NLP, AI, and DL.</p><div><hr></div><p>That&#8217;s it! Let your Python journey begin!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&amp;gift=true&quot;,&quot;text&quot;:&quot;Give a gift subscription&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?&amp;gift=true"><span>Give a gift subscription</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/p/behind-ai-8-heres-everything-you?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/p/behind-ai-8-heres-everything-you?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #7: Top Python Libraries Any AI Enthusiast Should Know]]></title><description><![CDATA[Python libraries explained in plain English (with a bit of code).]]></description><link>https://artificialcorner.com/p/behind-ai-7-top-python-libraries</link><guid isPermaLink="false">https://artificialcorner.com/p/behind-ai-7-top-python-libraries</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Wed, 09 Oct 2024 15:59:41 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!KvXs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KvXs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KvXs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KvXs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg" width="800" height="533" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:533,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46003,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KvXs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KvXs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9438019-3eb2-48cc-bc9d-d67f18c695cd_800x533.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@johnschno?utm_source=medium&amp;utm_medium=referral">John Schnobrich</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure></div><p>Python is the language of choice in AI. It offers a large number of libraries that provide great functionality in mathematics, statistics, and scientific functions.</p><p>However, Python has applications beyond AI, so there are a good number of Python libraries that you will never use in an AI project.</p><p>In this article, I will show you the top Python libraries any AI enthusiast should know. and I will share resources to help you learn them.</p><p>Note: I added some lines of code to complement the explanation. That said, you don&#8217;t need to be an expert programmer to follow this article.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Python libraries for Data Collection</h3><p>Every data project starts with data collection. Sometimes the data is available in a CSV format or needs to be extracted from a database. However, when the data isn&#8217;t available, you could get public data from the biggest database in the world&#8202;&#8212;&#8202;the internet. The libraries below help you extract data from the internet with a technique called web scraping.</p><h4>Request &amp; Beautiful Soup</h4><p>By using both the Request and Beautiful Soup library we can extract data from websites that don&#8217;t run JavaScript.</p><p>The requests library helps us make HTTP requests in Python. Thanks to this, we can get the content of a website. Then we use a parser (e.g., html.parser, lxml, etc) and Beautiful Soup to extract any data within the website.</p><p>Let&#8217;s see an example:</p><pre><code><strong>import</strong> requests
<strong>from</strong> bs4 <strong>import</strong> BeautifulSoup

# sending request and parsing
website = requests.get('https://example.com').text
soup = BeautifulSoup(website, 'html.parser')

# extracting data
headlines = soup.find_all('span', class_='class-example')
data = [headline.text for headline in headlines]</code></pre><h4>Selenium/Scrapy</h4><p>Selenium and Scrapy do the same job as Beautiful Soup; however, they&#8217;re more powerful.</p><p>Both of them can extract data from JavaScript-driven websites. Selenium can be also used for web automation, while Scrapy is fast, allows you to easily export data to a database, and have other functionalities that make it the most complete tool.</p><p>Below you will find guides to start learning these libraries from scratch:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-5-web-scraping-in-python">&#8203;Beautiful Soup Guide</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-6-web-scraping-in-python">&#8203;Selenium Guide</a></p></li><li><p><a href="https://artificialcorner.com/p/ai-and-python-20-web-scraping-projects">4 Web Scraping Project to Automate Your Life</a></p></li></ul><h3>Python libraries for Data Cleaning &amp; Wrangling</h3><p>Once you have the data in a readable format (CSV, JSON, etc), it&#8217;s time to clean it. The Pandas and Numpy libraries can help with it.</p><h4>Pandas</h4><p>Pandas is a powerful tool that offers a variety of ways to manipulate and clean data. Pandas work with dataframes that structures data in a table similar to an Excel spreadsheet, but faster and with all the power of Python.</p><p>This is how you create a Pandas dataframe:</p><pre><code><strong>import</strong> pandas <strong>as</strong> pd

# data used for the example (stored in lists)
states = ["California", "Texas", "Florida", "New York"]
population = [39613493, 29730311, 21944577, 19299981]

# Storing lists within a dictionary
dict_states = {'States': states, 'Population': population}

# Creating the dataframe
df_population = pd.DataFrame.from_dict(dict_states)

print(df_population)</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!A_2Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A_2Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 424w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 848w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 1272w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!A_2Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png" width="289" height="224" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e4764391-7e57-4057-ae87-e97853db84e4_289x224.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:224,&quot;width&quot;:289,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A_2Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 424w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 848w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 1272w, https://substackcdn.com/image/fetch/$s_!A_2Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4764391-7e57-4057-ae87-e97853db84e4_289x224.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><h4>Numpy</h4><p>Numpy is a Python library with math functionalities. It allows us to work with multi-dimensional arrays, matrices, generate random numbers, linear algebra routines, and more.</p><p>When it comes to wrangling and transforming data, some Numpy methods such as <code>np.where</code> and <code>np.select</code> are often used. In addition to that, other libraries such as Matplotlib, and Scikit-learn depend on NumPy to some extent.</p><p>Let&#8217;s see how to create a two-dimensional array with NumPy.</p><pre><code><strong>import</strong> numpy <strong>as</strong> np

b = np.array([[1.5,2,3], [4,5,6]],dtype=float)

IN [0]: print(b)
IN [1]: print(f'Dimension: {b.ndim}')

OUT [0]: [[1.5  2.  3. ]
          [4.   5.  6. ]]
OUT [1]: Dimension: 2</code></pre><h4>Imbalanced-learn</h4><p>Imbalanced-learn is a library that helps us deal with imbalanced data. Imbalanced data happens when the number of observations per class is not equally distributed. For example, in the review section of an Amazon product, you will typically see a high number of positive reviews (the majority class) and a low number of negative reviews (the minority class<em>).</em></p><p>We use the imbalanced-learn (imblearn) library to resample our data. For example, you can undersample positive reviews or oversample negative reviews.</p><p>Below you will find guides to start learning these libraries from scratch:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-18-ai-enthusiasts-should">Pandas &amp; Numpy Guide for Excel users</a></p></li></ul><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Python libraries for Data Visualization</h3><p>Plots such as pie charts, bar plots, boxplots, and histograms are often used in Exploratory Data Analysis and also when presenting results. Python libraries allow us to make traditional as well as interactive plots.</p><h4>Matplotlib/Seaborn</h4><p>Matplotlib is a library that allows us to make basic plots, while Seaborn specializes in statistics visualization.</p><p>The main difference is in the lines of code you need to write to create a plot. Seaborn is easier to learn, has default themes, and makes better-looking plots than Matplotlib by default.</p><p>Let&#8217;s create a barplot of the <code>df_population</code> dataframe we created in the Pandas section.</p><pre><code><strong>import</strong> matplotlib.pyplot <strong>as</strong> plt

plt.bar(x=df_population['States'],
        height=df_population['Population'])

plt.xlabel('States')
plt.ylabel('Population')
plt.show()</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S_NS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S_NS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S_NS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png" width="386" height="273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:273,&quot;width&quot;:386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S_NS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!S_NS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F652195f7-4c01-462f-9ecc-fe6bec97d5b0_386x273.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>Now let&#8217;s create the same plot with Seaborn.</p><pre><code><strong>import</strong> seaborn <strong>as</strong> sns

sns.barplot(x=df_population['States'],
            y=df_population['Population'],
            palette='deep')
plt.show()</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QZp8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QZp8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QZp8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png" width="386" height="273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:273,&quot;width&quot;:386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QZp8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 424w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 848w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 1272w, https://substackcdn.com/image/fetch/$s_!QZp8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4264cb59-0131-44ee-a163-a1935a1c2973_386x273.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>As you can see, we don&#8217;t need to specify the axes names in Seaborn (it takes it from the dataframe columns), while Matplotlib needs more lines of code and the plots aren&#8217;t good looking at all by default.</p><h4>Plotly/Bokeh (Pandas integration)</h4><p>If you want to go to the next level, you should try making interactive visualization with Plotly or Bokeh. Both allow creating a good number of interactive plots and the coolest thing is that you can use any of them to plot directly with Pandas plotting syntax.</p><p>Both make it easy to plot interactive visualization, but in my opinion, Plotly creates better-looking plots by default.</p><p>Here&#8217;s an example of how to create interactive plots with Plotly using Pandas plotting syntax.</p><pre><code><strong>import</strong> pandas <strong>as</strong> pd
<strong>import</strong> cufflinks <strong>as</strong> cf
<strong>from</strong> IPython.display <strong>import</strong> display,HTML
cf.set_config_file(sharing='public',theme='white',offline=True) 

df_population = df_population.set_index('States')
df_population.iplot(kind='bar', color='red',
                    xTitle='States', yTitle='Population')</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eDvh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eDvh!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 424w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 848w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 1272w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eDvh!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif" width="1268" height="650" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:650,&quot;width&quot;:1268,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eDvh!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 424w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 848w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 1272w, https://substackcdn.com/image/fetch/$s_!eDvh!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aebcfb7-2c76-431d-b139-6abfcecd5bc7_1268x650.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><h4>Wordcloud/Stylecloud</h4><p>Wordclouds allows us to identify keywords in a piece of text. Python has two libraries for this type of graphs &#8212;wordclouds and stylecloud.</p><p>The first makes basic wordclouds and even allows us to upload our own image as a mask for the wordcloud, while the second creates gorgeous wordclouds with a few lines of codes and offers a good number of high-quality icons that you can use in your wordcloud.</p><p>Let&#8217;s make a wordcloud of the famous Steve Job&#8217;s speech at Standford.</p><pre><code><strong>import</strong> stylecloud

stylecloud.gen_stylecloud(file_path='SJ-Speech.txt',
                          icon_name= "fas fa-apple-alt")</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jF_F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jF_F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 424w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 848w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 1272w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jF_F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png" width="512" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jF_F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 424w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 848w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 1272w, https://substackcdn.com/image/fetch/$s_!jF_F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59fc715a-4b12-42ed-9f34-8dc9ab472332_512x512.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That&#8217;s all you need to make this wordcloud! You can remove stopwords and use other functionalities. For more details, check my wordcloud guide.</p><p>Below you will find guides to start learning these libraries from scratch:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-19-how-to-create-beautiful">Matplotlib &amp; Seaborn Guide</a></p></li></ul><h3>Python libraries used in AI &amp; ML models</h3><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p>
      <p>
          <a href="https://artificialcorner.com/p/behind-ai-7-top-python-libraries">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Behind AI #6: The 4 Stages of Learning Python for AI & ML]]></title><description><![CDATA[What stage are you in?]]></description><link>https://artificialcorner.com/p/behind-ai-6-the-4-stages-of-learning</link><guid isPermaLink="false">https://artificialcorner.com/p/behind-ai-6-the-4-stages-of-learning</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Fri, 27 Sep 2024 13:11:06 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!eQKx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eQKx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eQKx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eQKx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1684479,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eQKx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!eQKx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4263d156-0a71-42ce-bf4e-f1d05a62d821_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image made with Midjourney</figcaption></figure></div><blockquote><p><em>As we&#8217;ve seen in previous articles <a href="https://artificialcorner.com/p/behind-ai-1-how-to-learn-python-with">Python is the language of choice for AI</a>. In this article, I present you the 4 stages to learn Python for AI &amp; Machine Learning. I left many links to resources that will come in handy for you.</em></p></blockquote><p>Python is the most popular language in the AI community due to its simplicity, flexibility, and data science libraries such as Pandas, Numpy, and Scikit-learn. This is why, in this article, we will see the Python stuff you need for AI and Machine Learning and discover what stage you&#8217;re in.</p><p>I&#8217;ll describe each stage and give you tips on how to master them so that you can move to the next stage.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Stage 1: The Basics of&nbsp;Python</h3><p>This stage is for anyone who is learning the basics of Python.</p><p>At this level, you should at least know basic concepts such as data types and variables. Knowing the most popular options to store data (lists, dictionaries, and tuples.) is a must at this level. Also, you should be able to use conditional statements and control flow tools. This includes the if/else statements, boolean operations, and different types of loops (for, while, and nested).</p><p>Conditional statements, control flow, and loops open the door for a large variety of things you can do with Python, so use them and stay curious to develop a strong foundation necessary for the next stage.</p><p>One last important thing at this level is to start getting familiar with Jupyter Notebook. Jupyter allows us to create not only code but equations, visualizations, and text.</p><p><strong>Topics:</strong> Data types, variables, lists, dictionaries, tuples, conditions, operators, control flow (if / else), loops, iterables, functions, file I/O operations (read, write to text files), and common methods.</p><p><strong>How to master this level? </strong>As I mentioned before, solving problems that involve conditional statements, control flow, and loops will help you master stage 1. </p><blockquote><p>Projects for beginners:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-10-automate-4-boring-tasks">Automate 4 Boring Tasks in Python with 5 Lines of Code</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-11-how-to-automate-emails">How to Automate Emails with Python</a></p></li></ul></blockquote><h3>Stage 2: Python for Data&nbsp;Analysis</h3><p>This is what I call the &#8220;essential Python stuff to work with data.&#8221; This means having at least a basic understanding of libraries used for data analysis such as Pandas, NumPy, Matplotlib, and Seaborn.</p><p>Using those libraries to solve common data analysis tasks such as data cleaning, exploratory data analysis (EDA) through visualizations, and feature engineering is important at this level.</p><blockquote><p>Data analysis tutorials:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-18-ai-enthusiasts-should">Pandas &amp; Numpy for beginners</a></p></li><li><p><a href="https://youtu.be/oK3_YzUG4xc">Data Cleaning</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-19-how-to-create-beautiful">Data Visualization</a></p></li></ul></blockquote><p>If you&#8217;re able to understand the code in the tutorials above, then you&#8217;re at this stage. </p><p>Regarding the stuff you already knew in stage 1, there&#8217;s still room for improvement&#8202;&#8212;&#8202;especially for the stuff you would frequently use for data analysis. Some of them are list comprehension, lambda, zip(), f-string, and the <code>with</code> statement.</p><p>Last but not least, acquiring skills necessary for data collection like web scraping will come in handy. Below are guides to learning web scraping from scratch.</p><blockquote><p>Web scraping guides:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-4-the-easiest-way-to-web">Web scraping with pandas</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-5-web-scraping-in-python">Web scraping with Beautiful Soup</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-6-web-scraping-in-python">Web scraping with Selenium</a></p></li></ul></blockquote><p><strong>Topics</strong>: Most of the methods/functions used in Pandas, NumPy, Matplotlib, Seaborn, and web scraping libraries (Selenium and Scrapy). List comprehension, lambda, zip(), f-string, the <code>with</code> statement, and any other stuff that helps you write better code.</p><p><strong>How to master this level? </strong>Solving Python projects. At this stage, projects usually involve all the data analysis libraries mentioned before. Make sure you start projects that have topics you&#8217;re interested in (that&#8217;s more fun!)</p><blockquote><p>Projects for stage 2:</p><ul><li><p><a href="https://artificialcorner.com/p/ai-and-python-20-web-scraping-projects">4 Web Scraping Projects That Will Help Automate Your Life</a></p></li><li><p><a href="https://youtu.be/yat7soj__4w?si=9-l3Z6CN64h8caS-">Predicting Football Games With a Simple Model</a></p></li></ul></blockquote><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Stage 3: Python for Statistics &amp;&nbsp;Math</h3><p>In Stage 3 different fields get together, so your Python project will become an ML project. You already know how to clean data and conduct EDA from stage 2, but also you&#8217;re supposed to know all the fundamental statistics and math behind ML.</p><p>Statistics is crucial to make sure the data you are using to train a model is not biased. For example, using Matplotlib and Seaborn to plot histograms and boxplots will help you identify outliers. In addition to that, you should know how to apply most statistical concepts to a project. You should know how to deal with imbalanced data, segment train/test data, and formulate a problem and hypothesis.</p><p>Some topics in math you should know are functions and matrices. This stuff is implemented in Python through Numpy. Numpy has support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.</p><p>Another important thing you should understand is how machine learning algorithms work. There&#8217;s a lot of math and statistics behind those algorithms, so make sure you understand them before learning the Python code that lets you build them.</p><blockquote><p>Guides for stage 3:</p><ul><li><p><a href="https://artificialcorner.com/p/behind-ai-1-machine-learning-algorithms">Machine Learning Algorithms Any AI Enthusiast Should Know</a> (Part 1)</p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-5-machine-learning-algorithms">Machine Learning Algorithms Any AI Enthusiast Should Know</a> (Part 2)</p></li></ul></blockquote><p><strong>Topics</strong>: Imbalanced data, segment train/test data, machine learning algorithms, arrays/matrices (Numpy), data visualization (Matplotlib/Seaborn). Above all, you should know how to apply statistics and math to a project.</p><p><strong>How to master this level? </strong>Solving projects such as sentiment analysis, credit card fraud detection, and customer churn prediction. </p><h3>Stage 4: Python for Machine&nbsp;Learning</h3><p>The last stage is all about developing machine learning models. The scikit-learn library is a good start to this. Some basic things you should be able to do with this library are text representation (BOW, Count Vectorizer, TF-IDF), model selection, evaluation, and parameter tuning. <a href="https://artificialcorner.com/p/ai-and-python-25-lets-build-your">This project</a> covers all these topics. If you&#8217;re able to understand the code, then you&#8217;re at this level.</p><p>Other important libraries for data scientists at this level are Keras and TensorFlow. Keras features several of the building blocks and tools necessary for creating a neural network such as neural layers, activation and cost functions, objectives, etc. TensorFlow is one of the best library available for working with Machine Learning on Python. It makes machine learning model building easy for beginners and professionals alike.</p><blockquote><p>Guides for stage 4:</p><ul><li><p><a href="https://artificialcorner.com/p/ai-and-python-25-lets-build-your">Building a Basic Machine Learning Model in Python</a></p></li><li><p><a href="https://artificialcorner.com/p/behind-ai-4-what-is-nlp-and-why-is">What is NLP And Why is Important in AI </a> (7 NLP Techniques)</p></li></ul></blockquote><p><strong>Topics</strong>: Text representation, model selection, evaluation, and parameter tuning, among others.</p><p><strong>How to master this level and beyond? </strong>This will depend on the area you&#8217;re interested in. Find an area you like and learn the necessary libraries you need for it. For example, if you&#8217;re into NLP, learning NLTK and solving projects like building a movie recommender system or a chatbot would help you get started in this area.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/p/behind-ai-6-the-4-stages-of-learning?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/p/behind-ai-6-the-4-stages-of-learning?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&amp;gift=true&quot;,&quot;text&quot;:&quot;Give a gift subscription&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?&amp;gift=true"><span>Give a gift subscription</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #5: Machine Learning Algorithms Any AI Enthusiast Should Know - Part 2]]></title><description><![CDATA[Machine learning algorithms explained in plain English]]></description><link>https://artificialcorner.com/p/algorithms-2</link><guid isPermaLink="false">https://artificialcorner.com/p/algorithms-2</guid><dc:creator><![CDATA[Kevin Gargate Osorio]]></dc:creator><pubDate>Wed, 18 Sep 2024 13:25:21 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!RGmy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RGmy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RGmy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RGmy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:447582,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RGmy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!RGmy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca8a5290-30ff-453b-bd91-8ab0c9a6d900_1024x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image made with DALL-E 3</figcaption></figure></div><p>In this second part, we will continue exploring how some algorithms used in Machine Learning work. As we discussed in the <a href="https://artificialcorner.com/p/behind-ai-1-machine-learning-algorithms">first part</a>, there are both supervised and unsupervised algorithms.</p><p>Let&#8217;s see 6 more algorithms you should know.</p><h4><strong>1.K-Nearest Neighbors (kNN)</strong></h4><p>KNN algorithm is a supervised learning technique used for both classification and regression. It&#8217;s a simple yet practical method for making predictions. The goal is to find the "k" nearest observations in the feature space and make a decision based on the labels of these neighbors.</p><p>Let's break down the key concepts to get a better understanding of how this algorithm works:</p><ul><li><p>The value of "k" is an integer that defines how many neighboring points will be considered.</p></li><li><p><strong>Distance:</strong> To measure how close two points are, a distance metric is usually used. The most common is Euclidean distance, though others like Manhattan, Minkowski, and more can also be applied.</p></li><li><p>If we use it for <strong>classification</strong>, the new point is assigned to the most common class among its "k" neighbors (majority voting). If there is a tie, it can be resolved using additional criteria, such as weighting the distances.</p></li></ul><p>If we use it for <strong>regression</strong>, the prediction is made by averaging the values of the neighbors.</p><p>Here&#8217;s a representation of how the algorithm performs a classification with a hyperparameter of k = 5.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Zrno!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Zrno!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 424w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 848w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 1272w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Zrno!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png" width="1000" height="541" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a13db123-1677-4857-9684-ed11537d47db_1000x541.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:541,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32837,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Zrno!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 424w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 848w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 1272w, https://substackcdn.com/image/fetch/$s_!Zrno!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13db123-1677-4857-9684-ed11537d47db_1000x541.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>The advantage of this algorithm is that it&#8217;s easy to interpret and implement. Additionally, it doesn't make assumptions about the data distribution. However, it&#8217;s important to consider the characteristics of the data since this algorithm is distance-based. Another point to keep in mind is its high computational cost for large datasets. It&#8217;s also very sensitive to noise or outliers when k is small, while a very large k can overly smooth the decision.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h4><strong>2. Gradient Boosted Decision Trees (GBDT)</strong></h4><p>GBDT is a supervised learning algorithm used for both classification and regression tasks. It&#8217;s a boosting technique that sequentially combines multiple decision trees, with each tree trying to correct the errors of the one before it. The idea is to add weak models (trees) together to build a more robust model.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0ssS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0ssS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 424w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 848w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 1272w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0ssS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png" width="850" height="517" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:517,&quot;width&quot;:850,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61009,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0ssS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 424w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 848w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 1272w, https://substackcdn.com/image/fetch/$s_!0ssS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d96761f-2dbc-43ef-b942-5990afa528e2_850x517.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://www.researchgate.net/figure/The-architecture-of-Gradient-Boosting-Decision-Tree_fig2_356698772">The architecture of Gradient Boosting Decision Tree</a></figcaption></figure></div><p>The goal is to minimize error by combining several weak models (decision trees) into a strong model. For regression tasks, the loss function often uses Mean Squared Error (MSE), while for classification, it uses Log-loss.</p><p>One of the advantages of GBDT is its strong performance in both classification and regression tasks. It is also a robust model when dealing with outliers, thanks to its ability to handle non-linear data. However, a drawback is that since it uses boosting by adding more trees, the training process can be slower compared to other algorithms. Here, we face the trade-off between performance and speed.</p><h4><strong>3. K-Means Clustering</strong></h4><p>K-Means is an unsupervised clustering algorithm that groups data into <em>k</em> clusters based on their features. The goal is to minimize the distances between the points within a cluster and its centroid, aiming to reduce internal variance. This is an iterative process that essentially forms groups of data points with similar characteristics, distinguishing them from other, more distant groups.</p><p>Let&#8217;s break down how this algorithm works:</p><ol><li><p><strong>Initialization:</strong> Randomly select <em>k</em> centroids, which represent the centers of the initial clusters.</p></li><li><p><strong>Assign Points to Clusters:</strong> Assign each data point to the cluster whose centroid is closest (using Euclidean distance).</p></li><li><p><strong>Recalculate Centroids:</strong> Once all points are assigned, recalculate the centroids of each cluster as the mean of all points within that cluster.</p></li><li><p><strong>Reassign Points:</strong> Reassign each data point to the cluster with the nearest updated centroid.</p></li><li><p><strong>Repeat:</strong> Repeat steps 3 and 4 until the centroids no longer change significantly (or until a maximum number of iterations is reached).</p></li></ol><p><strong>Final Clusters:</strong> The data points will then be organized into <em>k</em> clusters, with their respective centroids stabilized.</p><p>Now, let&#8217;s see how we can use this algorithm to perform the following classification:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!251_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!251_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 424w, https://substackcdn.com/image/fetch/$s_!251_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 848w, https://substackcdn.com/image/fetch/$s_!251_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 1272w, https://substackcdn.com/image/fetch/$s_!251_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!251_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png" width="1000" height="548" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:548,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30071,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!251_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 424w, https://substackcdn.com/image/fetch/$s_!251_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 848w, https://substackcdn.com/image/fetch/$s_!251_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 1272w, https://substackcdn.com/image/fetch/$s_!251_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdee0a929-b7a1-4904-bf80-6f23a53db5de_1000x548.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><h4><strong>4. Hierarchical Clustering</strong></h4><p>Hierarchical clustering creates a tree-like structure (dendrogram) to group the data. Clusters are formed by either merging (agglomerative) or splitting (divisive) the data iteratively. The goal is to create a hierarchy of clusters that allows data to be grouped at different levels of similarity.</p><p>Here&#8217;s a step-by-step breakdown of how this algorithm works:</p><ol><li><p><strong>Initialization:</strong> Each data point starts as its own individual cluster.</p></li><li><p><strong>Calculate Distances:</strong> Calculate the distances between all clusters, typically using Euclidean distance.</p></li><li><p><strong>Merge Clusters:</strong> In each iteration, merge the two closest clusters (those with the smallest distance).</p></li><li><p><strong>Update Distances:</strong> After merging two clusters, recalculate the distances between the newly formed cluster and the remaining clusters.</p></li><li><p><strong>Build the Dendrogram:</strong> As clusters are merged, the dendrogram visually represents how clusters are combined at each level. The nodes in the tree indicate cluster merges at different heights.</p></li><li><p><strong>Determine Final Clusters:</strong> The final number of clusters can be set by "cutting" the dendrogram at a certain level, corresponding to the desired number of clusters.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B0q8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B0q8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 424w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 848w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 1272w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B0q8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png" width="1000" height="547" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:547,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79275,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!B0q8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 424w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 848w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 1272w, https://substackcdn.com/image/fetch/$s_!B0q8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473761a0-421d-434f-b4df-78d8c5caa6b1_1000x547.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>This will lead us to the final result:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sli9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sli9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 424w, https://substackcdn.com/image/fetch/$s_!sli9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 848w, https://substackcdn.com/image/fetch/$s_!sli9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 1272w, https://substackcdn.com/image/fetch/$s_!sli9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sli9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png" width="1000" height="547" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:547,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86296,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sli9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 424w, https://substackcdn.com/image/fetch/$s_!sli9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 848w, https://substackcdn.com/image/fetch/$s_!sli9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 1272w, https://substackcdn.com/image/fetch/$s_!sli9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F389acb5d-1a4b-482c-81fb-1c879fabba9e_1000x547.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>Hierarchical clustering always produces the same clusters. In contrast, K-Means clustering can yield different clusters depending on the initial placement of the centroids (cluster centers). However, hierarchical clustering is slower compared to K-Means. It takes a significant amount of time to run, especially with large datasets.</p><h4><strong>5. DBSCAN Clustering</strong></h4><p>DBSCAN is a density-based clustering algorithm that groups nearby points and labels isolated points as "noise" or outliers. Unlike K-Means, it does not require you to define the number of clusters in advance. The goal is to identify high-density clusters and mark isolated points.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gTbM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gTbM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 424w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 848w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 1272w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gTbM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png" width="833" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:833,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15441,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gTbM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 424w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 848w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 1272w, https://substackcdn.com/image/fetch/$s_!gTbM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2b3fd9-9525-4695-aa43-42b2f8550079_833x512.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X11q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X11q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 424w, https://substackcdn.com/image/fetch/$s_!X11q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 848w, https://substackcdn.com/image/fetch/$s_!X11q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 1272w, https://substackcdn.com/image/fetch/$s_!X11q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X11q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png" width="731" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:731,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9891,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X11q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 424w, https://substackcdn.com/image/fetch/$s_!X11q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 848w, https://substackcdn.com/image/fetch/$s_!X11q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 1272w, https://substackcdn.com/image/fetch/$s_!X11q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fde4d4c-f4a4-49c1-aee8-3690d996a369_731x512.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>Here&#8217;s a closer look at how this algorithm works:</p><ol><li><p><strong>Parameter Definition:</strong> Two key parameters are set: &#949; (epsilon), which is the radius of the neighborhood around a point, and <em>minPts</em>, the minimum number of points needed to form a cluster.</p></li><li><p><strong>Initialization:</strong> A random point is selected from the dataset.</p></li><li><p><strong>Neighborhood Density:</strong> If there are at least <em>minPts</em> within the &#949; radius around the selected point, it is considered a core point, and a cluster is formed. If not, the point is marked as noise.</p></li><li><p><strong>Cluster Expansion:</strong> The cluster expands by searching for all points within the &#949; radius of the points already included in the cluster. If any of these points also have at least <em>minPts</em> neighbors within their &#949; radius, the cluster continues to grow.</p></li><li><p><strong>Repeat:</strong> This process repeats for each unvisited point. Points that do not meet the density criteria are marked as noise and are not included in any cluster.</p></li><li><p><strong>Final Clusters:</strong> The algorithm concludes by forming clusters of densely packed points, while isolated points are labeled as noise.</p></li></ol><p>In some cases, finding an appropriate neighborhood distance (&#949;) can be challenging and may require domain expertise.</p><h4><strong>6. Principal Component Analysis (PCA)</strong></h4><p>PCA is a dimensionality reduction technique used to transform a dataset with many features (variables) into a new set of uncorrelated variables called principal components. These components capture most of the variability in the original data while using the fewest possible dimensions.</p><p>Principal components are linear combinations of the original variables that capture the maximum variance in the data. They are calculated by finding the eigenvectors and eigenvalues, which define the direction of the components and indicate how much variance each component explains.</p><p>Here is a graphical representation before applying the PCA algorithm. After applying PCA, we select 2 components, as they account for the most explained variance. Finally, we project the original data onto these first 2 components.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tbdu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tbdu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 424w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 848w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 1272w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tbdu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png" width="800" height="438" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:438,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30020,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tbdu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 424w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 848w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 1272w, https://substackcdn.com/image/fetch/$s_!tbdu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F280a4f8a-4dd8-441d-b1e9-21a349a1097f_800x438.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author</figcaption></figure></div><p>One advantage of dimensionality reduction is that it simplifies the visualization and analysis of complex data by reducing the number of dimensions. It also eliminates multicollinearity since using linear combinations of the original variables removes correlations between them. However, a key disadvantage is the loss of interpretability and the sensitivity to variable scaling (if the data is not standardized).</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&amp;gift=true&quot;,&quot;text&quot;:&quot;Give a gift subscription&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?&amp;gift=true"><span>Give a gift subscription</span></a></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #4: What is NLP And Why is Important in AI]]></title><description><![CDATA[This is what makes chatbots possible.]]></description><link>https://artificialcorner.com/p/nlp</link><guid isPermaLink="false">https://artificialcorner.com/p/nlp</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Mon, 02 Sep 2024 14:17:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!_vnL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_vnL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_vnL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_vnL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg" width="1280" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:80418,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_vnL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_vnL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7e0bfa1-0398-4875-8dba-3ac5e1130369_1280x720.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Via <a href="https://pixabay.com/es/photos/audio-la-pnl-5418642/">Pixabay</a></figcaption></figure></div><blockquote><p><em>Natural language processing (NLP) is a subfield of AI that uses machine learning to enable computers to understand and communicate with human language. NLP is used in various AI applications like chabots.</em></p><p><em>Today, we&#8217;ll learn some common NLP techniques. We&#8217;ll focus on the concepts. That said, I added some lines of Python code to better understand the techniques with examples (you don&#8217;t need to know coding to understand the examples though).</em></p></blockquote><p>Natural Language Processing (NLP) is focused on enabling computers to understand and process human language. Computers are great at working with structured data like spreadsheets; however, a lot of the data we generate is <a href="https://artificialcorner.com/p/behind-ai-3-vector-databases-taking">unstructured</a>.</p><p>We can implement many NLP techniques with just a few lines of Python code thanks to open-source libraries such as spaCy and NLTK. In this article, we&#8217;ll dive into the world of NLP by learning some common techniques.</p><pre><code><strong>Table of Contents
</strong>1. Sentiment Analysis
2. Named Entity Recognition (NER)
3. Stemming
4. Lemmatization
5. Bag of Words (BoW)
6. Term Frequency&#8211;Inverse Document Frequency (TF-IDF)
7. Bonus: Wordcloud</code></pre><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>1. Sentiment Analysis</h3><p>Sentiment Analysis is a popular NLP technique that involves taking a piece of text (e.g., a comment, review, or a document) and determining whether it&#8217;s positive, negative, or neutral. It has many applications in healthcare, customer service, banking, etc.</p><h4>Python Implementation</h4><p>For simple cases, in Python, we can use VADER (Valence Aware Dictionary for Sentiment Reasoning) which is available in the NLTK package and can be applied directly to unlabeled text data. </p><p>As an example, let&#8217;s get all sentiment scores of the lines spoken by characters in a TV show. First, we wrangle a dataset available on <a href="https://www.kaggle.com/ekrembayar/avatar-the-last-air-bender">Kaggle</a> named &#8216;avatar.csv&#8217;, and then with VADER we calculate the score of each line spoken. All of this is stored in the <code>df_character_sentiment</code> dataframe.</p><pre><code><strong>import</strong> pandas <strong>as</strong> pd
<strong>import</strong> nltk
<strong>from</strong> nltk.sentiment.vader <strong>import</strong> SentimentIntensityAnalyzer

# reading and wragling data
df_avatar = pd.read_csv('avatar.csv', engine='python')
df_avatar_lines = df_avatar.groupby('character').count()
df_avatar_lines = df_avatar_lines.sort_values(by=['character_words'], ascending=False)[:10]
top_character_names = df_avatar_lines.index.values

# filtering out non-top characters
df_character_sentiment = df_avatar[df_avatar['character'].isin(top_character_names)]
df_character_sentiment = df_character_sentiment[['character', 'character_words']]

# calculating sentiment score
sid = SentimentIntensityAnalyzer()
df_character_sentiment.reset_index(inplace=True, drop=True)
df_character_sentiment[['neg', 'neu', 'pos', 'compound']] = df_character_sentiment['character_words'].apply(sid.polarity_scores).apply(pd.Series)
df_character_sentiment</code></pre><p>In the <code>df_character_sentiment</code> below, we can see that every sentence receives a negative, neutral, and positive score.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xWTK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xWTK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 424w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 848w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 1272w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xWTK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png" width="582" height="374" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:374,&quot;width&quot;:582,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xWTK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 424w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 848w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 1272w, https://substackcdn.com/image/fetch/$s_!xWTK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc46baeb1-783a-4812-9b46-fe7a4eb15247_582x374.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>We could group the scores by character and calculate the mean to obtain the sentiment score for a character and then represent it with horizontal bar plots as shown below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QRR2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QRR2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 424w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 848w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 1272w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QRR2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png" width="700" height="501" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:501,&quot;width&quot;:700,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!QRR2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 424w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 848w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 1272w, https://substackcdn.com/image/fetch/$s_!QRR2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3330f094-3837-42e2-902c-5860c4e93dc0_700x501.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><em>Note: VADER is optimized for social media text, so we should take the results with a grain of salt. You can use a more complete algorithm or develop your own with machine learning libraries. In the link below, there&#8217;s a complete guide on how to create one from scratch with Python using the sklearn library.</em></p></blockquote><h3>2. Named Entity Recognition (NER)</h3><p>Named Entity Recognition is a technique used to locate and classify named entities in text into categories such as persons, organizations, locations, expressions of times, quantities, monetary values, percentages, etc. It&#8216;s used for optimizing search engine algorithms, recommendation systems, customer support, content classification, etc.</p><h4>Python Implementation</h4><p>In Python, we can use SpaCy&#8217;s named entity recognition that supports the following entity types.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8m30!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8m30!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 424w, https://substackcdn.com/image/fetch/$s_!8m30!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 848w, https://substackcdn.com/image/fetch/$s_!8m30!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 1272w, https://substackcdn.com/image/fetch/$s_!8m30!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8m30!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png" width="511" height="494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:511,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8m30!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 424w, https://substackcdn.com/image/fetch/$s_!8m30!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 848w, https://substackcdn.com/image/fetch/$s_!8m30!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 1272w, https://substackcdn.com/image/fetch/$s_!8m30!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2bc5d0b9-84cf-4068-90be-63170072e180_511x494.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source (Spacy documentation)</figcaption></figure></div><p>To see it in action, we first import <code>spacy</code>, and then create a <code>nlp</code> variable that will store the <code>en_core_web_sm</code> pipeline. This is a small English pipeline trained on written web text (blogs, news, comments), that includes vocabulary, vectors, syntax, and entities. To find the entities, we apply nlp to a sentence.</p><p>Let&#8217;s do a test with the following sentence "Biden invites Ukrainian president to White House this summer."</p><pre><code><strong>import</strong> spacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("Biden invites Ukrainian president to White House this summer")

print([(X.text, X.label_) for X in doc.ents])</code></pre><p>Here are the entities we get.</p><pre><code>[('Biden', 'PERSON'), ('Ukrainian', 'GPE'), ('White House', 'ORG'), ('this summer', 'DATE')]</code></pre><p>Spacy found that &#8220;Biden&#8221; is a person, &#8220;Ukranian&#8221; is GPE (countries, cities, states, &#8220;White House&#8221; is an organization, and &#8220;this summer&#8221; is a date.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>3. Stemming &amp; Lemmatization</h3><p>Stemming and lemmatization are 2 popular techniques in NLP. Both normalize a word but in different ways.</p><ul><li><p><strong>Stemming:</strong> It truncates a word to its stem word. For example, the words &#8220;friends,&#8221; &#8220;friendship,&#8221; and &#8220;friendships&#8221; will be reduced to <strong>&#8220;friend.&#8221; </strong>Stemming may not give us a dictionary, or grammatical word for a particular set of words.</p></li><li><p><strong>Lemmatization</strong>: Unlike the stemming technique, lemmatization finds the dictionary word instead of truncating the original word. Lemmatization algorithms extract the correct lemma of each word, so they often require a dictionary of the language to be able to categorize each word correctly.</p></li></ul><p>Both techniques are widely used and you should choose them wisely based on your project&#8217;s goals. Lemmatization has a lower processing speed, compared to stemming so if accuracy is not the project&#8217;s goal but speed, then stemming is an appropriate approach; however. if accuracy is crucial, then consider using lemmatization.</p><p>Python&#8217;s library NLTK makes it easy to work with both techniques. Let&#8217;s see it in action.</p><h4>Python Implementation (Stemming)</h4><p>For the English language, there are two popular libraries available in nltk&#8202;&#8212;&#8202;Porter Stemmer and LancasterStemmer.</p><pre><code><strong>from</strong> nltk.stem <strong>import</strong> PorterStemmer
<strong>from</strong> nltk.stem <strong>import</strong> LancasterStemmer

# PorterStemmer
porter = PorterStemmer()
# LancasterStemmer
lancaster = LancasterStemmer()

print(porter.stem("friendship"))
print(lancaster.stem("friendship"))</code></pre><p>PorterStemmer algorithm doesn&#8217;t follow linguistics, but a set of 5 rules for different cases that are applied in phases to generate stems. The <code>print(porter.stem(&#8220;friendship&#8221;))</code> code will print the word <code>friendship</code></p><p>LancasterStemmer is simple, but heavy stemming due to iterations and over-stemming may occur. This causes the stems to be not linguistic, or they may have no meaning. The <code>print(lancaster.stem(&#8220;friendship&#8221;))</code> code will print the word <code>friend</code>.</p><p>You can try any other word to see how both algorithms differ. In the case of other languages, you can import <code>SnowballStemme </code>from <code>nltk.stem</code></p><h4>Python Implementation (Lemmatization)</h4><p>We&#8217;ll use NLTK again, but this time we import <code>WordNetLemmatizer</code> as shown in the code below.</p><pre><code><strong>from</strong> nltk <strong>import</strong> WordNetLemmatizer

lemmatizer = WordNetLemmatizer()
words = ['articles', 'friendship', 'studies', 'phones']

for word in words:
    print(lemmatizer.lemmatize(word))</code></pre><p>Lemmatization generates different outputs for different Part Of Speech (POS) values. Some of the most common POS values are verb (v), noun (n), adjective (a), and adverb (r). The default POS value in lemmatization is a noun, so the printed values for the previous example will be <code>article</code>, <code>friendship</code>, <code>study</code> and <code>phone</code>.</p><p>Let&#8217;s change the POS<em> </em>value to verb (v).</p><pre><code>from nltk import WordNetLemmatizer

lemmatizer = WordNetLemmatizer()
words = ['be', 'is', 'are', 'were', 'was']

for word in words:
    print(lemmatizer.lemmatize(word, pos='v'))</code></pre><p>In this case, Python will print the word <code>be</code> for all the values in the list.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>5. Bag of&nbsp;Words</h3><p>The Bag of Words (BoW) model is a representation that turns text into fixed-length vectors. This helps us represent text into numbers so we can use it for machine learning models. The model doesn&#8217;t care about the word order, but it&#8217;s only concerned with the frequency of words in the text. It has applications in NLP, information retrieval from documents, and classifications of documents.</p><p>The typical BoW workflow involves cleaning raw text, tokenization, building a vocabulary, and generating vectors.</p><h4>Python Implementation</h4><p>Python&#8217;s library sklearn contains a tool called CountVectorizer that takes care of most of the BoW workflow.</p><p>Let&#8217;s use the following 2 sentences as examples.</p><p><strong>Sentence 1: </strong>&#8220;I love writing code in Python. I love Python code&#8221;</p><p><strong>Sentence 2: </strong>&#8220;I hate writing code in Java. I hate Java code&#8221;</p><p>Both sentences will be stored in a list named <code>text</code>. Then we&#8217;re going to create a dataframe <code>df</code> to store this <code>text</code> list. After this, we&#8216;ll initiate an instance of CountVectorizer<code>(cv)</code>, and then we&#8217;ll fit and transform the text data to obtain the numeric representation. This will be stored in a document-term matrix <code>df_dtm</code>.</p><pre><code><strong>import</strong> pandas <strong>as</strong> pd
<strong>from</strong> sklearn.feature_extraction.text <strong>import</strong> CountVectorizer

text = ["I love writing code in Python. I love Python code",
        "I hate writing code in Java. I hate Java code"]

df = pd.DataFrame({'review': ['review1', 'review2'], 'text':text})
cv = CountVectorizer(stop_words='english')
cv_matrix = cv.fit_transform(df['text'])
df_dtm = pd.DataFrame(cv_matrix.toarray(),
                      index=df['review'].values,
                      columns=cv.get_feature_names())
df_dtm</code></pre><p>The BoW representation made with CountVectorizer stored in <code>df_dtm </code>looks like the picture below. Keep in mind that words with 2 letters or fewer are not taken into account by the CountVectorizer.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iISR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iISR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 424w, https://substackcdn.com/image/fetch/$s_!iISR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 848w, https://substackcdn.com/image/fetch/$s_!iISR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 1272w, https://substackcdn.com/image/fetch/$s_!iISR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iISR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png" width="459" height="105" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:105,&quot;width&quot;:459,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iISR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 424w, https://substackcdn.com/image/fetch/$s_!iISR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 848w, https://substackcdn.com/image/fetch/$s_!iISR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 1272w, https://substackcdn.com/image/fetch/$s_!iISR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28eda185-a59d-4627-a73e-18de8f91bf74_459x105.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>As you can see the numbers inside the matrix represent the number of times each word was mentioned in each review. Words like &#8220;love,&#8221; &#8220;hate,&#8221; and &#8220;code&#8221; have the same frequency (2) in this example.</p><p>Overall, we can say that CountVectorizer does a good job tokenizing text, building a vocabulary, and generating vectors.</p><h3>6. Term Frequency&#8211;Inverse Document Frequency (TF-IDF)</h3><p>Unlike the CountVectorizer, the TF-IDF computes &#8220;weights&#8221; that represent how relevant a word is to a document in a collection of documents (aka corpus). The TF-IDF value increases proportionally to the number of times a word appears in the document and is offset by the number of documents in the corpus that contain the word.<strong> Simply put, the higher the TF-IDF score, the rarer or unique or valuable the term and vice versa. </strong>It has applications in information retrieval like search engines that aim to deliver results that are most relevant to what you&#8217;re searching for.</p><p>Before we see the Python implementation, let&#8217;s see an example so you have an idea of how the TF and IDF are calculated. For the following example, we&#8217;ll use the same sentences used for the CountVectorizer example.</p><p><strong>Sentence 1:</strong> &#8220;I love writing code in Python. I love Python code&#8221;</p><p><strong>Sentence 2: </strong>&#8220;I hate writing code in Java. I hate Java code&#8221;</p><h4>Term Frequency (TF)</h4><p>There are different ways to define the term frequency. One suggests the raw count itself (i.e., what the Count Vectorizer does), but others suggest it&#8217;s the frequency of the word in the sentence divided by the total number of words in the sentence<em>. </em></p><p>For this simple example, we&#8217;ll use the first criteria. The term frequency is shown in the following table.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!znzj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!znzj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 424w, https://substackcdn.com/image/fetch/$s_!znzj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 848w, https://substackcdn.com/image/fetch/$s_!znzj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 1272w, https://substackcdn.com/image/fetch/$s_!znzj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!znzj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png" width="729" height="358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:729,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!znzj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 424w, https://substackcdn.com/image/fetch/$s_!znzj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 848w, https://substackcdn.com/image/fetch/$s_!znzj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 1272w, https://substackcdn.com/image/fetch/$s_!znzj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94e9338d-3846-4e11-934b-ed0b2d9a6aa8_729x358.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>As you can see, the values are the same as the ones calculated for the CountVectorizer before. Also, words with 2 letters or fewer are not taken into account.</p><h4>Inverse Document Frequency (IDF)</h4><p>The IDF is also calculated in different ways. Although standard textbook notation defines the IDF as idf(t) = log [ n / (df(t) + 1), the sklearn library we&#8217;ll use later in Python calculates the formula by default as follows.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4_N8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4_N8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 424w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 848w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 1272w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4_N8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png" width="637" height="125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84974128-10b7-43cd-9168-56ca641574cc_637x125.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:125,&quot;width&quot;:637,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4_N8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 424w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 848w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 1272w, https://substackcdn.com/image/fetch/$s_!4_N8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84974128-10b7-43cd-9168-56ca641574cc_637x125.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Also, sklearn assumes natural logarithm <code>ln</code> instead of <code>log</code> and smoothing <em>(smooth_idf=True)</em>. Let&#8217;s calculate the IDF values for each word as sklearn will do it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!h_rA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!h_rA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 424w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 848w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 1272w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!h_rA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png" width="800" height="323" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:323,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!h_rA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 424w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 848w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 1272w, https://substackcdn.com/image/fetch/$s_!h_rA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff359ed7f-9258-420f-ac6f-59c1604c0ee4_800x323.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><h4>TF-IDF</h4><p>Once we have the TF and IDF values, we can obtain the TF-IDF by multiplying both values (TF-IDF = TF * IDF). The values are shown in the table below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!U1Xf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!U1Xf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 424w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 848w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 1272w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!U1Xf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png" width="800" height="325" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:325,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!U1Xf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 424w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 848w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 1272w, https://substackcdn.com/image/fetch/$s_!U1Xf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45599e70-cb63-4e61-88ef-ce2f849157a3_800x325.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><h4>Python Implementation</h4><p>Calculating the TF-IDF shown in the table above in Python requires a few lines of code thanks to the sklearn library.</p><pre><code><strong>import</strong> pandas <strong>as</strong> pd
<strong>from</strong> sklearn.feature_extraction.text <strong>import</strong> TfidfVectorizer

text = ["I love writing code in Python. I love Python code",
        "I hate writing code in Java. I hate Java code"]

df = pd.DataFrame({'review': ['review1', 'review2'], 'text':text})
tfidf = TfidfVectorizer(stop_words='english', norm=None)
tfidf_matrix = tfidf.fit_transform(df['text'])
df_dtm = pd.DataFrame(tfidf_matrix.toarray(),
                      index=df['review'].values,
                      columns=tfidf.get_feature_names())
df_dtm</code></pre><p>The TF-IDF representation stored in <code>df_dtm </code>is presented below.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JMet!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JMet!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 424w, https://substackcdn.com/image/fetch/$s_!JMet!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 848w, https://substackcdn.com/image/fetch/$s_!JMet!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 1272w, https://substackcdn.com/image/fetch/$s_!JMet!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JMet!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png" width="549" height="114" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:114,&quot;width&quot;:549,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JMet!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 424w, https://substackcdn.com/image/fetch/$s_!JMet!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 848w, https://substackcdn.com/image/fetch/$s_!JMet!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 1272w, https://substackcdn.com/image/fetch/$s_!JMet!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44b7ee57-a336-4d29-925b-7dd6069f7868_549x114.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><blockquote><p><em>Note: By default TfidfVectorizer() uses l2 normalization, but to use the same formulas shown above we set </em><code>norm=None</code><em> as a parameter. For more details of the formulas used by default in sklearn and how you can customize it check its <a href="https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfTransformer.html">documentation</a>.</em></p></blockquote><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Bonus: Wordcloud</h3><p>Wordcloud is a popular technique that helps us identify the keywords in a text. It&#8217;s not considered as a NLP technique but it still uses some of the techniques explained in this article.</p><p>In a wordcloud, more frequent words have a larger and bolder font, while less frequent words have smaller or thinner fonts. In Python, you can make simple wordclouds with the <code>wordcloud</code> library and nice-looking wordclouds with the <code>stylecloud</code>library.</p><p>Below you can find the code to make a wordcloud in Python. I&#8217;m using a text file of a Steve Jobs speech.</p><pre><code><strong>import</strong> stylecloud

stylecloud.gen_stylecloud(file_path='SJ-Speech.txt',
                          icon_name= "fas fa-apple-alt")</code></pre><p>This is the result of the code above.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xelw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xelw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 424w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 848w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 1272w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xelw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png" width="512" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Xelw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 424w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 848w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 1272w, https://substackcdn.com/image/fetch/$s_!Xelw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaf4bc67-0418-4ea2-8427-8dcd2e11f654_512x512.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>Wordclouds are popular because they&#8217;re engaging, easy to understand, and easy to create.</p><p>You can take customization even further by changing the colors, removing stopwords, choosing your image, or even adding your own image as a mask of the wordcloud.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/p/nlp?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/p/nlp?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/p/nlp/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/p/nlp/comments"><span>Leave a comment</span></a></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #3: Vector Databases - Taking Data Revolution to The Next Level]]></title><description><![CDATA[Here's how AI-centric vector databases are gaining their place in modern software stacks.]]></description><link>https://artificialcorner.com/p/vector-database</link><guid isPermaLink="false">https://artificialcorner.com/p/vector-database</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Wed, 28 Aug 2024 13:10:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kR5p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kR5p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kR5p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 424w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 848w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kR5p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg" width="800" height="533" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:533,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33075,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kR5p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 424w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 848w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!kR5p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e90691-33ae-44e7-9580-c8cf0e0af2af_800x533.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><em>In the previous article</em> <em>of our <a href="https://artificialcorner.com/s/behind-ai">Behind AI</a> series, we explained in plain English what  databases are and compared the top DBMS. Today, we&#8217;ll focus on a type of database that has become increasingly important in AI: vector databases.</em></p></blockquote><p>The internet contains a huge amount of data in different forms. In the past, this data was mostly structured, but as the internet grew, unstructured data such as photos, audio, text, and video files became more common.</p><p>Analysts estimate that 80-90% of any organization&#8217;s data is unstructured, so how can we deal with this unstructured data?</p><p>Traditional relational databases and NoSQL databases struggle to analyze unstructured data especially when it comes to doing it in real-time. Here&#8217;s when vector databases can help. They were built to manage massive embeddings vectors converted from unstructured data.</p><p>In this article, we&#8217;ll learn more about vector databases, how they can help us manage unstructured data, and the solutions they offer.</p><h3>Vector Databases vs Traditional Databases</h3><p>Relational databases store items with pre-defined relationships between them. These databases typically organize data in tables with columns and rows. This is known as structured data and is generally easy to search and analyze. In contrast, unstructured data is more complex and requires more work to understand.</p><p>Machine learning and deep learning models can help us understand this unstructured data by transforming it into vector embeddings. These embeddings are high dimensional vectors that describe complex data as numerical values in different dimensions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zZCG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zZCG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 424w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 848w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 1272w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zZCG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png" width="800" height="278" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:278,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zZCG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 424w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 848w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 1272w, https://substackcdn.com/image/fetch/$s_!zZCG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0250577d-ecd7-44a0-afb4-18ced8396f3f_800x278.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Milvus</figcaption></figure></div><p>Vector databases are designed for search and data mining.</p><p>This search involves querying data as we&#8217;d do with a relational database. However, a relational database retrieves results that are an exact match, while a vector database offers more complex search capabilities.</p><p>One of the types of search that vector databases excel at is similarity search (aka vector search). Similarity search consists in finding the most similar item to the one we&#8217;re looking for. This task is called nearest-neighbor search because the similar items we get are actually near-neighbor matches. This list of items wouldn&#8217;t exist if we weren&#8217;t performing a similarity search.</p><p>To sum it up, traditional databases return results that are an exact match, while a vector database returns near-neighbor matches. In addition to that, vector databases offer good speed, accuracy, and flexibility.</p><p>This is great for product search. Say we want to buy black Nike shoes, so we go to our favorite online store and search &#8220;black Nike shoes.&#8221; If the search engine was built with similarity search functionalities, we&#8217;ll get similar items, in case there aren&#8217;t any black Nike shoes in the inventory.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E9e-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E9e-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 424w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 848w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 1272w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E9e-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png" width="800" height="524" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/447def70-13e2-40dd-ae5c-88275a831c46_800x524.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:524,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E9e-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 424w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 848w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 1272w, https://substackcdn.com/image/fetch/$s_!E9e-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F447def70-13e2-40dd-ae5c-88275a831c46_800x524.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Milvus</figcaption></figure></div><p>This is just one of the applications that vector databases have. Let&#8217;s see some common use cases.</p><h3>Vector Databases Use&nbsp;Cases</h3><h4>Recommendation Engines</h4><p>Recommendation systems are everywhere. They&#8217;re used to suggest items similar to past videos, movies, purchases, and more.</p><p>Vector databases are great for building recommender systems. Its similarity search functionality makes vector databases a good option for suggesting relevant items to users.</p><p>We could use vector databases to build a recommender system that would suggest movies that a user might like based on the user&#8217;s historical movie rating data. We could also build a system that recommends products based on past purchases a customer made.</p><h4>Semantic Search</h4><p>Semantic search is a data searching technique that not only allows us to find keywords but seeks to understand natural language as a person would do.</p><p>How does it do that? It puts our search query into context.</p><p>We can use vector databases to index vector embeddings from NLP models in order to understand the context of the text. This provides more accurate search results.</p><p>If you remember all the things you search on Google, you&#8217;ll realize that we often use natural language in our queries. Semantic search is then necessary for a search engine to provide relevant results.</p><h4>Similarity Search</h4><p>Unstructured data such as images, video, and audio are hard to classify in relational databases.</p><p>There are some workarounds to deal with this using relational databases, but different people would use different criteria, which makes this more complicated.</p><p>In contrast, vector databases can analyze large-scale data in real-time. They&#8217;re behind image search technologies such as autonomous cars that are able to recognize objects and phones that can recognize the face of a user. They&#8217;re also present in audio search. This helps our devices identify the name of a song or a user&#8217;s voice.</p><h3>A case study of a vector&nbsp;database</h3><p>There is an emerging market for vector databases out there. Let&#8217;s take <a href="https://milvus.io/">Milvus</a> as an example and look at its features and advantages.</p><p>Milvus is an open-source vector database that was created with the purpose of storing, indexing, and managing embedding vectors generated by machine learning models.</p><p>Unlike relational databases that handle structured data using a pre-defined pattern, Milvus can handle embedding vectors converted from unstructured data.</p><p>Here&#8217;s why Milvus is a good option:</p><ul><li><p>It offers high performance when conducting vector search on massive datasets.</p></li><li><p>Cloud scalability and high reliability even in the event of a disruption.</p></li><li><p>Hybrid search achieved by pairing scalar filtering with vector similarity search.</p></li></ul><p>Here&#8217;s the Milvus workflow.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wdc1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wdc1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wdc1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg" width="800" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:363,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wdc1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wdc1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ab352-cca2-4f66-82f1-2caa7e110f06_800x363.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Milvus</figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Behind AI #2: What Is a Database and Why Is Important in AI]]></title><description><![CDATA[Here's everything you need to know about databases]]></description><link>https://artificialcorner.com/p/database</link><guid isPermaLink="false">https://artificialcorner.com/p/database</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Mon, 26 Aug 2024 13:19:59 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Q6QL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q6QL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q6QL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 424w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 848w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 1272w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q6QL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp" width="720" height="540" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:540,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21914,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Q6QL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 424w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 848w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 1272w, https://substackcdn.com/image/fetch/$s_!Q6QL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd5531f-6382-40ee-a95e-c4a39b217d71_720x540.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Via Shutterstock</figcaption></figure></div><blockquote><p><em>Hi!</em></p><p><em>Data is <a href="https://artificialcorner.com/p/data-an-important-resource-in-the">an important resource in AI</a>. Companies store data in different types of databases and today we&#8217;ll learn everything about them (in the next article, we&#8217;ll focus on a type of database that is specially used in AI, so stay tuned!)</em></p></blockquote><p>No matter what your job is probably you&#8217;ve ever heard of the word database.</p><p>Companies out there use different types of databases to store all the information they collected throughout the years. Although all these databases might seem the same, they have some functionalities that make them more suitable for certain situations, so it&#8217;s worth learning more about them.</p><p>In this article, we&#8217;ll see what databases are and the most commonly used in companies.</p><pre><code><strong>Table of Contents
</strong>1. What is a Database?
2. Types of Databases
 - Relational databases
 - Non-Relational databases
3. Top databases</code></pre><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>What is a Database?</h3><p>A database is a collection of data typically stored electronically in a computer system and controlled by a database management system (DBMS). The data, the DBMS, and the applications associated with them are referred to as a database system (or just &#8220;database&#8221;).</p><p>The words database management system and database are often used interchangeably, but technically they&#8217;re not the same.</p><p>To distinguish them consider the case of a social media app that stores different information about its users such as messages, photos, comments, etc. The database stores this big collection of data, but that&#8217;s pretty much what it does. If you want to edit, update, or delete data, you need a DBMS that does the talking for you. Some of the most popular DBMS are Oracle, MySQL, SQL Server, and PostgreSQL.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Izbl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Izbl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 424w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 848w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 1272w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Izbl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png" width="800" height="471" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:471,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Izbl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 424w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 848w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 1272w, https://substackcdn.com/image/fetch/$s_!Izbl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd00e0b5-5d5c-4769-b023-72424702b0de_800x471.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by author made on&nbsp;Canva</figcaption></figure></div><p>Again, people often refer to both the DBMS and DB simply as &#8220;database&#8221; but now you know how this actually works.</p><p>Another way to think of a database is as a big spreadsheet with many rows and columns. That&#8217;s a good comparison, but a database goes beyond that. Both the database and spreadsheet are good for storing information, but they mainly differ in the following aspects:</p><ul><li><p>How the data is stored and manipulated: Databases allow complex data manipulation, while spreadsheets aren't meant for users who need much data manipulation.</p></li><li><p>Who can access the data: Databases allow multiple users to quickly access and query the data, while spreadsheets were designed only for a single user or a small number of users.</p></li><li><p>The amount of data that can be stored: Databases are designed to store larger collections of data, while spreadsheets have a limitation.</p></li></ul><p>Last but not least, a database cannot only store data in tables and rows. That&#8217;s how relational databases typically work, but there&#8217;s also another type of database called non-relational database. This leads us to our next point.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>Types of Databases</h3><p>Databases are typically divided into relational and non-relational databases. Among the top 10 databases, you&#8217;ll see both relational and non-relational databases. One type of database is not better than the other, but they suit different needs.</p><h4>Relational databases</h4><p>A relational database (aka SQL database), stores data in tables and rows also referred to as records. This type of database links information from different tables through keys.</p><p>A key is a unique value in a table that is also known as the &#8220;primary key&#8221;. When this key is added to a record located in another table, it&#8217;s called &#8220;foreign key&#8221; in this second table. This connection between primary and foreign keys creates a relationship between records within both tables.</p><p>Some popular relational database management systems (RDBMS) are Oracle, MySQL, SQL Server, and PostgreSQL.</p><p>Here&#8217;s a basic schema that shows how a relational database works.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WlpV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WlpV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 424w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 848w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 1272w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WlpV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png" width="800" height="699" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7607089-3832-455c-be4a-1de84a99de04_800x699.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:699,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WlpV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 424w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 848w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 1272w, https://substackcdn.com/image/fetch/$s_!WlpV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7607089-3832-455c-be4a-1de84a99de04_800x699.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://pixabay.com/vectors/database-schema-data-tables-schema-1895779/">Pixabay</a></figcaption></figure></div><p>To query data in a RDBMS, we use Structured Querying Language (SQL). With SQL we can create new records, update them, and more. This makes the RDBMS good for apps that need transactional functionality, data mining, and complex reporting.</p><h4>Non-Relational databases</h4><p>A non-relational database (aka NoSQL database), stores data without tables, rows, or keys. In other words, a non-relational database stores data in a non-tabular form. This adds some flexibility and helps satisfy specific requirements of the type of data being stored.</p><p>You can think of a non-relational database as a collection of documents. A document can contain a lot of detailed information about a customer. Each customer can have different types of information, but they can be stored in the same document.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FqxM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FqxM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 424w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 848w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 1272w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FqxM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png" width="800" height="471" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:471,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FqxM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 424w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 848w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 1272w, https://substackcdn.com/image/fetch/$s_!FqxM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3f86ff2-7f22-49b4-a75f-bcaa43ff04b5_800x471.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>The ability to process and organize different types of information makes non-relational databases more flexible than relational databases.</p><p>There are four popular non-relational types: document data store, column-oriented database, key-value store, and graph database. One of the most popular NoSQL databases is MongoDB.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>What are the top databases?</h3><p>It&#8217;s hard to rank the database based on their functionality because they suit different needs and can be more convenient in certain scenarios than in others. That said, it&#8217;s possible to rank the database management systems according to their popularity.</p><p>In fact, <a href="https://db-engines.com/en/ranking">DB-Engine</a> ranks DBMS by their current popularity. To do so, they calculate scores following different <a href="https://db-engines.com/en/ranking_definition">parameters</a>.</p><p>Here are the top 10 databases by their popularity.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/qDEH5/4/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3fa2ba4-d67f-4a16-920c-b6789c7bb696_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:523,&quot;title&quot;:&quot;Top 10 Databases&quot;,&quot;description&quot;:&quot;&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/qDEH5/4/" width="730" height="523" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>Now let&#8217;s see more about them, compare them, and see their pros and cons.</p><h3>1. Oracle</h3><p>Oracle Database is a widely used RDBMS across industries. In fact, it has the largest market share of around 30.2% in the RDBMS market.</p><p>Oracle Database supports SQL language to interact with the database. It&#8217;s considered one of the best databases because it supports all data types involving relational, graph, structured, and unstructured information. In addition to that, Oracle Database is preferred for its flexible standards, scalability, high availability, and strong security.</p><h4>Pros</h4><ul><li><p>It&#8217;s highly compatible with different apps and platforms</p></li><li><p>Helps with scalability</p></li><li><p>It offers good privacy and security</p></li></ul><h4>Cons</h4><ul><li><p>The license is expensive</p></li><li><p>Users might need extensive SQL knowledge to use Oracle Database</p></li></ul><h4>Popularity</h4><p>Google Trends shows more interest in Oracle than in MySQL over the past 5 years. The graph also reveals the same ups and downs for both databases.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jJb8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jJb8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 424w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 848w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 1272w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jJb8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png" width="800" height="395" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:395,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jJb8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 424w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 848w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 1272w, https://substackcdn.com/image/fetch/$s_!jJb8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f11db8-a37b-4054-8f31-d41f4a05f5c8_800x395.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Google&nbsp;Trends</figcaption></figure></div><h3>2. MySQL</h3><p>MySQL is one of the most popular databases. It&#8217;s open-source so any person or company can use MySQL for free, but if the code needs to be integrated into a commercial application, you need to purchase a license. That said, this database is still worth it for anyone who wants to experiment with a friendly yet powerful database.</p><p>MySQL was developed by Oracle and it&#8217;s a relational database management system. As explained before, the relation model consists in organizing data in tables with rows and columns, while the relationship between elements follows a logical structure. Companies such as Facebook, Twitter, Wikipedia, and YouTube employ MySQL backends.</p><h4>Pros</h4><ul><li><p>It&#8217;s open source: Unlike other options, you don&#8217;t have to pay to use most features of MySQL</p></li><li><p>It&#8217;s cross-platform: Runs on Linus, Solaris, and Windows and supports platforms with programming languages such as C, C++, Java, Python, etc.</p></li><li><p>Reliable data security: MySQL is known for being a secure database management system. This is why so many well-known companies use it in their applications.</p></li><li><p>It&#8217;s easy to use: Anyone can download, install and start to use MySQL in a few minutes.</p></li></ul><h4>Cons</h4><ul><li><p>It&#8217;s not for large-sized data</p></li><li><p>It doesn&#8217;t support SQL check constraints</p></li><li><p>It doesn&#8217;t have a good debugging tool compared to paid databases</p></li><li><p>It doesn&#8217;t handle transactions very efficiently</p></li></ul><h4>Popularity</h4><p>Google Trends shows that the interest in MySQL has slightly decreased over the past 5 years, but has suddenly risen compared to other databases like SQL Server.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nvJ3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nvJ3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 424w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 848w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 1272w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nvJ3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png" width="800" height="377" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:377,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nvJ3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 424w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 848w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 1272w, https://substackcdn.com/image/fetch/$s_!nvJ3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F719e505b-4ca2-4d04-b1ff-9c418ceb03c0_800x377.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Google&nbsp;Trends</figcaption></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>3. SQL&nbsp;Server</h3><p>SQL Server was developed by Microsoft and it&#8217;s considered a great RDBMS for both on-premise and cloud environments. It has a Database Engine component that allows storing, processing, and securing data. The database engine is divided into two segments&#8202;&#8212;&#8202;the relational and storage engine. The first is used to process commands and queries, while the second is used to manage features such as tables, pages, files, indexes, and transactions.</p><p>Besides SQL language, SQL Server also includes Transact-SQL (T-SQL), which is Microsoft&#8217;s extension to the SQL used to interact with relational databases. SQL Server is a good option for businesses that want to scale the performance, availability, and security seamlessly based on their requirements.</p><h4>Pros</h4><ul><li><p>It has various supported editions (enterprise, standard, express, and developer). The express SQL server edition is free of cost.</p></li><li><p>It has an online documentation</p></li><li><p>On-premise and cloud database support</p></li><li><p>It offers different tools and apps</p></li></ul><h4>Cons</h4><ul><li><p>Expensive enterprise edition</p></li><li><p>It&#8217;s available for Windows, Linux, and macOS, but the steps to install it on a Mac aren&#8217;t as straightforward as on a Windows machine.</p></li></ul><h4>Popularity</h4><p>Google Trends shows more interest over time in SQL Server than in PostgreSQL. In fact, the interest in PostgreSQL hasn&#8217;t changed that much over the past 5 years.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oGd5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oGd5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 424w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 848w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 1272w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oGd5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png" width="800" height="385" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:385,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oGd5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 424w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 848w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 1272w, https://substackcdn.com/image/fetch/$s_!oGd5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f73ade5-7036-4e3a-a330-5710173769ff_800x385.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Google&nbsp;Trends</figcaption></figure></div><h3>4. PostgreSQL</h3><p>PostgreSQL is known as the world&#8217;s most advanced open source object-relational database management system (ORDBMS). Part of this reputation is due to its architecture, reliability, robustness, and extensibility.</p><p>PostgreSQL comes with many features that help build apps, protect data integrity and help manage data no matter how big or small the data is. It&#8217;s also highly extensible in many areas. To name a few:</p><ul><li><p>Stored functions and procedures</p></li><li><p>PL/PGSQL, Perl, Python</p></li><li><p>SQL/JSON path expressions</p></li><li><p>Additional functionality such as PostGIS (spatial database extender for PostgreSQL)</p></li></ul><p>These extensions help us process data right from PostgreSQL, so we don&#8217;t need to find workarounds to implement them.</p><h4>Pros</h4><ul><li><p>It&#8217;s extremely programmable: You can extend PostgreSQL thanks to its directory-based operation and dynamic loading</p></li><li><p>It&#8217;s highly extensible</p></li><li><p>It has a very rich set of indexing options</p></li></ul><h4>Cons</h4><ul><li><p>Performance: PostgreSQL is sometimes less efficient than other RDBMS such as MySQL (at least for simple intensive reading operations)</p></li><li><p>It might be difficult to troubleshoot PostgreSQL</p></li></ul><h4>Popularity</h4><p>Google Trends shows similar interest over time in PostgreSQL and MongoDB. That said, we should consider that PostgreSQL was initially released in 1996, while MongoDB was released in 2009.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1gwr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1gwr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 424w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 848w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 1272w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1gwr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png" width="800" height="397" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:397,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1gwr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 424w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 848w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 1272w, https://substackcdn.com/image/fetch/$s_!1gwr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F399b45d8-09e4-4caf-860e-e084c9784f54_800x397.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Google&nbsp;Trends</figcaption></figure></div><h3>5. MongoDB</h3><p>MongoDB is an open-source document database that uses a flexible schema for storing data. Unlike SQL databases that store data in tables of rows and columns, NoSQL database programs like MongoDB use JSON-like documents with optional schemas.</p><p>MongoDB is great for those who build internet and business applications and need to evolve and scale quickly. Some of the advantages of MongoDB for developers are the power of document-oriented databases (documents can be retrieved directly in JSON format, which developers find easy to work with), user experience, scalability and transactionality, and its thriving community.</p><p>Overall, MongoDB is good if you&#8217;re looking for a database that:</p><ul><li><p>Supports rapid iterative development</p></li><li><p>Enables the scale to high levels of read and write traffic</p></li><li><p>Stores, manages, and searches data when creating apps</p></li></ul><h4>Pros</h4><ul><li><p>It offers a flexible schema that it&#8217;s not possible to get in a RDBMS</p></li><li><p>Scalability: MongoDB uses <em>sharding</em>, which allows the database to use horizontal scalability.</p></li><li><p>It&#8217;s free and supports Windows, macOS, and Linux</p></li></ul><h4>Cons</h4><ul><li><p>High memory usage: The data size in MongoDB is higher than in other databases</p></li><li><p>Less flexibility with querying: It fails to support joins as a relational database</p></li></ul><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&amp;gift=true&quot;,&quot;text&quot;:&quot;Give a gift subscription&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?&amp;gift=true"><span>Give a gift subscription</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Behind AI #1: Machine Learning Algorithms Any AI Enthusiast Should Know]]></title><description><![CDATA[Machine learning algorithms explained in plain English]]></description><link>https://artificialcorner.com/p/algorithms-1</link><guid isPermaLink="false">https://artificialcorner.com/p/algorithms-1</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Mon, 19 Aug 2024 18:05:18 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!dRrC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dRrC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dRrC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 424w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 848w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dRrC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg" width="800" height="566" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:566,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dRrC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 424w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 848w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!dRrC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97c49a06-1910-47c2-b54f-3467f9365d8c_800x566.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Via Shutterstock</figcaption></figure></div><blockquote><p><em>Hi!</em></p><p><em>I created a new series called &#8220;AI &amp; Python&#8221; which will be focused on learning Python, coding concepts, automation, and creating AI apps. From now on, &#8220;Behind AI&#8220; will be focused on what's behind the AI products you love. No programming knowledge will be required. Tech concepts (if any) will be explained in plain English.</em></p><p><em>Examples of a Behind AI piece are <a href="https://artificialcorner.com/p/data-an-important-resource-in-the">this article</a> and the one you&#8217;re reading right now. </em></p><p><em>P.S. In case you&#8217;re not interested in the Python articles, go to <a href="https://artificialcorner.substack.com/account">settings</a> and turn off notifications for &#8220;AI &amp; Python&#8221; (leave the rest the same to keep receiving my other emails)</em></p></blockquote><p>Machine learning (ML) is the field behind all the magic in AI products. If you&#8217;re new to ML, you probably must&#8217;ve heard of the words &#8220;algorithm&#8221; or &#8220;model&#8221; without knowing how they&#8217;re related to machine learning. </p><p>Here&#8217;s a brief explanation in plain English.</p><p>Machine learning algorithms are categorized as supervised or unsupervised. Supervised learning algorithms model the relationship between labeled input and output data (aka target). This model is then used to predict the label of new observations using new labeled input data. If the target variable is discrete, we&#8217;re dealing with a classification problem, while if the target variable is continuous we&#8217;re dealing with a regression problem. In contrast, unsupervised learning doesn&#8217;t rely on labeled input/output data but processes unlabeled data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!n3AW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!n3AW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!n3AW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!n3AW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!n3AW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f3b0e2-d7b1-4b92-adc2-0f4d184883fe_800x450.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image made by author on&nbsp;Canva</figcaption></figure></div><p>Here are 6 supervised learning algorithms that you should know.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>1. Linear Regression</h3><p>Linear regression is the simplest algorithm used in machine learning. This algorithm is used for modeling the relationship between two or more variables. There are two types of linear regression&#8202;&#8212;&#8202;simple and multiple linear regression.</p><p>In simple linear regression, there&#8217;s one independent variable and one dependent variable, while in multiple linear regression there are multiple independent variables and one dependent variable.</p><p>Here&#8217;s the multiple linear regression equation:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wsRT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wsRT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 424w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 848w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 1272w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wsRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png" width="627" height="66" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:66,&quot;width&quot;:627,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wsRT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 424w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 848w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 1272w, https://substackcdn.com/image/fetch/$s_!wsRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d13d711-d072-48f4-b715-f7b4b16da82e_627x66.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>where <code>y</code> is the dependent variable (target value), <code>x1, x2,&nbsp;&#8230; xn</code> the independent variables (predictors), <code>b0</code> the intercept, <code>b1, b2,&nbsp;... bn</code> the coefficients and <code>n</code> the number of observations.</p><p>In the picture below, you&#8217;ll see a simplified version of the linear regression equation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vvix!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vvix!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!vvix!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!vvix!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!vvix!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vvix!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vvix!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!vvix!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!vvix!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!vvix!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8973917-9c31-478a-8068-ac02d99b3a9e_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>As you can see in the picture above, there&#8217;s a linear relationship, so if one variable increases or decreases, the other variable will also increase or decrease.</p><p>We can use linear regression to predict scores, salaries, house prices, etc. That said, the prediction accuracy isn&#8217;t as good as those you&#8217;d get with other algorithms.</p><h3>2. SVM</h3><p>A Support Vector Machine (SVM) is a supervised<strong> </strong>learning algorithm that is mostly used in classification problems. We usually feed the SVM model with labeled training data to categorize new text.</p><p>SVM is a good choice when we have a limited number of samples and speed is a priority. This is why it&#8217;s used when we work with a dataset that has a few thousand of tagged samples in text classification.</p><p>To understand much better how SVM works let&#8217;s see an example.</p><p>In the picture below, we have two tags (green and yellow) and two features (x and y). Say we want to build a classifier that finds whether our text data is either green or yellow. If that&#8217;s the case, we will plot each observation (aka data point) in an n-dimensional space, where &#8220;n&#8221; is the number of features used.</p><p>We only have two features, so the observations are plotted in 2-dimensional space as shown in the picture below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NjT9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NjT9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NjT9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NjT9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!NjT9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5003509-0bf6-4cb3-8b8a-6416e0b83964_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>SVM takes the data points and makes a hyperplane that best separates the classes. Since the observations are plotted in 2-dimensional space, the hyperplane is a line.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7tpJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7tpJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7tpJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7tpJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!7tpJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33683bc4-f2b4-4c3b-91a7-b39fd9aa57a6_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image by&nbsp;author</figcaption></figure></div><p>This red line is also known as the decision boundary. The decision boundary determines whether a data point belongs to one class or to another. In our example, if the data point falls on the left side, it will be classified as green, while if it falls on the right side, it will be classified as yellow.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>3. Decision&nbsp;Tree</h3><p>If you know nothing about machine learning, you might still know about decision trees.</p><p>A decision tree is a model used in planning, statistics, and machine learning that uses a tree-like structure of decisions/consequences to evaluate the possible events involved in a particular problem.</p><p>Here&#8217;s a decision tree that evaluates scenarios where people want to play football.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3vUh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3vUh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 424w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 848w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 1272w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3vUh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png" width="573" height="404" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af87377f-54db-4e56-a679-106fb0570251_573x404.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:404,&quot;width&quot;:573,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3vUh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 424w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 848w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 1272w, https://substackcdn.com/image/fetch/$s_!3vUh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf87377f-54db-4e56-a679-106fb0570251_573x404.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://commons.wikimedia.org/wiki/File:Decision_tree_model.png">Wikimedia Commons</a></figcaption></figure></div><p>Each square is called a node. The last nodes of the decision tree are called the leaves of the tree. To make predictions we start from the root of the tree (first node). Each node in the decision tree will be evaluated. Then we follow the branch that agrees with the evaluation and jump to the next node.</p><p>The decision tree algorithm can be used for solving both regression and classification problems. We use a decision tree to build a model that can predict the class or value of the target variable by learning decision tree rules inferred from the training data.</p><h3>4. Random&nbsp;Forest</h3><p>Random forest is an ensemble of many decision trees. It combines the simplicity of a decision tree with flexibility resulting in an improvement in accuracy.</p><p>To make a random forest, first, we need to create a &#8220;bootstrapped&#8221; dataset. Bootstrapping is randomly selecting samples from original data (we can even choose the same sample more than once). Then, we use the bootstrapped dataset to create a decision tree.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-Iri!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-Iri!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 424w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 848w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 1272w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-Iri!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png" width="512" height="289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:289,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-Iri!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 424w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 848w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 1272w, https://substackcdn.com/image/fetch/$s_!-Iri!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14cf3712-ba52-44eb-9d81-cceff65d5531_512x289.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="https://commons.wikimedia.org/wiki/File:Ensemble_Bagging.svg">Wikimedia Commons</a></figcaption></figure></div><p>This method is known as &#8220;bagging.&#8221; If we repeat the previous steps multiple times, we get a good number of trees. This variety of trees is what makes random forests more effective than a single decision tree.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3TNo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3TNo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3TNo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3TNo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!3TNo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a0d7443-4b49-4767-9d21-76344a2cdafd_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="https://commons.wikimedia.org/wiki/File:Random_forest_explain.png">Wikimedia Commons</a></figcaption></figure></div><p>If the random forest is used for a classification task, the model selects the mode of the predictions of each decision tree. For a regression task, the model selects the mean value of the results from the decision trees.</p><h3>5. Naive&nbsp;Bayes</h3><p>Naive Bayes is a supervised<strong> </strong>learning algorithm that uses conditional probability to predict a class.</p><p>The Naive Bayes algorithm is based on the Bayes theorem:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VyM9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VyM9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 424w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 848w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 1272w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VyM9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png" width="640" height="206" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:206,&quot;width&quot;:640,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VyM9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 424w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 848w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 1272w, https://substackcdn.com/image/fetch/$s_!VyM9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cc3bb44-1bd2-4fe6-800b-7b8a545710ba_640x206.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><pre><code>p(A|B): Probability of event A given event B has already occurred
p(B|A): Probability of event B given event A has already occurred
p(A): Probability of event A
p(B): Probability of event B</code></pre><p>Naive Bayes assumes that every feature is independent of each other, which isn&#8217;t always the case, so we should examine our data before choosing this algorithm.</p><p>The assumption that features are independent of each other makes Naive Bayes fast<strong> </strong>compared to more complex algorithms; however, it also makes this algorithm less accurate.</p><p>We can use Naive Bayes to predict weather forecasting, fraud detection, and more.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>6. Logistic Regression</h3><p>Logistic regression is a supervised<strong> </strong>learning algorithm that is commonly used for binary classification<strong> </strong>problems. This means we can use logistic regression to predict whether a customer will churn or not, and to find whether a mail is spam or not.</p><p>The logistic regression is based on the logistic function (aka the sigmoid function), which takes in a value and assigns a probability between 0 and 1.</p><p>Here&#8217;s the graph of the logistic regression:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MY_6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MY_6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MY_6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MY_6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 424w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 848w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 1272w, https://substackcdn.com/image/fetch/$s_!MY_6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe85e4f3a-3c6a-441f-917d-724aa8468aba_800x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To understand much better how Logistic Regression works, consider a scenario where we need to classify whether an email is spam or not.</p><p>In the graph, if Z goes to infinity, Y (our target value) will become 1, which means the email is spam. However, if Z goes to negative infinity, Y will become 0, which means the email is not spam.</p><p>The output value is a probability, so if we obtain a value of 0.64, this means that there&#8217;s a 64% chance that an email will be spam.</p><div><hr></div><p>That&#8217;s it for now! Let me know in the comments if you want a 2nd part of this.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/p/algorithms-1?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/p/algorithms-1?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Data: An important resource in the AI revolution]]></title><description><![CDATA[Data might have become the new oil of the 21st century.]]></description><link>https://artificialcorner.com/p/data</link><guid isPermaLink="false">https://artificialcorner.com/p/data</guid><dc:creator><![CDATA[Frank Andrade]]></dc:creator><pubDate>Tue, 06 Feb 2024 17:03:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!xF-U!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xF-U!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xF-U!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 424w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 848w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xF-U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg" width="800" height="1035" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1035,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xF-U!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 424w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 848w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!xF-U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83141fe2-318d-4881-b4ee-72db50c10e3f_800x1035.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image via Shutterstock</figcaption></figure></div><blockquote><p><em>Hi!</em></p><p><em>The other day I was thinking that many people still don&#8217;t know the value of data, which is surprising given that data is what makes AI possible. Companies like OpenAI have been collecting data for many years to train their models, creating the tools we all know today.</em></p><p><em>In the coming articles, I&#8217;ll show you the techniques these companies use to collect data and what you can do with this data but, first, let&#8217;s see why data is so important nowadays.</em></p></blockquote><p>The concept of data as a strategic asset has been gaining momentum in the past years, however, regular people aren&#8217;t able to see the real value in data.</p><p>We know big tech companies have been collecting data for a long time. We know that year after year new regulations about the use of data are created. That said, most of us still don&#8217;t understand the impact data has on our society.</p><p>A few years ago, The Economist published an article called &#8220;The world&#8217;s most valuable resource is no longer oil, but data.&#8221; However, for regular folks, it&#8217;s still hard to understand how data can be the new oil.</p><p>Data and oil have some similarities, but also some differences. Here are some of them.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p><h3>1. Data and oil need to be&nbsp;refined</h3><p>Data and oil are rarely used in their raw state.</p><p>If oil is unrefined, it cannot be used. For oil to be useful, it has to be extracted, refined, and distributed. The same happens with data. We don&#8217;t use the data as soon as it&#8217;s extracted, but we have to process it first before it&#8217;s ready for analysis.</p><p>Here&#8217;s how Clive Humby, the data science entrepreneur who coined the phrase &#8220;data is the new oil,&#8221; compares oil and data.</p><blockquote><p><em>&#8220;Data is the new oil. Like oil, data is valuable, but if unrefined, it cannot really be used. It has to be changed into gas, plastic, chemicals, etc. to create a valuable entity that drives profitable activity. So, must data be broken down, analysed for it to have value.&#8221;</em></p></blockquote><p>This is true. Once data is collected, it needs to be cleaned and transformed to get it in the desired format. Why? Well, real-world data is messy, so there might be inaccurate or missing data that we need to deal with.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EabN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EabN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EabN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EabN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EabN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EabN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg" width="592" height="591" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:591,&quot;width&quot;:592,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EabN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EabN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EabN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EabN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cebe7c9-0a70-4acd-8e14-5265ee16ff22_592x591.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image via iStockphoto</figcaption></figure></div><p>To put it simply, imagine you have collected data from a survey. You can be confident that the results obtained from the multiple-choice questions don&#8217;t need much preprocessing, but things change with the open-ended questions because people can answer whatever they want (sometimes without following a common pattern) and even leave an answer blank.</p><p>Real-world data is sometimes as messy as those open-ended questions.</p><p>This is why raw data isn&#8217;t enough. Only after the data is &#8220;refined&#8221; we can make the most of it by making reports, doing analysis, and creating something valuable.</p><h3>2. Oil is a finite resource, while more and more data is created every&nbsp;day</h3><p>One of the things that makes oil so valuable is the concept of scarcity. There might be undiscovered oil reserves out there, but, the thing is, oil is a finite resource. One day there won&#8217;t be any oil on this planet and we have to find some other forms of energy.</p><p>That doesn&#8217;t happen with data.</p><p>There isn&#8217;t only plenty of data possessed by companies and even publicly available on the Internet, but more and more data is being created by people every day. How? Every time you watch a movie on Netflix, buy a product on Amazon or listen to a song on Spotify, a new data point is created.</p><p>These data points are created every second around the world!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yIIA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yIIA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yIIA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg" width="800" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yIIA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yIIA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa813d4c8-0f05-4ae0-9a08-39986ba54e9f_800x500.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Image via iStockphoto</figcaption></figure></div><p>Thanks to millions of data points, big tech companies can develop a good recommender system that can predict what movie or song you might like or suggest products to buy based on purchase history.</p><p>In addition to that, unlike oil, data can be reused without losing its quality. One engineer can use a dataset for one purpose, while another can use the same dataset for a completely different purpose.</p><p>But if data is infinite, how can it be so valuable? The value depends on the eye of the beholder. A dataset about sports statistics can be utterly useless for an e-commerce company but can be extremely valuable for a football club.</p><h3>3. Data and oil are not always available to&nbsp;everyone</h3><p>Yes, data is infinite, but it&#8217;s not available to everyone.</p><p>There isn&#8217;t a company that would share data that probably took them years to collect (at least not for free). Something similar happens with data available on websites. The data is there and you could somehow extract it, but it&#8217;s protected by privacy guidelines and terms and conditions. This means that, although you can extract the data, you should think twice about how you use this data.</p><p>Let&#8217;s consider the HiQ and LinkedIn case as an example.</p><p>HiQ extracted publicly-available data from LinkedIn. LinkedIn invoked the CFAA in a cease-and-desist letter to HiQ. Although the US Court of Appeals denied LinkedIn&#8217;s request, this didn&#8217;t grant HiQ the freedom to use the data extracted for commercial purposes.</p><p>As you can see, there are ethical issues around data collection and they&#8217;re quite different from oil extraction.</p><p>Even companies that collect data from their customers can&#8217;t use it as they want. As an example, there&#8217;s the <a href="https://gdpr.eu/what-is-gdpr/#:~:text=The%20General%20Data%20Protection%20Regulation,to%20people%20in%20the%20EU.">General Data Protection Regulation </a>(GDPR) that imposes obligations on organizations that collect data related to people in the European Union. Those who violate its privacy and security standards could pay fines that reach tens of millions of euros.</p><p>Let&#8217;s sum up this oil and data comparison in a few sentences.</p><ul><li><p>Like oil, data needs to be refined. Otherwise, it can&#8217;t be used as it&#8217;s not so valuable.</p></li><li><p>Unlike oil, data is an infinite resource that is created every day by people. It can even be reused and it rarely loses its quality.</p></li><li><p>Data is everywhere, but it isn&#8217;t always available to everyone. You could extract data, but then you should think twice about how you use it.</p></li></ul><h3>How companies get all this data</h3><p>Data serves as the foundation upon which AI systems are built and operate. Recommendation systems in products like YouTube, Amazon, and Netflix are great examples of apps that use large amounts of data. These companies have generated data from users&#8217; interactions with their products. Every time we rate a product on Amazon, like a YouTube video, or dislike a Netflix movie, we&#8217;re giving the system information about our likes and dislikes. These are data points that we, the users, have created. Big datasets are created thanks to the millions of users these companies have.</p><p>But that&#8217;s only one of the ways companies get data. After all, not every company has millions of customers.</p><p>The other way is through web scraping or web crawling. OpenAI has been doing this for some time to collect public data all over the internet. Although OpenAI <a href="https://www.theverge.com/2023/3/15/23640180/openai-gpt-4-launch-closed-research-ilya-sutskever-interview">won&#8217;t confirm if it got its data</a> through social media posts, copyrighted works, or anywhere else, it&#8217;s clear that the internet provided much of the training data for OpenAI&#8217;s GPT models.</p><div><hr></div><p>Public data is all over the internet and it seems only big companies are making the most of them. That said, in this AI revolution, you don&#8217;t need to have a big company to benefit from public data. In the coming articles, we&#8217;ll see the techniques these companies use to collect data and the things you can do with data scraped from the internet.</p><p>If you&#8217;d like to learn how to scrape data from the internet, you can take my <a href="https://www.udemy.com/course/web-scraping-course-in-python-bs4-selenium-and-scrapy/?referralCode=291C4D7FF6F683531933">Web Scraping Course in Python</a> (or redeem it for free if you&#8217;re a paid annual subscriber). To take the course you only need to know the basic concepts of Python, which you can learn on this <a href="https://artificialcorner.com/p/behind-ai-1-how-to-learn-python-with">1-hour crash course</a> (video at the end of the article).</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://artificialcorner.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://artificialcorner.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item></channel></rss>