<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1277160046114827306</id><updated>2026-06-03T19:15:13.807+05:30</updated><category term="DataScience"/><category term="MachineLearning"/><category term="python"/><category term="ArtificialIntelligence"/><category term="DeepLearning"/><category term="image manipulation"/><category term="MySQL"/><category term="NLP"/><category term="math"/><category term="opencv"/><category term="statistics"/><title type='text'>InfinityCodeX</title><subtitle type='html'>Learn Python, Data Science, Data Analytics, Machine Learning, Deep Learning...etc &amp;amp; start your career in any of these fields such as Artificial Intelligence, Data Scientist, Data Analytics, Data Engineer, Machine Learning Scientist / Engineer etc with practical knowledge &amp;amp; real life projects.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default?max-results=15&amp;redirect=false'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default?start-index=16&amp;max-results=15&amp;redirect=false'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>53</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>15</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-8508479297925308575</id><published>2024-12-14T22:25:00.004+05:30</published><updated>2024-12-15T10:24:47.357+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="math"/><category scheme="http://www.blogger.com/atom/ns#" term="statistics"/><title type='text'>From Complexity to Clarity: Simplifying Principal Component Analysis (PCA) </title><content type='html'>&lt;h1 style=&quot;font-size: 36px; line-height: 1.2; text-align: center;&quot;&gt;
    &lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;u&gt;From Complexity to Clarity: Simplifying Principal Component Analysis (PCA)&lt;/u&gt;&lt;/span&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi0SzIKKCyoZJHcmseaX8pZPz1JjoF4mNarty9rzIRg5S9tlSy0mJIl21wWo9R_JWAl8y3zZP_4ikKjoXqw95sz1hqBXNECitoTWWAu7bqfmKnDMGcA-e3lyfjlzeI_UhUtPSDXNgxulLHi3NkA4r7l3A8OCxirvD5SqLEA9wFjZHn1_ax3G354EiqjI2k&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;https://github.com/EtzionR/create-3d-graph-gif&quot; data-original-height=&quot;356&quot; data-original-width=&quot;547&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi0SzIKKCyoZJHcmseaX8pZPz1JjoF4mNarty9rzIRg5S9tlSy0mJIl21wWo9R_JWAl8y3zZP_4ikKjoXqw95sz1hqBXNECitoTWWAu7bqfmKnDMGcA-e3lyfjlzeI_UhUtPSDXNgxulLHi3NkA4r7l3A8OCxirvD5SqLEA9wFjZHn1_ax3G354EiqjI2k=s16000&quot; title=&quot;Source&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;p style=&quot;background-color: #f0f0f0; border-radius: 5px; display: inline-block; font-family: &amp;quot;Times New Roman&amp;quot;, Times, serif; font-style: italic; padding: 15px;&quot;&gt;&quot;Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm. It is a statistical procedure which is also used for finding patterns in high dimension data. It uses an orthogonal transformation to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables called as principal components.&quot;
    &lt;/p&gt;
  
  &lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;I know after reading the above paragraph you are like...&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjioLvwMAeKm_wskJaR6y0t3_UE5tVuntLtJh5fAXlUnfmTOjv1GLHVWwoN_LDl1F1eUWiEGqTVkEpcmFYjXztrwR1sP16mhRw5sVrUWxMjOoH-NzgpPevEOc4QnulDEEQs3Hf91yfIr_39ldgUueoMdT1JAPxGf1FW95Zd0kMuqS2II2z7bYtQk7_D4nY&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;176&quot; data-original-width=&quot;220&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjioLvwMAeKm_wskJaR6y0t3_UE5tVuntLtJh5fAXlUnfmTOjv1GLHVWwoN_LDl1F1eUWiEGqTVkEpcmFYjXztrwR1sP16mhRw5sVrUWxMjOoH-NzgpPevEOc4QnulDEEQs3Hf91yfIr_39ldgUueoMdT1JAPxGf1FW95Zd0kMuqS2II2z7bYtQk7_D4nY&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;Oh, really? Why it couldn’t possibly be any easier?&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;Then answer is... well, of course, it is&amp;nbsp;simple! and, don’t stress—&lt;em&gt;I’m here to save the day,&lt;/em&gt; because clearly, that’s what was missing all along&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjma6xtcnvjC_M93tZBAeMTwK1W-jBiN1RMQ38rLe7cMrflOw5JMfCWOcX_VXBDR9TjIVj9NY4vPGzac9yWw7Zz2I6VVQwhiqa2RYhEr_eCM5XBzhZgMZTV-eRs5Tcrujp0AIVkAzMd365gPYZ4XR3m1JJIVlb4hkJeNY7hkruP--j-gd0hQtfCxnCFSZk&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;290&quot; data-original-width=&quot;540&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjma6xtcnvjC_M93tZBAeMTwK1W-jBiN1RMQ38rLe7cMrflOw5JMfCWOcX_VXBDR9TjIVj9NY4vPGzac9yWw7Zz2I6VVQwhiqa2RYhEr_eCM5XBzhZgMZTV-eRs5Tcrujp0AIVkAzMd365gPYZ4XR3m1JJIVlb4hkJeNY7hkruP--j-gd0hQtfCxnCFSZk=w441-h237&quot; width=&quot;441&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;Principal Component Analysis: Because Your Data Has Too Many Opinions, Just Like Your Ex Used To 🤭&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;Lets forget you ex and discuss the agenda, what all things we are going to cover in this article?
&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;1.) What even is PCA?&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;2.) Why PCA? or, &quot;Why Shrink Your Data?&quot;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;3.) How does PCA actually works?&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;4.) Application of PCA (Yes people actually use it)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;5.)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Math Stuff&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;6.) &lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Python Coding Example&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;7.)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Arial;&quot;&gt;Conclusion: Do you really need it?&lt;/b&gt;&lt;/h3&gt;&lt;div&gt;&lt;b style=&quot;font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;1. What Even Is PCA?&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;
* Definition:&lt;/b&gt; Principal Component Analysis — or, as we like to call it, &quot;Magic Math that Makes Your Data Less Annoying.&quot;&lt;br /&gt;&lt;b&gt;
* Simple Explanation:&lt;/b&gt; It’s where we take a perfectly fine dataset, perform a mathy shuffle dance, and end up with fewer columns that apparently contain the same enough information. Simple, right?&lt;br /&gt;&lt;b&gt;
* Behind the Scenes:&lt;/b&gt; Eigenvalues, eigenvectors, matrices… you know, all the good stuff you happily forgot after that one linear algebra class.&lt;br /&gt;&lt;/span&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;2. Why PCA? Or, &quot;Why Shrink Your Data?&quot;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;
* To Stop Crashing Your Laptop:&lt;/b&gt; Imagine actually trying to work with a 100-dimensional dataset. PCA helps avoid the horror of infinite loading circles.&lt;br /&gt;&lt;b&gt;
* Because Interpretability Is for Amateurs:&lt;/b&gt; With PCA, you can have the thrill of knowing your data just got simpler without needing to explain why.&lt;br /&gt;&lt;b&gt;
* Optimal Confusion Guarantee:&lt;/b&gt; Impress your friends and baffle your audience with reduced dimensions that convey almost the same story. Who doesn’t love a good riddle in data form?&lt;br /&gt;&lt;/span&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;3. How Does PCA Actually Work?&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;
* Step-by-Step Guide:&lt;/b&gt; A 15-step process of complex calculations, conveniently glossed over in most blog posts. But don’t worry — you can just use a library function! I have covered that in 6 steps.&lt;br /&gt;&lt;b&gt;
* Scaling Your Data Like a Pro:&lt;/b&gt; Normalize first, or you’ll end up with results that don’t make sense (not that they ever really do).&lt;br /&gt;&lt;b&gt;
* Covariance and Variance Fun:&lt;/b&gt; Rejoice in knowing how much variation you can squeeze out of your data without it screaming back in protest.&lt;br /&gt;&lt;/span&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;4. Applications of PCA (Yes, People Actually Use It)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;
* Dimensionality Reduction (Obviously):&lt;/b&gt; Because who needs all those columns when you can turn them into just a few &quot;principal components&quot;? Image Compression, a.k.a. “Why’s My Picture Blurry Now?” Ever wonder how to shrink images into an indecipherable mosaic? PCA’s got you covered.&lt;br /&gt;&lt;b&gt;
* Pattern Recognition and ML Models:&lt;/b&gt; You’ll get to say you improved your model’s performance by 0.02% and act like it’s groundbreaking.&lt;br /&gt;&lt;b&gt;
* Noise Reduction (Or Data Disguising):&lt;/b&gt; PCA will kindly help you ignore all the pesky little outliers you didn&#39;t want to deal with.&lt;br /&gt;&lt;/span&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;5. Math Stuff&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;This section is for nerds, who are interested in the math behind this algorithm.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;Steps to perform PCA:&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h4 style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;(i) Standardize the dataset.&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;(ii) Calculate the covariance matrix for the feature in data.&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;(iii) Calculate the eigen values and eigen vectors for covariance matrix.&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;b&gt;(iv) Sort&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Arial;&quot;&gt;eigen values and their corresponding eigen vectors.&lt;br /&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;(v) Pick &lt;i&gt;k&lt;/i&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Arial;&quot;&gt;eigen values and form a matrix of eigen vector.&lt;br /&gt;&lt;/b&gt;&lt;b style=&quot;font-family: Arial;&quot;&gt;(vi) Transform original matrix.&lt;/b&gt;&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;h4&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(i) Standardize the dataset.&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Let&#39;s assume we have data with 4 features &amp;amp; 5 rows of training data&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;Training Data Table&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;4&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;6&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;8&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;


&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Standardize the data :&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj4Gj7mvnywQNaa6U2ASIzXxTpdHYzhGy5Kcf5rMV-YUpJQVIehRx-kcdgCGejaj20RNfKxfZGnAdftohOP0H1pkwPbCVwWYiKBgNxihnxEqwuaM26PJ5wuT9o1NumyXi4_YWE51Fah5ZL84LSaMmRh78W-gPZL7iMdnlKeM4kOtCqYNSRmA5rfVjaO3Tw&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;232&quot; data-original-width=&quot;553&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj4Gj7mvnywQNaa6U2ASIzXxTpdHYzhGy5Kcf5rMV-YUpJQVIehRx-kcdgCGejaj20RNfKxfZGnAdftohOP0H1pkwPbCVwWYiKBgNxihnxEqwuaM26PJ5wuT9o1NumyXi4_YWE51Fah5ZL84LSaMmRh78W-gPZL7iMdnlKeM4kOtCqYNSRmA5rfVjaO3Tw&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Where:&lt;/b&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;&lt;br /&gt;&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;z&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: math; font-size: 16px; text-transform: math-auto;&quot;&gt;z&lt;/span&gt;: The standardized value (z-score).&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;&lt;br /&gt;&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;x&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: math; font-size: 16px; text-transform: math-auto;&quot;&gt;x&lt;/span&gt;: The original data point.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;&lt;br /&gt;&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\mu&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: math; font-size: 16px; text-transform: math-auto;&quot;&gt;μ&lt;/span&gt;: The mean of the dataset.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;&lt;br /&gt;&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\sigma&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: math; font-size: 16px; text-transform: math-auto;&quot;&gt;σ&lt;/span&gt;: The standard deviation of the dataset.&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;
  
  &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;μ = &lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;4&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3.4&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;σ = &lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.58&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.73&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2.30&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;(Standardize Data) Apply formula in each feature:&lt;br /&gt;&lt;br /&gt;
  
    &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.63&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.26&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.33&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.26&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.73&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.56&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.63&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.17&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.33&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.06&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.33&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.26&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.60&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

  
  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;h4 style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(ii) Calculate the covariance matrix for the feature in data.&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;For Population:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh7MSX26purNUpGbxN1Xe7VyCnw91Cp-jKxxMIhxNObdGlsmizmeCbtBqxtpVRiaJBoiwbLpDu15gC3aLziLl4UaCgDV_FE_lJXUKPSfTH8lbLBz3OUvFo7fmrdwSybzIweIuoBS6msXZdgyXZaCSZ4dJThO786WoBvQcg7O_t-oOU_pRMEYsd2PSpO1Z0&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;216&quot; data-original-width=&quot;1154&quot; height=&quot;98&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh7MSX26purNUpGbxN1Xe7VyCnw91Cp-jKxxMIhxNObdGlsmizmeCbtBqxtpVRiaJBoiwbLpDu15gC3aLziLl4UaCgDV_FE_lJXUKPSfTH8lbLBz3OUvFo7fmrdwSybzIweIuoBS6msXZdgyXZaCSZ4dJThO786WoBvQcg7O_t-oOU_pRMEYsd2PSpO1Z0=w523-h98&quot; width=&quot;523&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;For Sample:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgIFOCHZGYdld--n69J_iJ9fhi1zzgAXWQSC1Hzrn5O2LWvGe_tZC3s1YbtSdnc0kpwFdJHc4lQPDKF1_q-xtbCqb6nyuIrmInrJH_jpp0VO7Nmj2rAzA66Jw4r9Dyr_WMdaWLPrXrNm0FQFzFnEsRuNI-8CRAZA64gTjWOH6h-UAgL_-lDRvkzjPoMx5s&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;184&quot; data-original-width=&quot;975&quot; height=&quot;99&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgIFOCHZGYdld--n69J_iJ9fhi1zzgAXWQSC1Hzrn5O2LWvGe_tZC3s1YbtSdnc0kpwFdJHc4lQPDKF1_q-xtbCqb6nyuIrmInrJH_jpp0VO7Nmj2rAzA66Jw4r9Dyr_WMdaWLPrXrNm0FQFzFnEsRuNI-8CRAZA64gTjWOH6h-UAgL_-lDRvkzjPoMx5s=w528-h99&quot; width=&quot;528&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Calculate covariance matrix of given data.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;
  
    &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 1&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;var(f1)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f1,f2)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f1,f3)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f1,f4)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 2&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f2,f1)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;var(f2)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f2,f3)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f2,f4)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 3&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f3,f1)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f3,f2)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;var(f2)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f3,f4)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 4&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f4,f1)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f4,f2)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;cov(f4,f3)&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;var(f4)&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;μ of each feature is 1 &amp;amp; σ is 0. Since we are standardizing.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUvTZ3kly8s01Fz12LBejzOxI1U_fj4Yia_D5hROguILuVBwbEr60ruXY2BSrEiWN1YSq7HJnHAY3cpJ5XHiMMcFdhSkq5Cs0GPm6-METlaKo4MHx6OAY7iC88FmNuPv568GZWZYn_BnHkNP12XY4w6TraJ1J8UjIKst2RaFA2xtW12OQoZ25BEibl0WI&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;172&quot; data-original-width=&quot;1193&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUvTZ3kly8s01Fz12LBejzOxI1U_fj4Yia_D5hROguILuVBwbEr60ruXY2BSrEiWN1YSq7HJnHAY3cpJ5XHiMMcFdhSkq5Cs0GPm6-METlaKo4MHx6OAY7iC88FmNuPv568GZWZYn_BnHkNP12XY4w6TraJ1J8UjIKst2RaFA2xtW12OQoZ25BEibl0WI=w524-h75&quot; width=&quot;524&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Var(f1) =&lt;/b&gt; 0.8&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhdmIvzXgXt50YgIqoMdWMc9DhI-GxUKRE78yBQ8SgAAFJ-xaVqsMfXzLADhJbh5DAUhswLkSAJlVHQZbMjOhsZpdFdRZ1axlE3Kql2pFyAjPEmiSB-dNrGONNdpDBx4gFvBrv53AVR4ByUiZzRqz9mw4o0s3Q0bqoFrveTDIA9G66y-kN79Lg-hHe3zsU&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;148&quot; data-original-width=&quot;1014&quot; height=&quot;86&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhdmIvzXgXt50YgIqoMdWMc9DhI-GxUKRE78yBQ8SgAAFJ-xaVqsMfXzLADhJbh5DAUhswLkSAJlVHQZbMjOhsZpdFdRZ1axlE3Kql2pFyAjPEmiSB-dNrGONNdpDBx4gFvBrv53AVR4ByUiZzRqz9mw4o0s3Q0bqoFrveTDIA9G66y-kN79Lg-hHe3zsU=w586-h86&quot; width=&quot;586&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;b&gt;Cov(f1,f2) =&lt;/b&gt; -0.2529&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;- Like this calculation the other covariance is:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;
  
&lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 1&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 2&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 3&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 4&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;h4 style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(iii) Calculate the eigen values and eigen vectors for covariance matrix.&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;- A eigen vector is an non-zero vector that changes at most by a scalar factor when that linear transformation is applied to it.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;- The corresponding eigen value is the factor by which the eigen vector is scaled.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;- Let &#39;A&#39; be a square matrix (in our case the covariance matrix), &#39;v&#39; a vector &amp;amp; &#39;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;λ&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&#39; a scalar that satisfies &lt;span style=&quot;background-color: #cccccc;&quot;&gt;Av =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;background-color: #cccccc; color: black;&quot;&gt;λv&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;, then λ is called eigen value associated with eigen vector v of A.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;Rearranging the above equation:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;span style=&quot;background-color: #cccccc;&quot;&gt;Av -&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;background-color: #cccccc; color: black;&quot;&gt;λv = 0; (A-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #cccccc; font-family: Arial; text-align: left;&quot;&gt;λ1&lt;/span&gt;&lt;span style=&quot;background-color: #cccccc; font-family: Arial; text-align: left;&quot;&gt;)v = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Since we know v is non-zero, only way this equation can be equal to 0, if&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: #cccccc; color: black; font-family: Arial; text-align: left;&quot;&gt;det(A-λ1)=0&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;
  
  &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 100%;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 1&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 2&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 3&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;background-color: #f2f2f2; border: 1px solid black; padding: 8px;&quot;&gt;&lt;b&gt;Feature 4&lt;/b&gt;&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Solving the above equation = 0&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Eigen Vectors:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: color: Black;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;solving the (A-&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;λI&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;)v = 0 equation for vector with the different&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;λ values:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: center;&quot;&gt;
  
  &lt;div style=&quot;align-items: center; display: flex; gap: 20px;&quot;&gt;
  &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 50%;&quot;&gt;
  &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.25&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.03&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.51&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.14&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.49&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.8-λ&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;div style=&quot;align-items: center; display: flex; gap: 10px;&quot;&gt;
  &lt;div style=&quot;color: black; font-family: Arial; font-size: 16px;&quot;&gt;
    x
  &lt;/div&gt;
  &lt;table style=&quot;border-collapse: collapse; border: 1px solid black; color: black; font-family: Arial; font-size: 16px;&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;v&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;v&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;v&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;v&lt;sub&gt;4&lt;/sub&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Arial; font-size: 16px;&quot;&gt;
    = 0
  &lt;/div&gt;
&lt;/div&gt;
  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;for λ = 2.51, solving the above equation using Cramer&#39;s rule, the values for vectors &quot;v&quot; are&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; font-size: 16px; text-align: left;&quot;&gt;v&lt;/span&gt;&lt;sub style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;1&lt;/sub&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;&amp;nbsp;= 0.16&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; font-size: 16px; text-align: left;&quot;&gt;v&lt;/span&gt;&lt;sub style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;2&lt;/sub&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;&amp;nbsp;= -0.52&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; font-size: 16px; text-align: left;&quot;&gt;v&lt;/span&gt;&lt;sub style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;3&lt;/sub&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;&amp;nbsp;= -0.58&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; font-size: 16px; text-align: left;&quot;&gt;v&lt;/span&gt;&lt;sub style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;4&lt;/sub&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: center;&quot;&gt;&amp;nbsp;= -0.59&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;span style=&quot;color: black; text-align: center;&quot;&gt;Going by the same approach we can calculate the eigen vectors for the other eigen values.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;span style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;span style=&quot;color: black; text-align: center;&quot;&gt;We can form matrix using eigen vectors.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;span style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;span style=&quot;text-align: center;&quot;&gt;
  
  &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 50%;&quot;&gt;
  &lt;tbody&gt;
    &lt;/tbody&gt;&lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e2&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e3&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e4&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
        &lt;tbody&gt;&lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.16&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.91&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.30&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.19&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.52&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.20&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.81&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.12&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.58&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.32&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.18&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.72&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.59&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.11&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.44&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.65&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;

  



  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;b&gt;(iv) Sort eigen values &amp;amp; their corresponding eigen vectors&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Since eigen values are already sorted so no need to sort them again.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;b&gt;(v) Pick eigen values and from matrix of eigen vectors&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;If we choose the top 2 eigen vectors, the matrix will look like this&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;(Top 2 eigen vectors 4 * 2 matrix&lt;/span&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;
  
    &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 50%;&quot;&gt;
  &lt;tbody&gt;
    &lt;/tbody&gt;&lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e1&lt;/th&gt;
            &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e2&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
        &lt;tbody&gt;&lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.16&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.91&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.52&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.20&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.58&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.32&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.59&lt;/td&gt;
            &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.11&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;b&gt;(vi) Transform the original matrix&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;Feature_matrix * Top_k_eigen_vectors = Transformed_data&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; text-align: justify;&quot;&gt;

 &lt;div style=&quot;align-items: center; display: flex; gap: 20px;&quot;&gt;
  &lt;!--First Table--&gt;
  &lt;table style=&quot;border-collapse: collapse; color: black; font-family: Arial; text-align: center; width: 50%;&quot;&gt;
    &lt;thead&gt;
      &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
        &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 1&lt;/th&gt;
        &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 2&lt;/th&gt;
        &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 3&lt;/th&gt;
        &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;Feature 4&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.00&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.63&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.00&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.26&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.33&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.26&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.73&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.56&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.00&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.63&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.17&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.33&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.00&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.04&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.33&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.26&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.57&lt;/td&gt;
        &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.60&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;

   &lt;div style=&quot;color: black; font-family: Arial; font-size: 16px; padding: 8px;&quot;&gt;
      x
    &lt;/div&gt;
   
  &lt;!--Middle Section--&gt;
  &lt;div style=&quot;align-items: center; display: flex; gap: 10px;&quot;&gt;
    &lt;!--e1 and e2 Table--&gt;
    &lt;table style=&quot;border-collapse: collapse; border: 1px solid black; color: black; font-family: Arial; font-size: 16px;&quot;&gt;
      &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
          &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e1&lt;/th&gt;
          &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;e2&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.16&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.91&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.52&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.20&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.58&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.32&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.59&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.11&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;

    &lt;!--&quot;=&quot; Symbol--&gt;
    &lt;div style=&quot;color: black; font-family: Arial; font-size: 16px; padding: 8px;&quot;&gt;
      =
    &lt;/div&gt;

    &lt;!--nf1 and nf2 Table--&gt;
    &lt;table style=&quot;border-collapse: collapse; border: 1px solid black; color: black; font-family: Arial; font-size: 16px;&quot;&gt;
      &lt;thead&gt;
        &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
          &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;nf1&lt;/th&gt;
          &lt;th style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;nf2&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.01&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.75&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-2.55&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.78&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.05&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.25&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.01&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.00&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.57&lt;/td&gt;
          &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.22&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/div&gt;


  &lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;h3 style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;6. Python Coding Example&lt;/span&gt;&lt;/h3&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;
  
  &lt;pre style=&quot;background-color: #f4f4f4; border-radius: 5px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; overflow-x: auto; padding: 15px;&quot;&gt;# Code Example:

import pandas as pd
import numpy as np

# Input data
A = np.matrix([[1, 2, 3, 4], [5, 5, 6, 7], [1, 4, 2, 3], [5, 3, 2, 1], [8, 1, 2, 2]])

# Create DataFrame
df = pd.DataFrame(A, columns=[&quot;f1&quot;, &quot;f2&quot;, &quot;f3&quot;, &quot;f4&quot;])

# Standardize the data
df_std = (df - df.mean()) / df.std()

# Number of Principal Components
n_components = 2

# Apply PCA
from sklearn.decomposition import PCA
pca = PCA(n_components=n_components)
pc = pca.fit_transform(df_std)

# Convert PCA results to DataFrame
principalDf = pd.DataFrame(data=pc, columns=[&quot;nf&quot; + str(i + 1) for i in range(n_components)])

# Display output
print(principalDf)
&lt;/pre&gt;

&lt;h3&gt;Output&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; border: 1px solid black; font-family: Arial, sans-serif; font-size: 16px; margin: 20px auto; text-align: center; width: 60%;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 10px;&quot;&gt;Index&lt;/th&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 10px;&quot;&gt;nf1&lt;/th&gt;
      &lt;th style=&quot;border: 1px solid black; padding: 10px;&quot;&gt;nf2&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.014003&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.755975&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2.556534&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.780432&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;0.051480&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.253135&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.014150&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-0.000239&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;-1.579861&lt;/td&gt;
      &lt;td style=&quot;border: 1px solid black; padding: 8px;&quot;&gt;1.228917&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

  
  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;b&gt;7. Conclusion: Do You Really Need PCA?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;
Probably not, but it sure sounds fancy when you tell people at parties, right? If you love mysterious statistical transformations, you’re going to adore PCA!&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;I hope this helped you. If it did then please share it with your friends and spread this knowledge.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;https://www.instagram.com/infinitycode_x/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/8508479297925308575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2024/12/from-complexity-to-clarity-simplifying.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/8508479297925308575'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/8508479297925308575'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2024/12/from-complexity-to-clarity-simplifying.html' title='From Complexity to Clarity: Simplifying Principal Component Analysis (PCA) '/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEi0SzIKKCyoZJHcmseaX8pZPz1JjoF4mNarty9rzIRg5S9tlSy0mJIl21wWo9R_JWAl8y3zZP_4ikKjoXqw95sz1hqBXNECitoTWWAu7bqfmKnDMGcA-e3lyfjlzeI_UhUtPSDXNgxulLHi3NkA4r7l3A8OCxirvD5SqLEA9wFjZHn1_ax3G354EiqjI2k=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-244153616648805519</id><published>2023-02-08T22:32:00.006+05:30</published><updated>2023-02-19T13:13:54.821+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="image manipulation"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="NLP"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>The Rise of BERT AI: The Model Redefining Natural Language Processing</title><content type='html'>&lt;span style=&quot;font-family: times;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;BERT Model: Revolutionizing Natural Language Processing&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;/span&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuvC8CJLYghLK6I29YdkpHuvQ2Y3OQR-y3EJCmMWgHTPmpNdy6uldk9IarDn3gnhoFrBGTe1wSUCxND28SaZTj_H0zmTwacMGqZ-uOpBrnxi3TLV3VfNk-eXF3YK2u9D2W0mtR_6X3o-fiyoQ3NaIVNvE8EIng28V9ZMr4lArBXNQcrmn0yhMImvzr/s787/bert.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;BERT&quot; border=&quot;0&quot; data-original-height=&quot;330&quot; data-original-width=&quot;787&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuvC8CJLYghLK6I29YdkpHuvQ2Y3OQR-y3EJCmMWgHTPmpNdy6uldk9IarDn3gnhoFrBGTe1wSUCxND28SaZTj_H0zmTwacMGqZ-uOpBrnxi3TLV3VfNk-eXF3YK2u9D2W0mtR_6X3o-fiyoQ3NaIVNvE8EIng28V9ZMr4lArBXNQcrmn0yhMImvzr/s16000/bert.png&quot; title=&quot;BERT&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;BERT&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h1&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT, which stands for Bidirectional Encoder
Representations from Transformers, is a deep learning-based language model
developed by Google that has been making waves in the field of natural language
processing (NLP). BERT is unique in its ability to understand the context of
words in a sentence and make predictions about the likelihood of a word being
in a particular context. This has made BERT a highly versatile and powerful
tool for solving a wide range of NLP tasks, such as sentiment analysis, question
answering, and text classification.&lt;/span&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;u&gt;BERT&#39;s Architecture&lt;/u&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT&#39;s architecture is based on the transformer
network, which was introduced in 2017 by Vaswani et al. The transformer network
is a neural network architecture designed specifically for NLP tasks and has
since been used in many state-of-the-art NLP models.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT&#39;s architecture consists of two main components: an
encoder and a decoder. The encoder is responsible for encoding the input text
data into a hidden representation, while the decoder is responsible for
predicting the likelihood of a word being in a particular context based on the
encoded representation.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The input to BERT is a sequence of tokens, where each
token represents a word in the sentence. The tokens are fed into the encoder,
which is composed of multiple layers of attention mechanisms and feed-forward
networks. The attention mechanism allows the model to focus on specific parts
of the input sequence and weigh their importance in determining the encoded
representation.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The encoded representation is then fed into the
decoder, which is composed of a single feed-forward network. The decoder
outputs a probability distribution over the vocabulary for each token in the
input sequence. The decoder&#39;s predictions are then compared to the actual
labels (i.e., the words in the sentence) to calculate the loss, which is used
to update the model&#39;s parameters during training.&lt;/span&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;BERT&#39;s Unique Features&lt;/span&gt;&lt;/u&gt;&lt;/h2&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT is unique among NLP models in several ways. First,
BERT is bidirectional, meaning that it considers both the left and right
context of each word in the sentence. This allows BERT to capture the context
of words more accurately and outperforms unidirectional models.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Second, BERT is pre-trained on a massive amount of text
data, which allows it to perform well on a wide range of NLP tasks without the
need for task-specific training data. This makes BERT highly versatile and
cost-effective, as it can be fine-tuned for specific NLP tasks with relatively
small amounts of task-specific data.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Finally, BERT uses masked language modeling as its
pre-training task, where a percentage of the tokens in the input sequence is
masked and the model is trained to predict the masked tokens. This pre-training
task helps BERT capture the context of words in a sentence more effectively and
outperforms models trained with traditional pre-training tasks.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;u&gt;BERT in Action&lt;/u&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT has been applied to a wide range of NLP tasks and
has consistently outperformed previous state-of-the-art models. For example, in
the GLUE benchmark, which evaluates the performance of NLP models on a range of
benchmark datasets, BERT outperformed previous state-of-the-art models by a
substantial margin.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;BERT has also been used to solve more complex NLP
tasks, such as question answering and text summarization. For example, BERT has
been fine-tuned to answer questions based on a large corpus of text data, such
as the SQuAD dataset. BERT has also been used to generate summaries of long
pieces of text, such as news articles.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;



&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #0d0d0d; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #0D0D0D; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=95000 lumo=5000&amp;quot;; mso-style-textfill-fill-themecolor: text1; mso-themecolor: text1; mso-themetint: 242;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Transformers in BERT: Technical Math and Steps to Create the
Model&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxW2FqEbY7vg_k2Gag8ewWUwoW6j2FWPm-VRLZvcH5meeVtaamuoDv7QNuh8757IXpW-tRFSYTNB285fCK49O9XVuRH4Q1bSIzRy-UJ3hRMRIt6kc16LHg6FCnH-ZNSp-5EjRxedlBKS2BFodBrX-hLom5M3bXE4znEFczM-sj1pWBfhRfM47rVs3x/s800/Transformer.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;color: black; font-family: times;&quot;&gt;&lt;img alt=&quot;Transformer&quot; border=&quot;0&quot; data-original-height=&quot;425&quot; data-original-width=&quot;800&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxW2FqEbY7vg_k2Gag8ewWUwoW6j2FWPm-VRLZvcH5meeVtaamuoDv7QNuh8757IXpW-tRFSYTNB285fCK49O9XVuRH4Q1bSIzRy-UJ3hRMRIt6kc16LHg6FCnH-ZNSp-5EjRxedlBKS2BFodBrX-hLom5M3bXE4znEFczM-sj1pWBfhRfM47rVs3x/s16000/Transformer.png&quot; title=&quot;Transformer&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Transformer&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The transformer architecture is at the heart of the
BERT model and is responsible for its impressive performance in natural
language processing (NLP) tasks. In this section, we will provide a detailed
explanation of the math behind transformers and the steps involved in creating
a BERT model.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The Transformer architecture is a deep neural network
that is used for sequence processing tasks such as language translation and
text generation. The key idea behind the Transformer architecture is the use of
self-attention mechanisms to dynamically weight the importance of different
inputs in a sequence.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 4;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;A Transformer
consists of the following components:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;1.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;Multi-head
attention mechanism&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;2.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;Pointwise
feedforward network&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;3.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;Residual
connections and layer normalization&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 4;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;The following
equations explain each component in detail:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;1. Multi-head attention mechanism: The multi-head
attention mechanism calculates attention scores between a query matrix Q, a key
matrix K, and a value matrix V. The attention scores are calculated using the
following equation:&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Attention(Q,K,V) = softmax(QK&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Cambria Math&amp;quot;, serif;&quot;&gt;⊤&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;/√d_k)V&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Where d_k is the dimensionality of the key vectors and
softmax is applied row-wise to the scores. The attention scores are then
used to weigh the importance of the values.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;2. Pointwise feedforward network: The Pointwise
feedforward network is a simple two-layer feedforward neural network that is
applied to each position in the sequence independently. The following equation
represents the pointwise feedforward network:&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;FFN(x) = max(0,xW1 + b1)W2 + b2&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Where W1 and W2 are the weights of the two layers and
b1 and b2 are the biases. The activation function used is the ReLU activation.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;3. Residual connections and layer normalization:
Residual connections are used to add the input to the output of each layer to
improve the flow of information through the network. The following equation
represents the residual connection:&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Output = Layer_Output + Input&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Layer normalization is used to normalize the
activations of each layer, which helps to stabilize the training process and
improve the performance of the network. The following equation represents the
layer normalization:&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;LayerNorm(x) = (x - mean(x)) / variance(x)&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;These components of the Transformer architecture are
combined to form the final network, where the multi-head attention mechanism
and pointwise feedforward network are applied alternately, followed by residual
connections and layer normalization. The resulting network is capable of
processing sequences in parallel, which greatly reduces the training time
compared to traditional RNN-based models.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;









































&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Self-Attention Mechanisms&lt;/span&gt;&lt;/u&gt;&lt;/h2&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Self-attention mechanisms are the key component of
transformers and allow the model to weight the importance of different parts of
the input data. This is done by computing attention scores, which represent the
importance of each input element relative to all other elements.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The attention scores are computed using a set of
learnable parameters and are used to compute a weighted sum of the input
elements. This weighted sum is then passed through a feedforward neural network
to produce the final representation of the input data.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Mathematically, the attention mechanism can be
represented as follows:&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;$$Attention(Q,K,V) =
softmax(\frac{QK^T}{\sqrt{d_k}})V$$&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;Where Q, K and V are the query, key and value matrices,
respectively, and $d_k$ is the dimension of the keys.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Creating a BERT Model&lt;/span&gt;&lt;/u&gt;&lt;/h2&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;The steps involved in creating a BERT model are as
follows:&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;1.) Pre-processing:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;BERT
requires the input data to be pre-processed and tokenized into subwords. This
is done using a tokenizer that splits words into subwords and adds special
tokens to represent the start and end of sentences.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;2.) Encoding:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;The input
data is then passed through a series of transformer layers to produce an
encoded representation. Each transformer layer consists of a self-attention
mechanism and a feedforward neural network.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;3.) Fine-tuning:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;The
pre-trained BERT model can be fine-tuned on a specific NLP task, such as
sentiment analysis or question answering, by adding task-specific layers on top
of the encoded representation.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;4.) Training:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;The
fine-tuned model is then trained on a labeled dataset to adjust the parameters
of the self-attention mechanism and feedforward neural network.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;5.) Evaluation:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;&amp;nbsp;Finally,
the model is evaluated on a held-out dataset to measure its performance on the
task.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Times, serif;&quot;&gt;In conclusion, the use of transformers and
self-attention mechanisms in BERT has revolutionized NLP by allowing models to
understand the relationships between words and sentence structure in a way that
was not possible with traditional models. The combination of pre-training and
fine-tuning has made it possible to create models that achieve state-of-the-art
performance on a wide range of NLP tasks.&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 13.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #0D0D0D; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=95000 lumo=5000&amp;quot;; mso-style-textfill-fill-themecolor: text1; mso-themecolor: text1; mso-themetint: 242;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;&lt;span style=&quot;font-family: times;&quot;&gt;BERT Model Simple Sentiment Analysis Example&lt;/span&gt;&lt;/u&gt;&lt;/h2&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt; 

# pip install ktrain

# git clone https://github.com/laxmimerit/IMDB-Movie-Reviews-Large-Dataset-50k.git

import tensorflow as tf
import pandas as pd
import numpy as np
import ktrain
from ktrain import text
import tensorflow as tf
     

data_train = pd.read_excel(&#39;IMDB-Movie-Reviews-Large-Dataset-50k/train.xlsx&#39;, dtype = str)
data_test = pd.read_excel(&#39;IMDB-Movie-Reviews-Large-Dataset-50k/test.xlsx&#39;, dtype = str)
     
(x_train,y_train),(x_test,y_test),preprocess=text.texts_from_df(data_train,text_column=&#39;Reviews&#39;
                                             ,label_columns=&#39;Sentiment&#39;,val_df=data_test
                                            ,maxlen=400,preprocess_mode=&#39;bert&#39;)

model = text.text_classifier(name=&#39;bert&#39;,train_data=(x_train,y_train)
                             ,preproc=preprocess)

learner = ktrain.get_learner(model=model, train_data=(x_train, y_train),
                   val_data = (x_test, y_test),
                   batch_size = 6)

learner.fit_onecycle(lr = 2e-5, epochs = 1)

     

predictor = ktrain.get_predictor(learner.model, preprocess)
predictor.save(&#39;/content/drive/My Drive/bert&#39;)
     

data = [&#39;this movie was horrible, the plot was really boring. acting was okay&#39;,
        &#39;the fild is really sucked. there is not plot and acting was bad&#39;,
        &#39;what a beautiful movie. great plot. acting was good. will see it again&#39;]
     

predictor.predict(data)

&amp;gt;&amp;gt;&amp;gt; [&#39;neg&#39;, &#39;neg&#39;, &#39;pos&#39;]


&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background-color: #fcff01;&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;

So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;Follow us at :&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;
&lt;b&gt;Instagram:&lt;/b&gt; 

&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;

&lt;b&gt;Facebook:&lt;/b&gt;

&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp; &lt;b&gt;Pinterest:&lt;/b&gt;&amp;nbsp;&lt;a href=&quot;https://in.pinterest.com/vegadhardik/&quot;&gt;https://in.pinterest.com/vegadhardik/&lt;/a&gt; &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;
&lt;b&gt;Twitter:&lt;/b&gt;

&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot;&gt;https://twitter.com/InfinityCodeX1

&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/244153616648805519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2023/02/the-rise-of-bert-ai-model-redefining.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/244153616648805519'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/244153616648805519'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2023/02/the-rise-of-bert-ai-model-redefining.html' title='The Rise of BERT AI: The Model Redefining Natural Language Processing'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuvC8CJLYghLK6I29YdkpHuvQ2Y3OQR-y3EJCmMWgHTPmpNdy6uldk9IarDn3gnhoFrBGTe1wSUCxND28SaZTj_H0zmTwacMGqZ-uOpBrnxi3TLV3VfNk-eXF3YK2u9D2W0mtR_6X3o-fiyoQ3NaIVNvE8EIng28V9ZMr4lArBXNQcrmn0yhMImvzr/s72-c/bert.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-5051465468999136168</id><published>2022-08-14T18:22:00.006+05:30</published><updated>2023-02-19T14:39:40.861+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>EVERY POSSIBLE MYSQL INTERVIEW QUESTION FOR DATA SCIENCE, DATA ANALYST, DATA ENGINEER, AND DATABASE MANAGER.</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;u&gt;EVERY POSSIBLE MYSQL INTERVIEW QUESTION FOR DATA SCIENCE, DATA ANALYST, DATA ENGINEER, AND DATABASE MANAGER.&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h1&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA_LAGDSTIqIFqW1wjKYDZRl8GxZmr3P2iaxG4CDCTo6Ry_dXNAyylNiMiiBHJv1HsU55khpqf8g8g6f_SE9HYUNb335g7sf1dM7Rmgt9VWkEghXuz7mMfANx3XVfBvG4hHrr6g3QfhQZoiD0DxoLP4LZ0WBWrdLo9EEeRbMkmBfkbWVdtTE_5ftBW/s2000/Dark%20Blue%20&amp;amp;%20Grey%20Executive%20Infographic%20Lesson%20Design.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;MySQL&quot; border=&quot;0&quot; data-original-height=&quot;800&quot; data-original-width=&quot;2000&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA_LAGDSTIqIFqW1wjKYDZRl8GxZmr3P2iaxG4CDCTo6Ry_dXNAyylNiMiiBHJv1HsU55khpqf8g8g6f_SE9HYUNb335g7sf1dM7Rmgt9VWkEghXuz7mMfANx3XVfBvG4hHrr6g3QfhQZoiD0DxoLP4LZ0WBWrdLo9EEeRbMkmBfkbWVdtTE_5ftBW/s16000/Dark%20Blue%20&amp;amp;%20Grey%20Executive%20Infographic%20Lesson%20Design.jpg&quot; title=&quot;MySQL&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;MySQL&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;If you want to be a successful data scientist or data analyst or data engineer or database manager MySQL is must to know and most of the time we ignore it and fail to crack the interview due to lack of knowledge or we couldn&#39;t find a place where we can find solutions of almost all the MySQL questions. Here are some of the best MySQL / SSMS interview questions which are guaranteed to be asked in an interview.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;So without wasting any time let&#39;s get started.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;See All DataBases:&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;

  &lt;pre&gt;&lt;code&gt;show databases;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;See All Tables:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;show tables;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Use Database:&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;use company; /* company is database name */&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;See Table Content:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;select * from Employee; /* Employee table name */&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Create Table:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt; 
CREATE TABLE Employees(e_id int, 
                       e_name varchar(20), 
                       join_date date, 
                       e_gender varchar(5), 
                       e_age int(10),
                       e_dept varchar(20), 
                       e_sal int(20));


CREATE TABLE Departement(d_id int, 
                         d_name varchar(20), 
                         d_loc varchar(20)); 
                         &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Insert Into Table Values:&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt; 
INSERT INTO Employees VALUES
(101, &#39;Naruto&#39;, &#39;20-12-2020&#39;, &#39;M&#39;, 22, &#39;IT&#39;, 100000),
(102, &#39;Priya&#39;, &#39;22-02-2021&#39;, &#39;F&#39;, 23, &#39;MARKET&#39;, 50000),
(103, &#39;Jay&#39;, &#39;25-10-2021&#39;, &#39;M&#39;, 21, &#39;FINANCE&#39;, 30000);


INSERT INTO Departement VALUES
(1, &#39;IT&#39;, &#39;MUMBAI&#39;),
(2, &#39;ACCOUNTS&#39;, &#39;DELHI&#39;),
(3, &#39;MARKET&#39;, &#39;PUNE&#39;); 

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Create Copy Of Table:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT *
INTO Copy_Employees
FROM Employees;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Where Clause:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Search Record */

SELECT * FROM Employees
WHERE e_name = &#39;Priya&#39;;

/* ------------------------------ */

/* Delete Record */

DELETE FROM Employees
WHERE e_name = &#39;Priya&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;See-All-Tables:&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;AND | OR | NOT Operators:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* AND */

SELECT * FROM Employees
WHERE e_name = &#39;Priya&#39; AND e_age = 23;

/* --------------------------------------- */

/* OR */

SELECT * FROM Employees
WHERE e_age = 22 OR e_dept = &#39;SALES&#39;;

/* --------------------------------------- */

SELECT * FROM Employees
WHERE e_age = 22 OR e_age = 23;

/* --------------------------------------- */

/* NOT */

SELECT * FROM Employees
WHERE NOT e_dept = &#39;IT&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Distinct-Operator&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Distinct Operator:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* (GIVES UNIQUE VALUES) */

SELECT DISTINCT e_gender FROM Employees; 

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Between-Operator&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Between Operator:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT * FROM Employees
WHERE e_age
BETWEEN 20 AND 30;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Basic-Functions-For-Data-Interpretation&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Basic Functions For Data Interpretation:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;MIN()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;MAX()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;COUNT()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;SUM()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;AVG()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* MIN */

SELECT MIN(e_age) FROM Employees;

/* MAX */

SELECT MAX(e_age) FROM Employees;

/* COUNT */

SELECT COUNT(*) FROM Employees WHERE e_gender=&#39;M&#39;;

/* SUM */

SELECT SUM(e_sal) FROM Employees;

/* AVG */

SELECT AVG(e_sal) FROM Employees;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Like-Operator&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Like Operator:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Stats With } &#39;value%&#39; */

SELECT * FROM Employees WHERE e_name LIKE &#39;M%&#39;;     /* Name Starts With M */

/* Ends With } &#39;%value&#39; */

SELECT * FROM Employees WHERE e_name LIKE &#39;%m&#39;;     /* Name Ends With m */

/* In a specfic value rage } &#39;value_&#39; */

SELECT * FROM Employees WHERE e_age LIKE &#39;2_&#39;;      /* Age In 20&#39;s */

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;String-Functions&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;String Functions:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;LTRIM()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;UPPER()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;LOWER()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;REVERSE()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;SUBSTRING()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* LTRIM */

SELECT LTRIM(&#39;    Naruto&#39;);

/* LOWER */

SELECT LOWER(&#39;NARUTO&#39;);

/* UPPER */

SELECT UPPER(&#39;naruto&#39;);

/* REVERSE */

SELECT REVERSE(&#39;naruto&#39;);

/* SUBSTRING */

SELECT SUBSTRING(&#39;This is sparta&#39;,9,6);

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Group-By&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Group By:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Get AVG sal with respect to gender */

SELECT AVG(e_sal) FROM Employee
GROUP BY e_gender;

/* Get AVG age with respect to gender */

SELECT AVG(e_age) FROM Employee
GROUP BY e_gender;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Order-By-&amp;amp;-Top&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Order By &amp;amp; Top:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Order By } Sort The Data by ASC or DESC */

SELECT * FROM Employees ORDER BY e_age;

/* ---------------------------------------- */

SELECT * FROM Employees ORDER BY e_age DESC;

/* ---------------------------------------- */

/* Top x */

SELECT TOP 3 * FROM Employees ORDER BY e_age DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Having-Clause&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Having Clause:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Departement Name Whose AVG(e_sal) is Greater than 80000 */

SELECT e_dept, AVG(e_sal) AS dep_avg_sal
FROM Employees
GROUP BY e_dept
HAVING AVG(e_sal) &amp;gt; 80000
ORDER BY dep_avg_sal DESC;

/* ------------------------------------------------------------ */

/* The following SQL statement lists the number of Emp in each Departement. 
Only include Departement with more than 5 Emp: */

SELECT COUNT(e_id), e_dept
FROM Employees
GROUP BY e_dept
HAVING COUNT(e_id)&amp;gt;5;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Alter-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Alter Table:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Add Column To a Table */

ALTER TABLE Employees
ADD e_height int;

/* ---------------------------------------- */

/* Delete Column To a Table */

ALTER TABLE Employees
DROP COLUMN e_height;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Update-Statement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Update Statement:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
UPDATE Employees
SET e_age = 24
WHERE e_name = &#39;Priya&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Delete-Statement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Delete Statement:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Delete specific record */

DELETE Employees
WHERE e_name = &#39;Priya&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Truncate-Statement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Truncate Statement:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Delete all the value from table but structure remain same */

TRUNCATE TABLE Employees;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Drop-Statement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Drop Statement:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Delete table including structure */

DROP TABLE Employees;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Union-|-Union-All-|-Except-|-Intersect-Operators&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Union | Union All | Except | Intersect Operators:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Union (A + B) Drop Duplicates */

SELECT * FROM Employees
UNION
SELECT * FROM Customers

/* ----------------------------------------- */

/* Union All (A + B) Include Duplicates */

SELECT * FROM Employees
UNION ALL
SELECT * FROM Customers

/* ----------------------------------------- */

/* Except (A - B) Drop Duplicates */

SELECT * FROM Employees
EXCEPT
SELECT * FROM Customers

/* ----------------------------------------- */

/* Intersect (A n B) Common to both */

SELECT * FROM Employees
INTERSECT
SELECT * FROM Customers

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Joins&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Joins:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span face=&quot;&amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;INNER&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span face=&quot;&amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;LEFT&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span face=&quot;&amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;RIGHT&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span face=&quot;&amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;FULL&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* INNER Join } Return records which has matching values */

SELECT 
Employees.e_name, Employees.e_dept, 
Departement.d_name, Departement.d_loc
FROM Employees
INNER JOIN Departement
ON Employees.e_dept = Departement.d_name;

/* ----------------------------------------- */

/* LEFT Join } Return all records from left tables &amp;amp; 
   matching records from right */

SELECT 
Employees.e_name, Employees.e_dept, 
Departement.d_name, Departement.d_loc
FROM Employees
LEFT JOIN Departement
ON Employees.e_dept = Departement.d_name;

/* ----------------------------------------- */

/* RIGHT Join } Return all records from right tables &amp;amp; 
   matching records from left */

SELECT 
Employees.e_name, Employees.e_dept, 
Departement.d_name, Departement.d_loc
FROM Employees
RIGHT JOIN Departement
ON Employees.e_dept = Departement.d_name;

/* ----------------------------------------- */

/* FULL Join } Return all records from right tables &amp;amp; left table */

SELECT 
Employees.e_name, Employees.e_dept, 
Departement.d_name, Departement.d_loc
FROM Employees
FULL JOIN Departement
ON Employees.e_dept = Departement.d_name;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Update-&amp;amp;-Delete-Using-Joins&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Update &amp;amp; Delete Using Joins:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Update e_sal value in Employee table where ever
 the departement location is Mumbai */

UPDATE Employees
SET e_age = e_age+10
FROM Employees 
JOIN Departement ON Employees.e_dept = Departement.d_name
WHERE d_loc = &#39;Mumbai&#39;;

/* ---------------------------------------------------------- */

/* Delete value in Employee table where ever 
   the departement location is Mumbai */

DELETE Employees
FROM Employees 
JOIN Departement ON Employees.e_dept = Departement.d_name
WHERE d_loc = &#39;Mumbai&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Views&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Views:&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Create view of only female employees */

CREATE VIEW Female_emps AS
SELECT * FROM Employees
WHERE e_gender = &#39;F&#39;;

/* ---------------------------------------------------------- */

/* See view */

SELECT * FROM Female_emps;

/* ---------------------------------------------------------- */

/* Drop view */

DROP VIEW Female_emps;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Merge:&lt;/b&gt;&lt;/span&gt;&lt;/h1&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; margin: 1em 0px 0px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Perform INSERT, UPDATE, and DELETE all at once.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;When rows match we want to perform an update.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;When rows don&#39;t match but the data is present in the SOURCE table but not in the TARGET table we need to INSERT all such rows into the TARGET table.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;When records are present only in the TARGET table but not in the SOURCE table, we need to DELETE all such rows from the TARGET table.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
MERGE [TARGET] AS T

USING [SOURCE] AS S

ON [JOIN_CONDITION]

WHEN MATCHED THEN

UPDATE STATEMENT
WHEN NOT MATCHED BY TARGET THEN

INSERT STATEMENT
WHEN NOT MATCHED BY SOURCE THEN

DELETE STATEMENT;

/* CODE: */

MERGE Students AS S
USING students_new AS SN
ON S.s_id = SN.s_id
WHEN MATCHED THEN
    UPDATE SET S.s_name = SN.s_name
WHEN NOT MATCHED BY TARGET THEN
    INSERT(s_id, s_name) VALUES(SN.s_id, SN.s_name)
WHEN NOT MATCHED BY SOURCE THEN
    DELETE;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h3 id=&quot;Function-Types-In-SQL&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;br /&gt;&lt;/h3&gt;&lt;h1 style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px; text-align: left;&quot;&gt;&lt;span&gt;&lt;span&gt;Function Types In SQL:&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h3 id=&quot;Function-Types-In-SQL&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;http://localhost:8888/notebooks/SQL%20NOTES/SQL.ipynb#Function-Types-In-SQL&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #296eaa; padding: 0px 20px; text-decoration-line: none; visibility: hidden;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;background-color: white; box-sizing: border-box; font-style: italic; line-height: 1; margin: 2em 0px 0px; text-align: left;&quot;&gt;&lt;span&gt;&lt;span&gt;(1) Scalar Valued Function&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;background-color: white; box-sizing: border-box; font-style: italic; line-height: 1; margin: 2em 0px 0px; text-align: left;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;(2) Table Valued Function&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* 1.) Scalar Valued Function 
  (Returns Scalar Values such as int, varchar...etc) */

CREATE FUNCTION add_five(@num as int)

RETURNS int
AS
BEGIN
RETURN
(@num + 5)
END

SELECT dbo.add_five(100);

/* ----------------------------------------------------------------- */

/* 2.) Table Valued Funtion (Returns Tabular Values) */

CREATE FUNCTION select_gender(@gender AS VARCHAR(20))
RETURNS TABLE
AS 
RETURN
(SELECT * FROM Employees WHERE e_gender = @gender)


SELECT * FROM DBO.select_gender(&#39;M&#39;);


&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h3 id=&quot;Temporary-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h1 style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px; text-align: left;&quot;&gt;&lt;span&gt;&lt;span&gt;Temporary Table:&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h3 id=&quot;Temporary-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;http://localhost:8888/notebooks/SQL%20NOTES/SQL.ipynb#Temporary-Table&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #296eaa; padding: 0px 20px; text-decoration-line: none; visibility: hidden;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; margin: 1em 0px 0px;&quot;&gt;&lt;span&gt;The table which gets deleted as soon as terminated.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
CREATE TABLE /* NEW_STUDENTS */
(ns_id int, ns_name varchar(20));

INSERT INTO /* NEW_STUDENTS */
VALUES 
(101, &#39;Ram&#39;),
(102, &#39;Jay&#39;);

SELECT * FROM NEW_STUDENTS;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h3 id=&quot;Case-Statement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;Case Statement:&lt;/h3&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* e_sal_cmt will be a new column which will 
  tell if employee is rich or poor */

SELECT *, e_sal_cmt =                     
CASE
    WHEN e_sal &amp;lt; 90000 THEN &#39;POOR&#39;
    WHEN e_sal &amp;gt; 90000 THEN &#39;RICH&#39;
    ELSE &#39;MIDDLE CLASS&#39;
END
FROM Employees
GO

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h3 id=&quot;IIF()-Function&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;IIF() Function:&lt;/h3&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;
SELECT e_id, e_name, e_age,
IIF (e_age&amp;gt;35, &#39;Old Employee&#39;, &#39;New Employee&#39;)
AS e_generation
FROM Employees;	
  
&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h3 id=&quot;Stored-Procedure&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span&gt;Stored Procedure:&lt;/span&gt;&lt;span face=&quot;&amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot;&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;http://localhost:8888/notebooks/SQL%20NOTES/SQL.ipynb#Stored-Procedure&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #296eaa; padding: 0px 20px; text-decoration-line: none; visibility: hidden;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; margin: 1em 0px 0px;&quot;&gt;&lt;span&gt;Functions Which Call Be Called Anytime We Want&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
/* Normal Stored Procedure */

CREATE PROCEDURE access_age
AS
SELECT e_id, e_name, e_age
FROM Employees
WHERE e_age&amp;gt;35
GO

EXEC access_age;

/* --------------------------------------------- */

/* Stored Procedure With Parameters (Get Male &amp;amp; Female Employee Seperately) */

CREATE PROCEDURE emp_gender @gender varchar(20)
AS
SELECT *
FROM Employees
WHERE e_gen = @gender
GO

EXEC emp_gender @gender = &#39;M&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h1 style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px; text-align: left;&quot;&gt;Try Catch:&lt;/h1&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
DECLARE @val1 int;
DECLARE @val2 int;

BEGIN TRY
    SET @val1 = 5;
    SET @val2 = @val1/0;
END TRY

BEGIN CATCH
PRINT ERROR_MESSAGE()
END CATCH;

/* --------------------------------------------- */

BEGIN TRY
    SELECT e_name + e_sal FROM Employees
END TRY

BEGIN CATCH
    PRINT &#39;CANNOT ADD NUM VALUE WTIH STRING&#39;
END CATCH
GO

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Commit &amp;amp; RollBack Using Transcation:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
/* Roll Back */

BEGIN TRANSACTION
    UPDATE Employees
    SET e_age = 30
    WHERE e_name = &#39;Sam&#39;;

SELECT * FROM Employees;

ROLLBACK TRANSACTION;

SELECT * FROM Employees;

/* --------------------------------------------- */

/* Commit */

BEGIN TRANSACTION
    UPDATE Employees
    SET e_age = 30
    WHERE e_name = &#39;Sam&#39;;

SELECT * FROM Employees;

COMMIT TRANSACTION;

SELECT * FROM Employees;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h1 style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Transaction (If Error In Code End Whole Transaction &amp;amp; RollBack):&lt;/span&gt;&lt;/h1&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT *
INTO Copy_Employees
FROM Employees;

/* ------------------------------------------------------------ */

/* This Code Will RollBack Since 120/0 gives ZeroDivisionError */

SELECT * FROM Copy_Employees;



BEGIN TRY
    BEGIN TRANSACTION
        UPDATE Copy_Employees SET e_sal = 500 WHERE e_gender = &#39;M&#39;
        UPDATE Copy_Employees SET e_sal = 120/0 WHERE e_gender = &#39;F&#39;
    COMMIT TRANSACTION
    PRINT &#39;Transaction Commited&#39;
END TRY

BEGIN CATCH
    ROLLBACK TRANSACTION
    PRINT &#39;Transaction RolledBack&#39;
END CATCH



SELECT * FROM Copy_Employees;

/* --------------------------------------------------------------------- */

/* This Code Will Get Commited */

SELECT * FROM Copy_Employees;



BEGIN TRY
    BEGIN TRANSACTION
        UPDATE Copy_Employees SET e_sal = 500 WHERE e_gender = &#39;M&#39;
        UPDATE Copy_Employees SET e_sal = 120 WHERE e_gender = &#39;F&#39;
    COMMIT TRANSACTION
    PRINT &#39;Transaction Commited&#39;
END TRY

BEGIN CATCH
    ROLLBACK TRANSACTION
    PRINT &#39;Transaction RolledBack&#39;
END CATCH



SELECT * FROM Copy_Employees;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;h1 id=&quot;SQL-With-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1.08em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h1 id=&quot;SQL-With-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1.08em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;SQL With Python:&lt;/span&gt;&lt;/h1&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Connect-MySQL-to-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Connect MySQL to Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;,user=&#39;root&#39;,password=&#39;mousepad&#39;,port=3306)

print(mydb.connection_id)

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Create-Data-Base-In-MySQL-with-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Create Data Base In MySQL with Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;,port=3306)

cur = mydb.cursor()

cur.execute(&quot;CREATE DATABASE my_database1&quot;)

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Create-Table-In-Database-using-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Create Table In Database using Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;, port=3306, database=&#39;my_database1&#39;)

cur = mydb.cursor()

str1 = &quot;CREATE TABLE SCHOOL(Stu_id int(10), Stu_fname varchar(10), Stu_lname varchar(10))&quot;

cur.execute(str1)

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Insert-Into-School-Valuse-Using-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Insert Into School Value Using Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;, port=3306, database=&#39;my_database1&#39;)

cur = mydb.cursor()

str2 = &quot;INSERT INTO SCHOOL VALUES(%s,%s,%s)&quot;

vals = [(101,&#39;Naruto&#39;,&#39;Uzumaki&#39;),(102,&#39;Rock&#39;,&#39;Lee&#39;),(103,&#39;Rin&#39;,&#39;Nohara&#39;)]

cur.execute(str2,vals)

mydb.commit()

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Extract-Data-From-Table-Using-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Extract Data From Table Using Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;, port=3306, database=&#39;my_database1&#39;)

cur = mydb.cursor()

str1 = &quot;select * from school&quot;

cur.execute(str1)
result = cur.fetchall()

for i in result:
    print(i)

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Update-Table-With-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Update Table With Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;, port=3306, database=&#39;my_database1&#39;)

cur = mydb.cursor()

s = &quot;UPDATE SCHOOL SET Stu_id=Stu_id+1 WHERE Stu_id&amp;gt;102&quot;

cur.execute(s)
mydb.commit()

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 id=&quot;Delete-Record-With-Python&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 0.777em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Delete Record With Python&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
import mysql.connector

mydb = mysql.connector.connect(host=&#39;localhost&#39;, user=&#39;root&#39;, password=&#39;mousepad&#39;, port=3306, database=&#39;my_database1&#39;)

cur = mydb.cursor()

s = &quot;DELETE FROM school WHERE Stu_id&amp;gt;102&quot;

cur.execute(s)
mydb.commit()

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h1 id=&quot;Interview-Questions&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1.08em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Interview Questions:&lt;/span&gt;&lt;/h1&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Change-Data-Type-Of-a-column&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Change the Data Type Of a column&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
ALTER TABLE Employees
ALTER COLUMN Age float;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Get-Average-Age-Of-Females&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Get the Average Age Of Females&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT AVG(e_age) AS avg_female_Age 
FROM Employees
WHERE e_gender = &#39;F&#39;;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Second-Highest-Salary-In-Employee-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Second Highest Salary In Employee Table&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT MAX(e_sal) FROM Employees
WHERE e_sal &amp;lt; (SELECT MAX(e_sal) FROM Employees);

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Top-N=2-Salary-From-Employees&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Top N=2 Salary From Employees&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT TOP 2 * FROM 
(SELECT DISTINCT TOP 2 * 
 FROM Employees 
 ORDER BY e_sal DESC) AS RESULT
ORDER BY e_sal DESC;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Get-Nth-Highest-Salary&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Get Nth Highest Salary&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
# 3rd highest salary

WITH RESULT AS
(
    SELECT e_sal, DENSE_RANK() OVER (ORDER BY e_sal DESC) as D
    FROM Employees
)
SELECT TOP 1 e_sal
FROM RESULT
WHERE RESULT.D = 3;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Departemet-wise-highest-salary&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Department wise highest salary&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT MAX(e_sal) AS Max_Dep_sal, e_dept FROM Employees
GROUP BY e_dept
ORDER BY Max_Dep_sal DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Number-of-employee-in-each-departement&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Number of employees in each department&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT COUNT(*) AS EMP_CNT, e_dept FROM Employees
GROUP BY e_dept;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Displayed-Duplicated-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Displayed Duplicated Records&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
SELECT COUNT(*) AS Number_of_times_Duplicated, e_id FROM Copy_Employees
GROUP BY e_id
HAVING COUNT(*)&amp;gt;1;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Delete-Duplicate-Records-in-SQL&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Delete Duplicate Records in SQL&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
WITH EmployeesCTE AS
(
    SELECT *, ROW_NUMBER() OVER (PARTITION BY e_id ORDER BY e_id) as Row_Num
    FROM Copy_Employees
)
DELETE FROM EmployeesCTE WHERE Row_Num&amp;gt;1;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Top-3-Employees-With-Higest-Salary&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Top 3 Employees With Highest Salary&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
Select TOP 3 * from Employees
ORDER BY e_sal DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Concat-First-Name-&amp;amp;-Last-Name-Of-Employee&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Concat First Name &amp;amp; Last Name Of Employee&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT CONCAT(f_name,&#39;_&#39;,l_name) as Full_Name FROM Employees; 

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Departement-Wise-Count-Of-Employee&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Departement Wise Count Of Employee&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT COUNT(*) AS cnt_of_emp_as_per_dep, e_dept FROM Employees
GROUP BY e_dept
ORDER BY COUNT(*) ASC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Show All Even Records&lt;/span&gt;&lt;/h4&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT * FROM Employees
WHERE e_id%2=0;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Last 2 Rows&lt;/span&gt;&lt;/h4&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT TOP(2) e_id, e_name, e_sal    
FROM Employees    
Order By e_id DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 id=&quot;Q.)-Show-All-Even-Records&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Show Employee&#39;s location and date of joining which is in the EmpPos table&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT
Employees.e_id, Employees.e_name, Employees.sal,
EmpPos.e_loc, EmpPos.e_join
FROM Employees
INNER JOIN EmpPos
ON Employees.e_id = EmpPos.e_id;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Recently join employees in a given range (MONTH)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT *, DATEDIFF (MONTH, e_join, GETDATE()) as Diff
FROM EmpPos
WHERE DATEDIFF(MONTH, e_join, GETDATE()) BETWEEN 1 AND 25
ORDER BY e_join DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Q.) Recently join employees in a given range (DAY)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT *, DATEDIFF (DAY, e_join, GETDATE()) as Diff
FROM EmpPos
WHERE DATEDIFF(DAY, e_join, GETDATE()) BETWEEN 200 AND 600
ORDER BY e_join DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Q.) Recently join employees in a given range (YEAR)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT *, DATEDIFF (YEAR, e_join, GETDATE()) as Diff
FROM EmpPos
WHERE DATEDIFF(YEAR, e_join, GETDATE()) BETWEEN 1 AND 5
ORDER BY e_join DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Dept with the highest number of employees&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT TOP 1 COUNT(*) AS cnt_of_emp_as_per_dep, e_dept FROM Employees
GROUP BY e_dept
ORDER BY COUNT(*) DESC;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Join 3 tables in SQL server&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT ENAME, DNAME, Gender
FROM EmployeeD
JOIN Departements ON EmployeeD.DID = Departements.DID
JOIN Genders ON Genders.GID = EmployeeD.GID;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) If we have 2 different datatypes we can do that too.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
select T1.T1Column1,T2.T2Column1
from T1
JOIN T2 on T1.ID = T2.ID;


Alter Table T2 Alter column Id nvarchar(3); /*Change datatype*/

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Employee who join in December&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
select * from EmpPos where DATEPART(Month,e_join)=&#39;12&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Average Cost Of Individual Departement&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT e_dept, AVG(e_sal) AS DEPT_COST_AVERAGE FROM Employees
WHERE e_dept = &#39;ALY&#39;
GROUP BY e_dept;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Give e_name and how many happen he/she has month has joined the organization&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: 400;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT 
Employees.e_name,
EmpPos.e_join, DATEDIFF(MM,CONVERT(DATETIME, e_join),GETDATE()) AS Months_Of_Joining
FROM Employees
INNER JOIN EmpPos 
ON Employees.e_id = EmpPos.e_id;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Q.) Display all the e_name and their specific month of joining&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
SELECT Employees.e_name,
EmpPos.e_join
FROM Employees
INNER JOIN EmpPos
ON Employees.e_id = EmpPos.e_id
WHERE DATEPART(Month,e_join)=&#39;12&#39;;

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;h1 id=&quot;MySQL-Prac&quot; style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 25.998px; line-height: 1; margin: 1.08em 0px 0px;&quot;&gt;MySQL Prac&lt;/h1&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;h4 id=&quot;Create-table-Employee&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Create table Employee&lt;/span&gt;&lt;/h4&gt;&lt;div style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;font-size: large;&quot;&gt;&lt;pre&gt;&lt;code&gt;
create table Employee(
    empid int Not null primary key auto_increment,
    first_name varchar(25), 
    last_name varchar(25), 
    salary int, 
    joining_date datetime,
    department_name varchar(25)
);

insert into Employee values
(0001,&#39;Krish&#39;,&#39;Naik&#39;,50000,&#39;14-12-11 09:00:00&#39;,&#39;Development&#39;),
(0002,&#39;Sudhanshu&#39;,&#39;Kumar&#39;,60000,&#39;14-12-11 09:00:00&#39;,&#39;Development&#39;),
(0003,&#39;Sanket&#39;,&#39;Kumar&#39;,70000,&#39;14-12-12 09:00:00&#39;,&#39;HR&#39;),
(0004,&#39;Darius&#39;,&#39;Bengali&#39;,70000,&#39;14-12-13 09:00:00&#39;,&#39;HR&#39;),
(0005,&#39;Satish&#39;,&#39;Bhansal&#39;,30000,&#39;15-10-21 09:00:00&#39;,&#39;Accountant&#39;),
(0006,&#39;Shaktiman&#39;,&#39;Hero&#39;,50000,&#39;15-10-15 09:00:00&#39;,&#39;Accountant&#39;);

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Check-Schema&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Check Schema&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 id=&quot;Creating-Bonus-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;br /&gt;&lt;/h4&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;
desc Employee;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h4 id=&quot;Creating-Bonus-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4 id=&quot;Creating-Bonus-Table&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Creating Bonus Table&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: medium;&quot;&gt;&lt;h4 id=&quot;Creating-Emp-Designation&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;br /&gt;&lt;/h4&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;
create table Bonus(
    emp_ref_id int,
    bonus_amt int,
    bonus_date datetime,
    foreign key(emp_ref_id) references Employee(empid)  # foreign key example
    on Delete cascade                                   # change in employee table then changes will also happen in Bonus table
);

insert into bonus values
(0001,5000,&#39;16-03-14&#39;),
(0002,5000,&#39;16-03-13&#39;),
(0003,5000,&#39;17-03-15&#39;),
(0001,5000,&#39;18-03-17&#39;),
(0004,3500,&#39;16-03-19&#39;),
(0005,7000,&#39;16-03-20&#39;),
(0001,8000,&#39;20-03-21&#39;),
(0002,8500,&#39;20-03-21&#39;);

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 id=&quot;Creating-Emp-Designation&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4 id=&quot;Creating-Emp-Designation&quot; style=&quot;background-color: white; box-sizing: border-box; line-height: 1; margin: 1em 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Creating Emp Designation&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: medium;&quot;&gt;&lt;pre&gt;&lt;code&gt;
create table Designation(
    emp_ref_id int,
    designation varchar(25),
    designation_date datetime,
    foreign key(emp_ref_id) references Employee(empid)
    on delete cascade
);

INSERT INTO designation VALUES
 (0001,&#39;Manager&#39;,&#39;2016-02-5 00:00:00&#39;),
 (0002,&#39;Executive&#39;,&#39;2016-06-11 00:00:00&#39;),
 (0003,&#39;Executive&#39;,&#39;2016-06-11 00:00:00&#39;);
&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;div style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;1. Write an SQL query to receive all details where the first name from the employee table which starts with &#39;k&#39;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from Employee where first_name like &#39;k%&#39;;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;2. Write an Sq1 query to print all details of the employees whose salaries between 10000 to 35000 fetch the Employee name&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from Employee where salary between 10000 and 35000;

/* using subquery */

select concat(first_name,&#39; &#39;,last_name) as Fullname, salary from Employee
where empid in
(select empid from Employee where salary between 10000 and 55000);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;3. SQL query to retrieve details of the employees who have joined on a date&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from Employee where year(joining_date)=2014 and month(joining_date)=12 and day(joining_date)=13;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;4. SQL query to fetch the number of employees in every department&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select department_name, count(empid) as cnt 
from Employee Group by department_name;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;5. SQL query to print details of the employee who are also Executives&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

/* Executives is in Designation */

select employee.empid, employee.first_name,
designation.emp_ref_id, designation.designation
from Employee
right Join designation
on Employee.empid = designation.emp_ref_id
where designation.designation = &#39;Executive&#39;;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;6. SQL query to clone a new table from another table&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

/* Copy only schema / structure */

create table clone_emp like Employee;

/* Copy whole table */

create table clone_table as select * from Employee;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;7. Top n salary of the employee&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from Employee
order by salary
desc limit 2,1;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;8. Nth highest salary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select first_name, salary from employee
order by salary 
desc limit 3,1;                               # N --&amp;gt; 4 } 4th highest salary

/* Without Limit */

SELECT * FROM Employee Emp1
WHERE (3-1) = 
(SELECT COUNT(DISTINCT(Emp2.Salary))
 FROM Employee Emp2
 WHERE Emp2.Salary &amp;gt; Emp1.Salary);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;9. Arrange&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT * FROM tablename WHERE age&amp;gt;25 GROUP BY id HAVING something &amp;gt; 5 ORDER BY date_from LIMIT 10;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;10. First 5 char of employee name&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select LEFT(first_name, 5) as First_five from Employee;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;11. Mask a column from credit_card_details such last few chars are converted to &#39;*&#39;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT CONCAT(LEFT(credit_card_no,4),&#39;*****&#39;) as masked_cred_card_details from CREDIT_CARD_DETAILS;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;12. Get Credit_card_no from 3rd digit to 7th&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select substr(credit_card_no,3,7) from credit_card_details;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;13. Get all the employee name who has salary greater than Krish&#39;s salary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from employee where salary &amp;gt; (select salary from Employee where first_name=&#39;Krish&#39;);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;14. Get all the employee name who has salary greater than Krish&#39;s salary and create a view&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

create view new_view as
select * from employee where salary &amp;gt; (select salary from Employee where first_name=&#39;Krish&#39;);

select * from new_view;

/* Let say you have wifi_id , wifi_speed , wifi_latency , date */


/* Question 1 : Find the average wifi speed for each wifi */
    
select avg(wifi_speed), wifi_id from wifi_details group by wifi_id;    
    
    
/* Question 2 : Find the average wifi speed for each wifi in the last 2 days */
    
select avg(wifi_speed), wifi_id, dt from wifi_details
where dt&amp;gt;=date_add(SYSDATE(), interval -2 day)
group by wifi_id, dt
order by dt DESC;

create table WIFI_DETAILS (
wifi_id varchar(100),
wifi_speed varchar(100),
wifi_latency int,
dt date )


INSERT INTO WIFI_DETAILS VALUES ( &#39;1&#39; , &#39;120&#39; , 12 , sysdate ( ) ) ;
INSERT INTO WIFI_DETAILS VALUES ( &#39;2&#39; , &#39;110&#39; , 12 , sysdate ( ) ) ;
INSERT INTO WIFI_DETAILS VALUES ( &#39;1&#39; , &#39;111&#39; , 12 , sysdate ( ) - 1 ) ;
INSERT INTO WIFI_DETAILS VALUES ( &#39;2&#39; , &#39;122&#39; , 12 , sysdate ( ) - 1 ) ;
INSERT INTO WIFI_DETAILS VALUES ( &#39;1&#39; , &#39;89&#39; , 12 , sysdate ( ) - 2 ) ;
INSERT INTO WIFI_DETAILS VALUES ( &#39;2&#39; , &#39;56&#39; , 12 , sysdate ( ) - 3 ) ;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;15. Show the first and last values of the table&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

(select * from Employee order by empid ASC Limit 1)        /* First */
UNION
(select * from Employee order by empid DESC Limit 1);      /* Last */

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;16. First 4 char of name column string&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT SUBSTRING(first_name,1,4) FROM employee;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;17. Get all the records that are not working in &quot;HR&quot; and &quot;Development&quot;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from employee
where department_name NOT in (&quot;HR&quot; , &quot;Development&quot;);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;18. Top 2 and last 2 salary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

(select * from Employee order by salary asc limit 2)
UNION
(select * from Employee order by salary desc limit 2);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;19. Employee Id in Ascending and Salary in descending&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from Employee order by Department_name ASC, salary DESC;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;20. Joining date in December&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from employee
where month(joining_date) = 12;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;21. Change datatype of a column&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

ALTER TABLE employee
ALTER COLUMN DateOfBirth date;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;22. Remove Duplicate Rows&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

DELETE t1 FROM Employee t1
INNER JOIN Employee t2 
WHERE t1.empid &amp;lt; t2.empid;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;23. Position of &quot;a&quot; in each first_name&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select first_name, instr(first_name, &#39;a&#39;) from worker;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;24. Unique value of the department and its length&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select distinct length(department) from worker;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;25. details of the workers whose names contain &quot;a&quot;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from worker
where instr(first_name, &quot;a&quot;);

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;26. details of a worker whose name ends with &#39;h&#39; and contains 6 alphabets&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from worker
where first_name like &quot;_____h&quot;

# ---------------------------------------------------------------

select * from worker
where lenght(first_name) = 6 and first_name like &quot;%h&quot;;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;27. number of workers in each department&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select department, count(*) as numOfWorker from worker
group by department
order by numOfWorker DESC;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;28. Print details of the workers who are also managers&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select worker_id, first_name, department, salary, worker_ref_id, worker_title
from worker
left join title
on worker.worker_id = title.worker_ref_id
where title.worker_title = &#39;Manager&#39;;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;29. Show only odd rows from the table worker&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from worker
where (worker_id%2) != 0;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;30. Show top n records of the table&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from worker limit 2;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;31. 3rd highest salary from the table&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select * from worker as w1
where (3-1) = (select count(distinct(w2.salary)) from worker as w2
               where w1.salary &amp;lt; w2.salary);

# -------------------------------------------------------------------------

select salary from worker
order by salary DESC
LIMIT N-1,1;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;32. List of workers with the same salary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

select department, count(worker_id) as numOfEmp from worker
group by department having count(worker_id) &amp;lt; 4 ;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;34. department with less than 5 people&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT t.DEPARTMENT,t.FIRST_NAME,t.Salary 
from(SELECT max(Salary) as TotalSalary,DEPARTMENT from Worker group by DEPARTMENT) as TempNew 
Inner Join Worker t on TempNew.DEPARTMENT=t.DEPARTMENT 
and TempNew.TotalSalary=t.Salary;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;36. create a view of only admin, show, drop&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

/* create view */

CREATE VIEW department_only_admin AS
SELECT * FROM worker
where department = &#39;Admin&#39;;

/* show view */

SELECT * FROM department_only_admin;

/* drop view */

DROP VIEW department_only_admin;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;37. Rich or Poor Employee&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT empid, first_name, salary,
IF (salary&amp;gt;55000, &#39;Rich Employee&#39;, &#39;Poor Employee&#39;)
AS emp_Status
FROM Employee;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;38. Rich, Poor, Middle Employee Status using CASE&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT empid, first_name, salary,
(CASE
    WHEN salary &amp;gt; 50000 THEN &quot;RICH EMP&quot;
    WHEN salary = 50000 THEN &quot;MIDDLE EMP&quot;
    ELSE &quot;POOR EMP&quot;
END) AS emp_status
FROM Employee;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;39. Create a Stored Procedure&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

/ *Schemas ==&amp;gt; Stored Procedures (Right Click) ==&amp;gt; Create Stored Procedure ==&amp;gt; {write code} ==&amp;gt; Apply ==&amp;gt; Apply */

/* call strored_procedure_name */


CREATE DEFINER=`root`@`localhost` PROCEDURE `get_emp_info`()
BEGIN
    select * from Employee;
END

/* ---------------------------------------------------------------- */

call get_emp_info;

/* IN */

CREATE DEFINER=`root`@`localhost` PROCEDURE `get_rich_emp_info`(IN amt int)
BEGIN
    select * from Employee where salary &amp;gt; amt;
END

/* ---------------------------------------------------------------- */

call get_emp_info(50000);

/* OUT */

CREATE DEFINER=`root`@`localhost` PROCEDURE `get_rich_emp_info`(OUT records int)
BEGIN
    select count(*) into records from Employee where salary = 50000;
END

/* ---------------------------------------------------------------- */

call get_rich_emp_info(@records);

select @records as TotalRecords;


&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;40. Commit and Rollback&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SET SQL_SAFE_UPDATES = 0;

# your code SQL here

SET SQL_SAFE_UPDATES = 1;

/* example: */
    
SET autocommit = 0;

update employee set salary = 60000 where first_name = &#39;Krish&#39;;

SET autocommit = 1;

rollback;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;41. Export in CSV&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

SELECT Id, Name, Email, Phone, City FROM employee
INTO OUTFILE &#39;C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/employee_backup.csv&#39;   
FIELDS ENCLOSED BY &#39;&quot;&#39;   
TERMINATED BY &#39;;&#39;   
ESCAPED BY &#39;&quot;&#39;   
LINES TERMINATED BY &#39;\r\n&#39;;

&lt;/code&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;42. CSV in MySQL&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
&lt;pre&gt;&lt;code&gt;

LOAD DATA LOCAL INFILE &#39;/path/to/your/csv/file/model.csv&#39;
INTO TABLE test.dummy FIELDS TERMINATED BY &#39;,&#39;
ENCLOSED BY &#39;&quot;&#39; LINES TERMINATED BY &#39;\n&#39;;

&lt;/code&gt;&lt;/pre&gt;
 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: x-large;&quot;&gt;So these are the question which is asked the most.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;!--more--&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/5051465468999136168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2022/08/every-possible-mysql-interview-question.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5051465468999136168'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5051465468999136168'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2022/08/every-possible-mysql-interview-question.html' title='EVERY POSSIBLE MYSQL INTERVIEW QUESTION FOR DATA SCIENCE, DATA ANALYST, DATA ENGINEER, AND DATABASE MANAGER.'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA_LAGDSTIqIFqW1wjKYDZRl8GxZmr3P2iaxG4CDCTo6Ry_dXNAyylNiMiiBHJv1HsU55khpqf8g8g6f_SE9HYUNb335g7sf1dM7Rmgt9VWkEghXuz7mMfANx3XVfBvG4hHrr6g3QfhQZoiD0DxoLP4LZ0WBWrdLo9EEeRbMkmBfkbWVdtTE_5ftBW/s72-c/Dark%20Blue%20&amp;%20Grey%20Executive%20Infographic%20Lesson%20Design.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-9222321479214932776</id><published>2022-03-06T14:40:00.009+05:30</published><updated>2023-02-19T14:38:18.737+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="image manipulation"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>How To Deal With Joint Words In Hindi Text (Devanagari Words) And Successfully Put Them On Images Using Python</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;u style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;How To Deal With Joint Words In Hindi Text And Successfully Put Them On Images Using Python&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhsIgheq_rBv_GUtqJvtCRy-rlN1rXTbYTfbpRnb0qWqHHOd-dzZtvWDZowO4i_fE2lo2YRO2DpbAaLnjE5TAdi9-3ofNa5gEoM0SgEs1C_BmM4lNoBwPAWSNoD6RBWoXV-Ai45_dUmzu7yAuxloZeOHp8WAdrmdQ240uLXuuyzeJMreRjxK8t9-DAq=s1080&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Correct Hindi Text Printed On Image&quot; border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1080&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhsIgheq_rBv_GUtqJvtCRy-rlN1rXTbYTfbpRnb0qWqHHOd-dzZtvWDZowO4i_fE2lo2YRO2DpbAaLnjE5TAdi9-3ofNa5gEoM0SgEs1C_BmM4lNoBwPAWSNoD6RBWoXV-Ai45_dUmzu7yAuxloZeOHp8WAdrmdQ240uLXuuyzeJMreRjxK8t9-DAq=s16000&quot; title=&quot;Correct Hindi Text Printed On Image&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Result Image&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;So few days ago I was
working on a task which was related to Image manipulation... Where I just have
to put some random English text on an image with adjusting their parameters
such as text&#39;s font, size, color... etc, and I was very much successful in
doing it using python library such as pillow. So I though that it would be
great that I do that thing for a different language. So I chose a completely
different language that is devanagari script, which includes languages such as
sanskrit, hindi, marathi..etc. Well, believe me, it wasn&#39;t as easy as I
thought😅.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;So I used pillow library
as my tool to put some hindi text on image same as I put English text on
image... But then I noticed that the spelling of the text which I had wrote is
incorrect and completely change the meaning of the sentence which means that python or i can specifically say pillow library is not able to work with joint words in devanagari script.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQM4JU_Hx-3H2g_TMLcUY3WJSf3ivtEsfwgYB0f6A_BhdUQw1onIFSll4FGfLvbqGjyGsg5WftnOVWV--RIYlxVjRlMuAg8N6zkp0mJjvj6i3g_eM8PxRsnO58Aj6i5bWKjIu-08w2wGxDsy878aQWrKEhvGuYwQTw9tlptyGmLFOm64XgbbxehVfI=s817&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Mistake in marathi text&quot; border=&quot;0&quot; data-original-height=&quot;817&quot; data-original-width=&quot;809&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQM4JU_Hx-3H2g_TMLcUY3WJSf3ivtEsfwgYB0f6A_BhdUQw1onIFSll4FGfLvbqGjyGsg5WftnOVWV--RIYlxVjRlMuAg8N6zkp0mJjvj6i3g_eM8PxRsnO58Aj6i5bWKjIu-08w2wGxDsy878aQWrKEhvGuYwQTw9tlptyGmLFOm64XgbbxehVfI=s16000&quot; title=&quot;Mistake in marathi text&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Mistake in marathi text&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;So I googled
each and every page and sites just to find a completed detailed solution for
this problem... I googled every possible questions such as&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;i&gt;&lt;b&gt;How can I print Hindi sentence (unicode) on an image in Python?&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;i&gt;&lt;b&gt;How to put correct Hindi/Marathi text on image using PIL in python?&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;i&gt;&lt;b&gt;Devanagari font not working in python.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;i&gt;&lt;b&gt;How do I add Hindi text on an image in windows?&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;After so much research
and trial and error I finally came up with a step by step guide to Put Hindi
Text On Image Using Python or we can also say Put Devanagari Text On Image
Using Python.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;Requirerments:&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;- Python 3.6 or greater&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;- pip install numpy&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;- pip install pandas&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white; color: black; font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;Let&#39;s dive into the solution for this problem.&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white; font-family: Times New Roman, serif; font-size: 24px; line-height: 107%;&quot;&gt;&lt;b&gt;Step1&lt;/b&gt;: &lt;b&gt;&lt;u&gt;Install Pyvips&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background: white; font-size: 18pt; line-height: 107%;&quot;&gt;Pyvips don’t manipulate
images directly, instead they create pipelines of image processing operations
building on a source image. When the end of the pipe is connected to a
destination, the whole pipeline executes at once, streaming the image in
parallel from source to destination a section at a time.&lt;span&gt;&lt;!--more--&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 18pt;&quot;&gt;Because pyvips is
parallel, it’s quick, and because it doesn’t need to keep entire images in
memory, it’s light.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 24px; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;u&gt;You can check the documentations for pyvips for more details&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-size: 24px;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: times;&quot;&gt;&lt;a href=&quot;https://libvips.github.io/pyvips/README.html&quot; target=&quot;_blank&quot;&gt;https://libvips.github.io/pyvips/README.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: 24px; font-weight: normal;&quot;&gt;Now go to your jupyter notebook and type:&lt;/span&gt;&lt;/h4&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 24px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 18px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; !pip install pyvips &lt;/code&gt;&lt;/pre&gt;&lt;h4&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 18pt;&quot;&gt;You can also go in command prompt and type:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 18px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; pip install pyvips &lt;/code&gt;&lt;/pre&gt;&lt;h2&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;Now if you go to your jupyter notebook and try to install it you will get an error from pyvips:&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiDo04r3TPSdxlhso87v0xF-rPLghpH-IedsrW28YDaNsLC8vYyFPebsY3cNvT4HVqsosc0ewxz9bIEIguE9C5tx7D5ThJSmb1zlxaXwqPKiVBcbQGZCgR1xtfN-AUvvu38EcucFO0J8oBYs0XO2b-LOJ96t3_2ehxM8PdB3UYf465brErnf_T4wc8O=s1077&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;error while importing pyvips&quot; border=&quot;0&quot; data-original-height=&quot;1077&quot; data-original-width=&quot;790&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiDo04r3TPSdxlhso87v0xF-rPLghpH-IedsrW28YDaNsLC8vYyFPebsY3cNvT4HVqsosc0ewxz9bIEIguE9C5tx7D5ThJSmb1zlxaXwqPKiVBcbQGZCgR1xtfN-AUvvu38EcucFO0J8oBYs0XO2b-LOJ96t3_2ehxM8PdB3UYf465brErnf_T4wc8O=s16000&quot; title=&quot;error while importing pyvips&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;error while importing pyvips&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2&gt;&lt;span style=&quot;background: white; font-family: Times New Roman, serif; line-height: 25.68px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h2&gt;&lt;span style=&quot;background: white; font-family: Times New Roman, serif; line-height: 25.68px;&quot;&gt;&lt;b&gt;Step2&lt;/b&gt;:&amp;nbsp;&lt;b&gt;&lt;u&gt;Download &amp;amp; Locate&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;h4&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;As you are done with
installation pyvips, its done hurrah we are done... Haha, just kidding I wish
life would have been so easy.&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; line-height: 25.68px;&quot;&gt;Lets deal with this error &lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 25.68px;&quot;&gt;OSError: cannot load library &#39;libgobject-2.0-0.dll&#39;: error 0x7e.&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 25.68px;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Basically this is the step-by-step guide to install pyvips and using it for image manipulation task.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;u&gt;Go to the following
link&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://github.com/libvips/libvips/releases&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;https://github.com/libvips/libvips/releases&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 24px; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 24px; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;which will look some thing like this:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background: white; line-height: 107%;&quot;&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 24px; font-weight: 400; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: left;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgIssLo1AQHU9rfIb6Jp2HuBvzfPrD-f33lBQNWNd4Qi2iAA6Z9-COndHcU7cA1ovzSJ3LPbD2YxhH8uk3aHavrVlHjwnhYgQeFrW8UetLcWGFRY-rQJytdHEyfEMcyOr7KBV2hSVBBN80XYjwZgmPzYinvFRveEtrpJKs0j_dyToF4PCx70VZvFXMP=s1692&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;https://github.com/libvips/libvips/releases&quot; border=&quot;0&quot; data-original-height=&quot;955&quot; data-original-width=&quot;1692&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgIssLo1AQHU9rfIb6Jp2HuBvzfPrD-f33lBQNWNd4Qi2iAA6Z9-COndHcU7cA1ovzSJ3LPbD2YxhH8uk3aHavrVlHjwnhYgQeFrW8UetLcWGFRY-rQJytdHEyfEMcyOr7KBV2hSVBBN80XYjwZgmPzYinvFRveEtrpJKs0j_dyToF4PCx70VZvFXMP=s16000&quot; title=&quot;click on the link&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;click on the link&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Now based on your
following system download the suitable file, mine is windows10 64-bits so I
downloaded that file.&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;font-weight: normal;&quot;&gt;After click it will
look some thing like this:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: left;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhmQmJjOh5BfyV3asQLojkIfAwSXnLtbaObgdWmzEtGTrZdF9i3wK2uYsSQzb3UKNfZKKX0uCGDZUsvxIAJCCws49LtV0tZ-q1-uIMDMPmdQm49qC-G_7ahDPq3Rx53UtzrY83cEc1EAY_FncnWYZMHO4iKLRxd89Wx2VhZyuTFDf3_T4pvqu3ibCyU=s1692&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;vips-dev-w64-all-8.12.2.zip&quot; border=&quot;0&quot; data-original-height=&quot;971&quot; data-original-width=&quot;1692&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhmQmJjOh5BfyV3asQLojkIfAwSXnLtbaObgdWmzEtGTrZdF9i3wK2uYsSQzb3UKNfZKKX0uCGDZUsvxIAJCCws49LtV0tZ-q1-uIMDMPmdQm49qC-G_7ahDPq3Rx53UtzrY83cEc1EAY_FncnWYZMHO4iKLRxd89Wx2VhZyuTFDf3_T4pvqu3ibCyU=s16000&quot; title=&quot;vips-dev-w64-all-8.12.2.zip download&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;https://vips-dev-w64-all-8.12.2.zip/&amp;nbsp; &amp;nbsp; ...Download&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;After the
downloading the file go any location and save it ==&amp;gt; extract the files which
will give you folder name &lt;/span&gt;vips-dev-8.12&lt;span style=&quot;font-weight: normal;&quot;&gt;.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhigHAYOAEEvhPIeLcMD9YqaDAqy0hBXBLKqQvmdHk9b1XnHQiTbN6Vgq4ZCEy9S_LTtgKxuWkXiwm2JEgwrMZI_ALzLsITqm2y_0NTwfq8XaGWp-IOeQfyoeG8L3O9UyeIFGkNIDiJfjByPLOqcsrIo-ZC8iLh60ur5QEctuuCiTOlJG7pykLq2veA=s1742&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;vips-dev-8.12&quot; border=&quot;0&quot; data-original-height=&quot;392&quot; data-original-width=&quot;1742&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhigHAYOAEEvhPIeLcMD9YqaDAqy0hBXBLKqQvmdHk9b1XnHQiTbN6Vgq4ZCEy9S_LTtgKxuWkXiwm2JEgwrMZI_ALzLsITqm2y_0NTwfq8XaGWp-IOeQfyoeG8L3O9UyeIFGkNIDiJfjByPLOqcsrIo-ZC8iLh60ur5QEctuuCiTOlJG7pykLq2veA=s16000&quot; title=&quot;vips-dev-8.12 folder&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;vips-dev-8.12 folder&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Times New Roman, serif; line-height: 25.68px;&quot;&gt;&lt;b&gt;Step3: &lt;u&gt;Setup path in environment variables&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Now go to
vips-dev-8.12 ==&amp;gt; bin&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;copy it&#39;s path in my system it is in&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 24px;&quot;&gt;C:\vips-dev-8.12\bin&lt;/span&gt;&lt;/p&gt;&lt;/h4&gt;&lt;h4 style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;Now go to your environment variables &amp;amp; paste it.&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;For user variables:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-size: 18pt; line-height: 107%;&quot;&gt;Righ click in ThisPc
==&amp;gt; Advanced System settings ==&amp;gt; Environment Variables ==&amp;gt; User
variabes ==&amp;gt; Path ==&amp;gt; Edit ==&amp;gt; New ==&amp;gt; Paste ==&amp;gt; Ok&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;font-size: 18pt; text-align: left;&quot;&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-weight: normal; margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjk6OQTkGJQl2-ype6R95qMoLzfhVGViIGu2H6-GZ8LyxPx6uc-K2wDVJx3AZ5R1nEHxwPgGaqXf3ZQ_2xJfS51kx8EPw4uUox7odwv2-FKbYW-0nk7REKK0u2Utc7NTE_pgkBq-66Y2_w8c3dt6dVnwwtxiazj3cPlYLjvKY3B53dmRztsUo5zt8uz=s784&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;pasting path in user variables&quot; border=&quot;0&quot; data-original-height=&quot;784&quot; data-original-width=&quot;705&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjk6OQTkGJQl2-ype6R95qMoLzfhVGViIGu2H6-GZ8LyxPx6uc-K2wDVJx3AZ5R1nEHxwPgGaqXf3ZQ_2xJfS51kx8EPw4uUox7odwv2-FKbYW-0nk7REKK0u2Utc7NTE_pgkBq-66Y2_w8c3dt6dVnwwtxiazj3cPlYLjvKY3B53dmRztsUo5zt8uz=s16000&quot; title=&quot;pasting path in user variables&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pasting path in user variables&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;For System variables:&lt;/span&gt;&lt;/h4&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Righ click in ThisPc ==&amp;gt;
Advanced System settings ==&amp;gt; Environment Variables ==&amp;gt; Sytem variabes ==&amp;gt;
Path ==&amp;gt; Edit ==&amp;gt; New ==&amp;gt; Paste ==&amp;gt; Ok&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgYjz_B-YDRim_WZPDoubsV8DTO6vWTEnJ2CLe4-s1ISLvEPh_ZP2TwwQxcoj8xdSvSx3Oz8QlbiI8Fg_OuzkP86Yz-D7klN5LLTKCiXyWM6EeulgnMYDI_0vSgOksjEBD5-gooXGHVH6m4LdI3AdffWQEXUOZgI-ryNAyjnTTRyPneZwjlHLIvDowk=s784&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;pasting path in System variable&quot; border=&quot;0&quot; data-original-height=&quot;784&quot; data-original-width=&quot;707&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgYjz_B-YDRim_WZPDoubsV8DTO6vWTEnJ2CLe4-s1ISLvEPh_ZP2TwwQxcoj8xdSvSx3Oz8QlbiI8Fg_OuzkP86Yz-D7klN5LLTKCiXyWM6EeulgnMYDI_0vSgOksjEBD5-gooXGHVH6m4LdI3AdffWQEXUOZgI-ryNAyjnTTRyPneZwjlHLIvDowk=s16000&quot; title=&quot;pasting path in System variable&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pasting path in System variable&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Times New Roman, serif; line-height: 25.68px;&quot;&gt;&lt;b&gt;Step4:&amp;nbsp;&lt;u&gt;Almost done with the process&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h4 style=&quot;text-align: center;&quot;&gt;&lt;span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;*** &lt;/span&gt;Restart your system&lt;span style=&quot;font-weight: normal;&quot;&gt; ***&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;Now go to your Jupyter
Notebook or python file and type import pyvips and yess we did it. So we are
half way though.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;

&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;Now Let&#39;s start with our
main contain:&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;
  &lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; # IMPORTS  
 
 import os  
 import pyvips  
 import textwrap  
 from PIL import *  
 import pandas as pd  
 from PIL import Image  
 from PIL import ImageFont  
 from PIL import ImageDraw   
 &lt;br /&gt;
 # MAKE A FUNCTION  
 
 def bgoutput(filename, text):  
 
   rendered_text, feedback = pyvips.Image.text(text,   
                         font=&#39;Mangal&#39;, fontfile=&#39;Mangal Regular.ttf&#39;,   
                         width=900, height=900,   
                         autofit_dpi=True) 
 
   rendered_text = rendered_text.gravity(&#39;centre&#39;, 1500, 1500)  &lt;br /&gt;
   image = rendered_text.new_from_image([0, 0, 0]).bandjoin(rendered_text)  
   image.write_to_file(f&#39;{filename}.png&#39;) &lt;br /&gt; 
 # GENERATE OUTPUT 1   &lt;br /&gt;
 text = &quot;परिस्थितियां विपरीत हो तो कुछ लोग टूट जाते हैं, और कुछ लोग रिकॉर्ड तोड़ देते हैं..!!&quot;  
 bgoutput(&#39;new&#39;, text)  &lt;br /&gt;
 # COMBINE OUTPUT 1 WITH BACKGROUND IMAGE  &lt;br /&gt;
 img = Image.open(&#39;new.png&#39;)   
 b1 = Image.open(&#39;bg_img.png&#39;)  
 img = img.resize((1000,1000))  
 b1.paste(img,(50,50), mask=img)  &lt;br /&gt;
 # GENERATE FINAL OUTPUT  &lt;br /&gt;
 b1.save(&quot;final.png&quot;)  &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_C2JC0cBjNOVal7wDSRl6FOoEyp_jogDsmNij_hnaa6D_oJC15UlqkaDUOO9wdoEuUYEP84MgyRM0qLWFU4y68jPgyVYj3a1neu4E5mzM0lDF92t1RX9M8jR7HPlMyluoB6bN4YuUmlp-wSh0yQEqECoZGFyHNX9Eq6dSULm_Thn0us03fpr8pXi6=s1080&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Final Output File&quot; border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1080&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_C2JC0cBjNOVal7wDSRl6FOoEyp_jogDsmNij_hnaa6D_oJC15UlqkaDUOO9wdoEuUYEP84MgyRM0qLWFU4y68jPgyVYj3a1neu4E5mzM0lDF92t1RX9M8jR7HPlMyluoB6bN4YuUmlp-wSh0yQEqECoZGFyHNX9Eq6dSULm_Thn0us03fpr8pXi6=s16000&quot; title=&quot;Final Output File Hindi Text On Image With No Error&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Final Output&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; font-weight: normal; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 24px; font-weight: normal;&quot;&gt;Understand the parameters here you can tune some values and make changes based on your requirements.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;div style=&quot;background: rgb(247, 247, 247); border: 1pt solid rgb(204, 204, 204); mso-border-alt: solid #CCCCCC .75pt; mso-element: para-border-div; padding: 5pt;&quot;&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; out =
pyvips.Image.text(text, font=str, width=int, height=int, align=Union[str,
Align], rgba=bool, dpi=int, justify=bool, spacing=int, fontfile=str,
autofit_dpi=bool)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;Returns:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out (Image): Output
image&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;Args:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text (str): Text to
render&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;Keyword args:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; font (str): Font to
render with&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; width (int): Maximum
image width in pixels&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; height (int): Maximum image height in pixels&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; align (Union[str,
Align]): Align on the low, centre or high edge&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rgba (bool): Enable RGBA
output&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dpi (int): DPI to render
at&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; justify (bool): Justify
lines&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; spacing (int): Line
spacing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fontfile (str): Load
this font file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;Other Parameters:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 14.55pt; margin-bottom: 6.75pt; padding: 0in; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; autofit_dpi (int): DPI
selected by autofit&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-size: large; font-weight: normal;&quot;&gt;Finally finally did it😀.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 107%;&quot;&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large; font-weight: normal; line-height: 107%;&quot;&gt;So we hope that you enjoyed this session. If you did then please share
it with your friends and spread this knowledge.&lt;/span&gt;&lt;/h4&gt;

&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large; line-height: 107%;&quot;&gt;&lt;u&gt;Support us by following our social media&lt;/u&gt;:&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-size: large; line-height: 107%;&quot;&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Instagram:&amp;nbsp;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;i&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Facebook:&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;i&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; style=&quot;font-weight: normal;&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/i&gt;&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Twitter:&lt;/h4&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot;&gt;&lt;i style=&quot;font-weight: normal;&quot;&gt;https://twitter.com/InfinityCodeX1&lt;br /&gt;&lt;/i&gt;&lt;/a&gt;&lt;/h4&gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Youtube:&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 style=&quot;background-color: white; font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;i style=&quot;font-weight: normal;&quot;&gt;&lt;a href=&quot;https://www.youtube.com/channel/UC9F_A8HF2PISaQnP3TUOKWg&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;https://www.youtube.com/channel/UC9F_A8HF2PISaQnP3TUOKWg&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/9222321479214932776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2022/03/how-to-put-hindi-text-on-images-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/9222321479214932776'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/9222321479214932776'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2022/03/how-to-put-hindi-text-on-images-using.html' title='How To Deal With Joint Words In Hindi Text (Devanagari Words) And Successfully Put Them On Images Using Python'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhsIgheq_rBv_GUtqJvtCRy-rlN1rXTbYTfbpRnb0qWqHHOd-dzZtvWDZowO4i_fE2lo2YRO2DpbAaLnjE5TAdi9-3ofNa5gEoM0SgEs1C_BmM4lNoBwPAWSNoD6RBWoXV-Ai45_dUmzu7yAuxloZeOHp8WAdrmdQ240uLXuuyzeJMreRjxK8t9-DAq=s72-c" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-5956088854207052951</id><published>2020-12-02T17:03:00.021+05:30</published><updated>2021-09-23T16:19:41.298+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>TOP 10 JUTSUS OF FEATURE ENGINEERING EVERY DATA SCIENTISTS NINJA SHOULD KNOW RIGHT NOW</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;u&gt;TOP 10 JUTSUS OF FEATURE ENGINEERING EVERY DATA SCIENTISTS NINJA
SHOULD KNOW RIGHT NOW&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h1&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkeAS8pnyrPEPQ437Fy9ifAQNdQmPqkb3G02i6iS8yod0o6DAo8AUJh_47Kj0PQcpxam_xqSBdAWoOzL121Q3xn24s1nZHlYHR5kokOD42DXfO6brXb7Mq8K9kOecKJ5ZSYCrHBiEMQYY/s2048/thisisengineering-raeng-WDCE0T4khsE-unsplash.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Feature Engineering&quot; border=&quot;0&quot; data-original-height=&quot;1365&quot; data-original-width=&quot;2048&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkeAS8pnyrPEPQ437Fy9ifAQNdQmPqkb3G02i6iS8yod0o6DAo8AUJh_47Kj0PQcpxam_xqSBdAWoOzL121Q3xn24s1nZHlYHR5kokOD42DXfO6brXb7Mq8K9kOecKJ5ZSYCrHBiEMQYY/s16000/thisisengineering-raeng-WDCE0T4khsE-unsplash.jpg&quot; title=&quot;Feature Engineering&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;p style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-weight: 400;&quot;&gt;If you want to be a successful data scientist and to make your model predict the most accurate result, then the following article is for you.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: x-large;&quot;&gt;What is Feature Engineering?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-style: normal;&quot;&gt;As per Wikipedia, Feature engineering&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&amp;nbsp;is the process of using domain
knowledge to extract&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;features&lt;/span&gt;&lt;/i&gt;&amp;nbsp;from raw data via data
mining techniques. These&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;features&lt;/span&gt;&lt;/i&gt;&amp;nbsp;can be used to improve
the performance of machine learning algorithms.&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;Feature engineering&lt;/span&gt;&lt;/i&gt;&amp;nbsp;can be considered as applied
machine learning itself.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Okay, so we
saw what Wikipedia said about it but still, we want to know more about it. So
let’s divide this term into 2 parts for better understanding i.e Feature and
Engineering.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;b&gt;What are the
Features in a dataset?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Basically,
all machine learning algorithms use some input data (independent data) to
generate output. These input data are features, which are usually in the form of
structured columns.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;So, why
do we engineer it?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;To get the
most accurate or I can say to get the most precise output from our machine learning the algorithm we need to give it cleanest data possible which should be compatible
with our machine learning algorithm.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;So the
process of preparing the proper input dataset for our machine learning model is
known as Feature Engineering.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;Now you will
ask how important is this process of feature engineering to generate any
machine-learning project?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;According to
Forbs survey, data scientist spends around 80% of their time on data
preparation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuKgMnF1cGcc9SOeDm7D33V1zbYFHdp1kTbHOMf4Ic-9HgUIWiX-iGVmFh8iBmbCJrfL2PxW8nFeViSZ4ok6vs3YMrmRCVg5136Sr80sro7WfVSFGPnYi8R9Nv4dRPyrkhKYgRJFyokFc/s960/fobs_survey.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Forbes Data Science Survey&quot; border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;960&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuKgMnF1cGcc9SOeDm7D33V1zbYFHdp1kTbHOMf4Ic-9HgUIWiX-iGVmFh8iBmbCJrfL2PxW8nFeViSZ4ok6vs3YMrmRCVg5136Sr80sro7WfVSFGPnYi8R9Nv4dRPyrkhKYgRJFyokFc/w640-h272/fobs_survey.jpg&quot; title=&quot;Forbes Data Science Survey&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;a href=&quot;https://www.forbes.com/sites/gilpress/2016/03/23/data-preparation-most-time-consuming-least-enjoyable-data-science-task-survey-says/?sh=3cfaff156f63&quot; target=&quot;_blank&quot;&gt;Link of the complete survey by Forbes.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;Data
scientists spend 60% of their time cleaning and organizing data. Collecting
data sets come second at 19% of their time, meaning data scientists spend
around 80% of their time on preparing and managing data for analysis.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;76% of data
scientists view data preparation as the least enjoyable part of their work&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;57% of data
scientists regard cleaning and organizing data as the least enjoyable part of
their work and 19% say this about collecting data sets.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;List of
Techniques you can find in this blog:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;1.) Techniques
of Imputation of numerical and categorical data&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;2.) Dealing
with outliers&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;3.) Binning&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;4.) Techniques
of dealing with Gaussian-Distribution / Skewness&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;5.) OneHotEncoding
and OrdinalEncoder&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;6.) Feature
splitting &amp;amp; extraction&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;7.) Group By &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;8.) Concat,
Merge, Join&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;9.) Scaling&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;10.) Extracting
Date &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;u&gt;1.) Techniques
of Imputation of numerical and categorical data&lt;/u&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixkHsemiMlXkP3g0pCWrUBbBxypDknc932oYh4Zo1ujFo7Jclnku5Wnm4pFEySJKWB_SxTLCR0THyeTPWhYrDiixwtYZ5Lm97QY-ji9EjxqcYkj8x-B3TrMGdUFwEqLXqrxP_-pmxoovs/s798/missing_data.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Deal with missing data&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;798&quot; height=&quot;299&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixkHsemiMlXkP3g0pCWrUBbBxypDknc932oYh4Zo1ujFo7Jclnku5Wnm4pFEySJKWB_SxTLCR0THyeTPWhYrDiixwtYZ5Lm97QY-ji9EjxqcYkj8x-B3TrMGdUFwEqLXqrxP_-pmxoovs/w400-h299/missing_data.png&quot; title=&quot;Deal with missing data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;In this we
deal with missing values that are present in our dataset.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;The most simple solution to deal with missing values is to drop that row or column,
suppose that you have more than 75% of values missing that you can definitely
drop that row or column.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;

 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 threshold = 0.75  
 # Columns:  
 data = data[data.columns[data.isnull().mean() &amp;lt; threshold]]  
 
 #------------------------------------------------------------------------
 
 # Rows:  
 data = data.loc[data.columns[data.isnull().mean(axis=1) &amp;lt; threshold]]
 &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;The most common way to deal with missing values is through fill 0, Mean, Mean, or Mode
value in that missing space.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # fill NaN values with 0  
 data = data.fillna(0)  
 
 #------------------------------------------------
 
 # fill NaN values with median  
 data = data.fillna(data.mean())  
 
 #------------------------------------------------
 
 # fill NaN values with median: Better than Mean  
 data = data.fillna(data.median())  
 
 #------------------------------------------------
 
 # fill NaN values with mode  
 data = data.fillna(data.mode()) 
 &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large; font-weight: normal;&quot;&gt;To deal with
numerical data specifically you can use imputers they are very useful to get
the perfect value to fill in that missing space.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;Above
mention is too naïve way of imputation, but we are ninjas we have some of our
own ninja techniques we can use&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;(i) Simple 
  Imputer&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-A simple
imputer is univariate which means it will take only a single feature in the count.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 23px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # using simple imputer  
 
 import numpy as np  
 from sklearn.impute import SimpleImputer  
 imputer = SimpleImputer(missing_values=np.nan, strategy=&#39;median&#39;) # can be mean, median, mode  
 imputer = imputer.fit(x)  
 data = imputer.transform(x)  
 print(&#39;Imputed Data:&#39;,data)
 &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large; font-weight: normal;&quot;&gt;-This is
quite a blunt approach.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-What if the
feature “x” which has NaN values is very well co-correlated with the features
such as “y” or “z”. Let’s say, people with higher “Age” give more “Rent” and
people with lower “Age” give less “Rent”. So that suggests a multivariate
approach. Which just means it takes multiple features into count.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-So the
Iterative Imputer and KNN Imputer comes into the concentration.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;(ii) Iterative
  Imputer&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-In
iterative imputer for all the rows in which “Age” is not missing sklearn trains
a regression model.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Where other
features such as “Gender” and “Rent”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;are
considered as independent input features and “Age” is considered as the target
output feature.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;-Now for all rows in which “Age” is missing it
makes predictions for “Age” by using features “Gender” and “Rent” to trained
model.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: x-large; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # IterativeImputer  
 
 from sklearn.experimental import enable_iterative_imputer  
 from sklearn.impute import IterativeImputer  
 imputer_it = IterativeImputer()  
 imputer_it.fit_transform(x)  
 &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;/p&gt;

&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;&lt;b&gt;NOTE&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background-color: #04ff00; font-family: times;&quot;&gt;This model used by iterative imputer is totally independent of the model you are
using this dataset as training data.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #04ff00; font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&lt;b&gt;(iii) KNN 
  Imputer&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Let’s
pretend we have a row in which “Age” is missing.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Then
sklearn finds the 2 most similar rows measured by how close the “Gender” and
“Fare” values are to this row.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  # KNNImputer   
  
  from sklearn.experimental import enable_iterative_imputer   
  from sklearn.impute import KNNImputer   
  imputer_knn = KNNImputer(n_neighbors=2)   
  imputer_knn.fit_transform(x)
  &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Dealing with
the categorical and nominal data with the help of mode&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;
  
  &lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;&lt;br /&gt; data[&#39;categorical_col&#39;] = data[&#39;categorical_col&#39;].fillna(data[&#39;categorical_col&#39;].mode()[0])&lt;br /&gt;  
&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;
  
  &lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;i&gt;&lt;u&gt;2.) Dealing with outliers&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;i&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPM8ggidkHgNf3klHB9ogyG_o8SNmRCad9xnlmMSEDMNSAQQIzdqEcCpix2TQhcESV0mXcB6H3GWT2eJYd0JrmteUcaFHezK7QXM_78NzW3oHlDe_cuPdmz4ebczFCyd5mw2-PZgKC2Us/s1600/outliers.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Here is an Outlier&quot; border=&quot;0&quot; data-original-height=&quot;883&quot; data-original-width=&quot;1600&quot; height=&quot;354&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPM8ggidkHgNf3klHB9ogyG_o8SNmRCad9xnlmMSEDMNSAQQIzdqEcCpix2TQhcESV0mXcB6H3GWT2eJYd0JrmteUcaFHezK7QXM_78NzW3oHlDe_cuPdmz4ebczFCyd5mw2-PZgKC2Us/w640-h354/outliers.jpg&quot; title=&quot;Here is an Outlier&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Detecting
outliers&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;:&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;Using
Z-score:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Data that
fall outside of the 3&lt;sup&gt;rd&lt;/sup&gt; standard deviation is considered as an outlier. We can use a Z-score if Z-score falls outside of &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; line-height: 107%;&quot;&gt;μ+3 &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;or &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; line-height: 107%;&quot;&gt;μ-3 &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;then we will consider it as an outlier.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih0hmDsxM9B4ZrHZ4sNCNmm_5SsPXiQay_nbkSowNZ8CWf9TmPbZfGT-HbkM8dcii43zr8XeFJSsAB2DZ1XQYRedkkGo6kqgQL0-b5sWOze-jGn7jCDROC5ICa76pQA5f-B7Ryq-8Sgi0/s500/z_score.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Z-Score&quot; border=&quot;0&quot; data-original-height=&quot;305&quot; data-original-width=&quot;500&quot; height=&quot;244&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih0hmDsxM9B4ZrHZ4sNCNmm_5SsPXiQay_nbkSowNZ8CWf9TmPbZfGT-HbkM8dcii43zr8XeFJSsAB2DZ1XQYRedkkGo6kqgQL0-b5sWOze-jGn7jCDROC5ICa76pQA5f-B7Ryq-8Sgi0/w400-h244/z_score.png&quot; title=&quot;Z-Score&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Z-Score&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 import numpy as np  
 
 box = [10,20,15,25,11,12,16,26,19,29,3000]  
 
 outliers = []  
 def detect_outliers(data):  
   Threshold = 3  
   mean = np.mean(data)  
   std = np.std(data)  
   for i in data:  
     z_score = (i-mean)/std  
     if np.abs(z_score) &amp;gt; Threshold:  
       outliers.append(i)  
   return outliers  
 out = detect_outliers(box)  
 out  
 &lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;Using IQR:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Datapoint
that fall outside of 1.5 times od Inter Quartile Range above 1&lt;sup&gt;st&lt;/sup&gt; &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;the quartile and the 3&lt;sup&gt;rd&lt;/sup&gt;
quartile. &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX8Vjgm9xNhJ0bAWkmAhfex_3WE_6Ln4Yw69KYrWuhPRbu5zHfEbBwr1A_sSUkSgy11XWqUtYfE4QvchL2ccHslO-UM_6yj6pYzAyJnP_HBqB5rQGfwHEHeRcSVTHw8ltZolsVlu7iozk/s1400/iqr.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Inter Quartile Range&quot; border=&quot;0&quot; data-original-height=&quot;700&quot; data-original-width=&quot;1400&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX8Vjgm9xNhJ0bAWkmAhfex_3WE_6Ln4Yw69KYrWuhPRbu5zHfEbBwr1A_sSUkSgy11XWqUtYfE4QvchL2ccHslO-UM_6yj6pYzAyJnP_HBqB5rQGfwHEHeRcSVTHw8ltZolsVlu7iozk/w640-h320/iqr.png&quot; title=&quot;Inter Quartile Range&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 import numpy as np  
 
 box = [10,20,15,25,11,12,16,26,19,29,3000]  
 
 box = sorted(box)  
 Q1,Q3 = np.percentile(box, [25,75])  
 print(Q1,Q3)  
 iqr = Q3 - Q1  
 print(iqr)  
 
 # Lower bound and higher bound values  
 lower_bound_val = Q1 - (1.5*iqr)  
 higher_bound_val = Q3 + (1.5*iqr)  
 print(lower_bound_val,higher_bound_val)  
 &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large;&quot;&gt;&lt;b&gt;Using
Box-plot:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;The values
which are beyond the Max or Min are considered as the outliers.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2GFLoY_aR2F5xE_kqHZ_A19JDZ_6DA3rHmq0QRWPEir9IueHZ_IunzG6tEOaKMc2jH1h3c3Caf269xsNh2KGktewCEhXNlMQtVZmHghgK2D6AccZWgj_lN9XEOkut4maYVqvUS4Mb7oc/s734/boxplot.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Box plot&quot; border=&quot;0&quot; data-original-height=&quot;570&quot; data-original-width=&quot;734&quot; height=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2GFLoY_aR2F5xE_kqHZ_A19JDZ_6DA3rHmq0QRWPEir9IueHZ_IunzG6tEOaKMc2jH1h3c3Caf269xsNh2KGktewCEhXNlMQtVZmHghgK2D6AccZWgj_lN9XEOkut4maYVqvUS4Mb7oc/w400-h311/boxplot.png&quot; title=&quot;Box plot&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
   for feature in data:  
   dataset = data.copy()  
   if 0 in dataset[feature].unique():  
     pass  
   else:  
     dataset[feature] = np.log(dataset[feature])  
     dataset.boxplot(column=feature)  
     plt.ylabel(feature)  
     plt.title(feature)  
     plt.show()  
     &lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Dropping
outliers with the Standard Deviation&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-family: times; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 fact = 3  
 upper_bound_val = data[&#39;column&#39;].mean() + data[&#39;column&#39;].std() * fact  
 lower_bound_val = data[&#39;column&#39;].mean() - data[&#39;column&#39;].std() * fact  
 data = data[(data[&#39;column&#39;] &amp;lt; upper_bound_val) &amp;amp; (data[&#39;column&#39;] &amp;gt; lower_bound_val)]&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 data = pd.DataFrame(np.random.randn(500,4))&lt;br /&gt;
 from scipy import stats&lt;br /&gt;
 data[(np.abs(stats.zscore(data)) &amp;lt; 3).all(axis=1)]&lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Dropping the
outliers rows with percentile&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-family: times; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;  
 upper_bound_val = data[&#39;column&#39;].quantile(0.95)  
 lower_bound_val = data[&#39;column&#39;].quantile(0.05)  
 data = data[(data[&#39;column&#39;] &amp;lt; upper_bound_val) &amp;amp; (data[&#39;column&#39;] &amp;gt; lower_bound_val)]  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: x-large; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;u&gt;3.) Binning&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx-28z6iPA9astvEt68IJ87S1m9E7cif9hBVGXfWfvZlw4QEXqbQ7seBAa_FPodrOP7FFZev5jFLJTQwnRMkbghL2zoKFeVKunnszoiEFl92vC9dO3CU0GiSGOvr3yf6Nnu-ZKfgjl7WQ/s1126/Data_Binning_1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Base to Binned data&quot; border=&quot;0&quot; data-original-height=&quot;710&quot; data-original-width=&quot;1126&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx-28z6iPA9astvEt68IJ87S1m9E7cif9hBVGXfWfvZlw4QEXqbQ7seBAa_FPodrOP7FFZev5jFLJTQwnRMkbghL2zoKFeVKunnszoiEFl92vC9dO3CU0GiSGOvr3yf6Nnu-ZKfgjl7WQ/w400-h253/Data_Binning_1.png&quot; title=&quot;Base to Binned data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;Image Credit&lt;/b&gt;:&amp;nbsp;&lt;a href=&quot;https://wisdomschema.com/data-binning/&quot; style=&quot;font-weight: normal;&quot;&gt;https://wisdomschema.com/data-binning/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Binning can
be applied to both categorical and numerical data.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;- The main reason behind binning is to make the model more robust and prevent overfitting,
however, it has a performance cost.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;#Numerical
Binning Example&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Value&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Bin&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;0-30&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;=&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Fail&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;31-70&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; =&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Average&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;71-100 =&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Excelent&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;#Categorical
Binning Example&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Value&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Bin&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Mumbai&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;=&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Maharashtra&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Pune&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;=&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Maharashtra&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Bikaner&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; =&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Rajasthan&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Jaipur&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;=&lt;/span&gt;&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Rajasthan&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Numerical
Binning Example&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
data[&#39;bin&#39;] = pd.cut(data[&#39;value&#39;], bins=[0,30,70,100], labels=[&quot;Fail&quot;, &quot;Average&quot;, &quot;Excelent&quot;]) 

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white none repeat scroll 0% 0%; line-height: normal; margin-bottom: 12.0pt; margin-left: 0cm; margin-right: 24.0pt; margin-top: 12.0pt; margin: 12pt 0cm 12pt 24pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; border: 1pt none windowtext; color: black; padding: 0cm;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;value&amp;nbsp; &amp;nbsp; | bin &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;background: white none repeat scroll 0% 0%; line-height: normal; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 12.0pt; margin: 12pt 0cm 0cm;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;0 |  2    | Fail&lt;br /&gt;
1 | 45   | Average&lt;br /&gt;
2 |  7 &amp;nbsp;  | Fail&lt;br /&gt;
3 |  85  | Excellent&lt;br /&gt;
4 |  28  | Fail&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;Categorical
Binning Example&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  conditions = [  
   data[&#39;State&#39;].str.contains(&#39;Mumbai&#39;),  
   data[&#39;State&#39;].str.contains(&#39;Pune&#39;),  
   data[&#39;State&#39;].str.contains(&#39;Bikaner&#39;),  
   data[&#39;State&#39;].str.contains(&#39;Jaipur&#39;)]  
  choices = [&#39;Maharashtra&#39;, &#39;Maharashtra&#39;, &#39;Rajasthan&#39;, &#39;Rajasthan&#39;]  
  data[&#39;Continent&#39;] = np.select(conditions, choices, default=&#39;Other&#39;) 
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;
  
  &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre style=&quot;background: white none repeat scroll 0% 0%; margin-bottom: 12.0pt; margin-left: 0cm; margin-right: 24.0pt; margin-top: 12.0pt; margin: 12pt 0cm 12pt 24pt; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;code&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; border: 1pt none windowtext; color: black; padding: 0cm;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;value&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;| bin &lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style=&quot;background: white none repeat scroll 0% 0%; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 12.0pt; margin: 12pt 0cm 0cm;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;0 |  Mumbai |&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Maharashtra&lt;br /&gt;
1 | Pune  &amp;nbsp; &amp;nbsp;|&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Maharashtra&lt;br /&gt;
2 | Bikaner &amp;nbsp; |&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Rajasthan&lt;br /&gt;
3 | &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Delhi&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;| Other&lt;br /&gt;
4 |  Jaipur  | Rajasthan&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style=&quot;background: white none repeat scroll 0% 0%; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 12.0pt; margin: 12pt 0cm 0cm;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;i&gt;&lt;u&gt;4.)Techniques
of dealing with Gaussian-Distribution / Skewness&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGPknCabfUPCkSdT0ySZ7LDdG2StspJOz-qe-rXF4mLeEHzbqPDd9VAUJF6HSJe_iWfz-LtBfAqYV_0Zj6kPSbf3fw5pJp6SpbLLRrqIFCff2FawB6bzHH5zYLieEKl2qf_Ykx8NvcP64/s891/skewed+data.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Skewed data&quot; border=&quot;0&quot; data-original-height=&quot;283&quot; data-original-width=&quot;891&quot; height=&quot;204&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGPknCabfUPCkSdT0ySZ7LDdG2StspJOz-qe-rXF4mLeEHzbqPDd9VAUJF6HSJe_iWfz-LtBfAqYV_0Zj6kPSbf3fw5pJp6SpbLLRrqIFCff2FawB6bzHH5zYLieEKl2qf_Ykx8NvcP64/w640-h204/skewed+data.png&quot; title=&quot;Skewed data&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Helps to
handles skewed data and after transformation, the distribution becomes more
approximate to the normal.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;-Decreases
the effect of the outliers to the normalization of magnitude difference and the model becomes more robust.&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;b&gt;(i)Log
Transformation:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; font-weight: normal; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Log transformation&amp;nbsp;is a
data&amp;nbsp;transformation&amp;nbsp;method in which it replaces by log(x) with base
10, base 2, or natural log.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 data[&#39;log_column&#39;] = np.log(data[&#39;column&#39;]+1)  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #222222;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: times;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(ii)Reciprocal Transformation:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;In Reciprocal Transformation, x
will replace by the inverse of X(1/X). The reciprocal transformation will give
little effect on the shape of the distribution. This transformation can be only
used for non-zero values. The skewness for the transformed data is increased.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 data[&#39;Reciprocal_column&#39;] = 1/(data[&#39;column&#39;]+1)  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #222222; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #222222;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(iii)Square-Root Transformation:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;This&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;transformation&lt;/span&gt;&lt;/i&gt;&amp;nbsp;will give a moderate effect on&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;distribution&lt;/span&gt;&lt;/i&gt;. The main advantage of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;square root transformation&lt;/span&gt;&lt;/i&gt;&amp;nbsp;is, it can be applied to
zero values. Here the x will replace by the&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;square root&lt;/span&gt;&lt;/i&gt;(x).
It is weaker than the Log&amp;nbsp;&lt;i&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;Transformation&lt;/span&gt;&lt;/i&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  data[&#39;sqr_column&#39;] = data[&#39;column&#39;]**(1/2)  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;u&gt;&lt;i&gt;5.)OneHotEncoding
and OrdinalEncoder&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-weight: normal; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm78nTLTFboB-ph70MG2Vc5m5d3pH_ehve5DMCuZ-qnMCdLGxaoEdjmMCyWWOcpe1YLDTlkHsP3sDsbtguOEyhKMdJ0IacfGp6Vuc2fkTRWHhF53A1h8iPNwmF14LUfarZBUvJSz9KG1M/s714/OHE.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;One Hot Encoding Example&quot; border=&quot;0&quot; data-original-height=&quot;280&quot; data-original-width=&quot;714&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm78nTLTFboB-ph70MG2Vc5m5d3pH_ehve5DMCuZ-qnMCdLGxaoEdjmMCyWWOcpe1YLDTlkHsP3sDsbtguOEyhKMdJ0IacfGp6Vuc2fkTRWHhF53A1h8iPNwmF14LUfarZBUvJSz9KG1M/w640-h250/OHE.png&quot; title=&quot;One Hot Encoding Example&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;b&gt;image credit&lt;/b&gt;:&amp;nbsp;&lt;a href=&quot;https://www.kaggle.com/dansbecker/using-categorical-data-with-one-hot-encoding&quot;&gt;https://www.kaggle.com/dansbecker/using-categorical-data-with-one-hot-encoding&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Since our
computer systems only understand numerical data. So categorical data makes no
sense for them unless they are converted into the numerical data and for that
we use techniques such as OneHotEncoding and OrdinalEncoders.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;# For single
column&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
  encoded_col = pd.get_dummies(data[&#39;column&#39;], drop_first = True)  
  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: large; font-weight: normal;&quot;&gt;# For multi
column&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  encoded_multi_col = pd.get_dummies(data,columns = [&#39;column1&#39;, &#39;column2&#39;, &#39;columnN&#39;], drop_first=True)
  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: times; font-weight: normal;&quot;&gt;The above
mentioned is too naïve way of doing this, but we are ninjas we have a secret technique to get the optimum result.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;For unordered
(Nominal) data we will be using OneHotEncoding&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Example: Male,
Female&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # OneHotEncoding is for unordered (Nominal) data  
 # Example: Male, Female  
 
 from sklearn.preprocessing import OneHotEncoder  
 ohe = OneHotEncoder(sparse=False)  
 ohe.fit_transform(data[[&#39;column&#39;]])  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;For ordered
(Ordinal) data we will be using OrdinalEncoder&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Example: First,
Second, Third&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # OrdinalEncoder is for ordered (Ordinal) data  
 # Example: First, Second, Third  
 from sklearn.preprocessing import OrdinalEncoder  
 oe = OrdinalEncoder(categories=[[&#39;First&#39;, &#39;Second&#39;, &#39;Third&#39;],  
                 [&#39;O&#39;,&#39;A&#39;,&#39;B&#39;,&#39;C&#39;]])  
 oe.fit_transform(data[[&#39;Rank&#39;, &#39;Grade&#39;]])  
 &lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;u&gt;&lt;i&gt;6.)Feature
splitting &amp;amp; extraction&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbVlNqU2bZScDKqpSWg8zg0L_M5c3j5depnqf36H5KYXXTKiUh-FGjgopwqpKDp_YY69gWJ285chNyveOdQJtxSK6Z9_mpCcFJvdN4QEllxM6UsBkCg_FDukOsSmGTRPGYvMenDMt5Hh4/s450/blog_analyticsplatform_blog.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Data Splitting and Extraction&quot; border=&quot;0&quot; data-original-height=&quot;320&quot; data-original-width=&quot;450&quot; height=&quot;456&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbVlNqU2bZScDKqpSWg8zg0L_M5c3j5depnqf36H5KYXXTKiUh-FGjgopwqpKDp_YY69gWJ285chNyveOdQJtxSK6Z9_mpCcFJvdN4QEllxM6UsBkCg_FDukOsSmGTRPGYvMenDMt5Hh4/w640-h456/blog_analyticsplatform_blog.jpg&quot; title=&quot;Data Splitting and Extraction&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;-By extracting
the utilizable part of a column into a new feature:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*We enable the machine-learning algorithms to comprehend them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Make possible
to bin and group them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Improve model
performance by uncovering potential information.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Splitting a function is a good option, but however, there is one way of splitting features.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;It depends on
the characteristics of the column, how to split it.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;Feature
Splitting&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
  
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 import pandas as pd  
 import numpy as np  
 data = [(&#39;Arnold Schwarzenegger&#39;,&#39;M&#39;),   
     (&#39;Natasha Romanova&#39;,&#39;F&#39;),   
     (&#39;Sylvester Stallone&#39;,&#39;M&#39;),   
     (&#39;Gal Gadot&#39;,&#39;F&#39;),   
     (&#39;Dwayne Johnson&#39;,&#39;M&#39;)]  
 df = pd.DataFrame(data, columns=[&#39;name&#39;, &#39;gender&#39;])  
 df  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;  

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_QiJevIMlaOupHeV16MLDrDQQKWbem67A0ToaqiegqFZ_3VZT4h_Hx1XQzSW7vq28-SyG2pB4q3DXbicMmnQf_ii9swQ6YrLaQieVL-QExo6aAQVVmABwXR68s0zhmWKuR5CRu_Zvy0o/s525/img1.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;output 1&quot; border=&quot;0&quot; data-original-height=&quot;368&quot; data-original-width=&quot;525&quot; height=&quot;265&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_QiJevIMlaOupHeV16MLDrDQQKWbem67A0ToaqiegqFZ_3VZT4h_Hx1XQzSW7vq28-SyG2pB4q3DXbicMmnQf_ii9swQ6YrLaQieVL-QExo6aAQVVmABwXR68s0zhmWKuR5CRu_Zvy0o/w400-h265/img1.png&quot; title=&quot;output 1&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;
  
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Extracting First Name  
 df.name.str.split(&quot; &quot;).map(lambda X : X[0])  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9-XpM2BmidUqnnvuvHIeSCdKfNAK1wcdkfeqh9GfJSkiqZIZnG8mhmwp-Y33IxgQouLz7GFYX_2VoVLmP7PRVhZtD8i9XUMyijDQGzejGH2HsudI7V7P2e5Qu4Vjy9fbTOChaCHR_klc/s588/img1_1.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;First name output&quot; border=&quot;0&quot; data-original-height=&quot;324&quot; data-original-width=&quot;588&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9-XpM2BmidUqnnvuvHIeSCdKfNAK1wcdkfeqh9GfJSkiqZIZnG8mhmwp-Y33IxgQouLz7GFYX_2VoVLmP7PRVhZtD8i9XUMyijDQGzejGH2HsudI7V7P2e5Qu4Vjy9fbTOChaCHR_klc/w400-h220/img1_1.png&quot; title=&quot;First name output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Extracting Last Name  
 df.name.str.split(&quot; &quot;).map(lambda X : X[-1])  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnYjE6qIaqLjLmdvNzcGD35SLtrs7f2pn-G8FqOLxpfUfqOiSFHSogr1LiLkzd9wPFNCGfkvyvEBZG_CWqeE_nrEjXCXm8nLAapOyu5DeTWv37dAQqdq3JWSupndJm1pmqMURUtefbWFQ/s612/img1_2.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;Last name output&quot; border=&quot;0&quot; data-original-height=&quot;322&quot; data-original-width=&quot;612&quot; height=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnYjE6qIaqLjLmdvNzcGD35SLtrs7f2pn-G8FqOLxpfUfqOiSFHSogr1LiLkzd9wPFNCGfkvyvEBZG_CWqeE_nrEjXCXm8nLAapOyu5DeTWv37dAQqdq3JWSupndJm1pmqMURUtefbWFQ/w400-h210/img1_2.png&quot; title=&quot;Last name output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;u style=&quot;font-family: times; font-size: x-large;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;Feature
Extraction&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-family: times; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 weather_data = [(&#39;1/1/2017&#39;, 32, 6, &#39;Rain&#39;),  
         (&#39;1/2/2017&#39;, 30, 7, &#39;Sunny&#39;),  
         (&#39;1/3/2017&#39;, 32, 2, &#39;Snow&#39;),  
         (&#39;1/4/2017&#39;, 34, 6, &#39;Snow&#39;),  
         (&#39;1/5/2017&#39;, 32, 4, &#39;Rain&#39;),  
         (&#39;1/6/2017&#39;, 32, 2, &#39;Sunny&#39;)  
         ]  
 df = pd.DataFrame(weather_data, columns=[&#39;day&#39;, &#39;temp&#39;, &#39;windspeed&#39;, &#39;weather&#39;])  
 df  
 &lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1smKtCVcZiUb2hfFSJC1VJyPqSnS7azWC3h7iOb8tHuSQ_5peXJGIN3waQ8TrGYDweId9bPtyxBzF1PPQX73uIuLN71P76fwDT5IIXqxaH0_A9M-zdLhqoIelSdnDiXly4ACjNGgT6-I/s617/img2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;weather data&quot; border=&quot;0&quot; data-original-height=&quot;414&quot; data-original-width=&quot;617&quot; height=&quot;269&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1smKtCVcZiUb2hfFSJC1VJyPqSnS7azWC3h7iOb8tHuSQ_5peXJGIN3waQ8TrGYDweId9bPtyxBzF1PPQX73uIuLN71P76fwDT5IIXqxaH0_A9M-zdLhqoIelSdnDiXly4ACjNGgT6-I/w400-h269/img2.png&quot; title=&quot;weather data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 df[&#39;day&#39;][df[&#39;weather&#39;]==&#39;Rain&#39;]  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTidElpebr9UwiuN-4dSY1KWjW-gHvl2GMPOScSVPaCuNYjPZofMMkc0gTtLiFKY9aHsu6B-WKydBMBYIV9B6rOsDhToxoSMfWl24ETFGSMZIvhhytBTXw1-rKaoPUbXQldOTnIX_S-kA/s490/img3.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;date when it rained&quot; border=&quot;0&quot; data-original-height=&quot;131&quot; data-original-width=&quot;490&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTidElpebr9UwiuN-4dSY1KWjW-gHvl2GMPOScSVPaCuNYjPZofMMkc0gTtLiFKY9aHsu6B-WKydBMBYIV9B6rOsDhToxoSMfWl24ETFGSMZIvhhytBTXw1-rKaoPUbXQldOTnIX_S-kA/w400-h108/img3.png&quot; title=&quot;date when it rained&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
  df.day[df.temp == df.temp.max()]  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx5XTcevixIEwypzQWVW7XTZ6FGs_-vYJRVDm5AgRkGJ2hjyWLJkRDEizG87qRD2ahIYdKdXJaSQgLZgmJuBGgLQQK0grh6Ao1V9NEJwWHobjKASj_SpLE6Soo3LCc6d7WFFbCzdI_Xas/s500/img4.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;max temperature&quot; border=&quot;0&quot; data-original-height=&quot;123&quot; data-original-width=&quot;500&quot; height=&quot;99&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx5XTcevixIEwypzQWVW7XTZ6FGs_-vYJRVDm5AgRkGJ2hjyWLJkRDEizG87qRD2ahIYdKdXJaSQgLZgmJuBGgLQQK0grh6Ao1V9NEJwWHobjKASj_SpLE6Soo3LCc6d7WFFbCzdI_Xas/w400-h99/img4.png&quot; title=&quot;max temperature&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: x-large; font-weight: normal;&quot;&gt;&lt;u&gt;&lt;i&gt;7.) Group By&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_O0pEROuZnp8BiWkiBnJtsTkoE_Yz7ejEeCKo1v9VZ8NGGQQcVOz2MSS6ANI5GGz2jfd8LeloX9slAZn9YykNiGytj4-8ln0FiRPuuC6d2l5p46Gc3K70YnEUEMHCjSKojyVjeS03Pbk/s600/shutterstock_678616456-e1523846011874-770x578.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Group data&quot; border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;600&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_O0pEROuZnp8BiWkiBnJtsTkoE_Yz7ejEeCKo1v9VZ8NGGQQcVOz2MSS6ANI5GGz2jfd8LeloX9slAZn9YykNiGytj4-8ln0FiRPuuC6d2l5p46Gc3K70YnEUEMHCjSKojyVjeS03Pbk/w640-h480/shutterstock_678616456-e1523846011874-770x578.jpg&quot; title=&quot;Group data&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;groupby() function is used to split
the data into groups based on some criteria.&amp;nbsp;pandas&amp;nbsp;objects can be
split on any of their axes. The abstract definition of grouping is to provide a
mapping of labels to group names.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  weather_data = [(&#39;1/1/2017&#39;, &#39;Mumbai&#39; , 32, 6, &#39;Rain&#39;),  
         (&#39;1/2/2017&#39;, &#39;Pune&#39; , 30, 7, &#39;Sunny&#39;),  
         (&#39;1/3/2017&#39;, &#39;Mumbai&#39; , 32, 2, &#39;Snow&#39;),  
         (&#39;1/4/2017&#39;, &#39;Pune&#39; , 34, 6, &#39;Snow&#39;),  
         (&#39;1/5/2017&#39;, &#39;Mumbai&#39; , 32, 4, &#39;Rain&#39;),  
         (&#39;1/6/2017&#39;, &#39;Delhi&#39; , 32, 2, &#39;Sunny&#39;)  
         ]  
 data = pd.DataFrame(weather_data, columns=[&#39;day&#39;, &#39;city&#39;, &#39;temp&#39;, &#39;windspeed&#39;, &#39;weather&#39;])  
 data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBazANDYgQzWxhqsTTStBeJKSrvL3P55jayB_P4B3pWQWjycKM7qzp83f4OG0mujrM52jZQpy5Bg-25DusXOePBolj8iQwx_92q2CDb0piKbFGk3IYVoH-hGbzlrZI1h9e4bEdgzMgtr4/s751/img5.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;weather data&quot; border=&quot;0&quot; data-original-height=&quot;422&quot; data-original-width=&quot;751&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBazANDYgQzWxhqsTTStBeJKSrvL3P55jayB_P4B3pWQWjycKM7qzp83f4OG0mujrM52jZQpy5Bg-25DusXOePBolj8iQwx_92q2CDb0piKbFGk3IYVoH-hGbzlrZI1h9e4bEdgzMgtr4/w400-h225/img5.png&quot; title=&quot;weather data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 grp_city = data.groupby(&#39;city&#39;)  
 for city, city_data in grp_city:  
   print(city)  
   print(city_data)  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgA5zXMwn47oSBLQfMqd8eliEPurRtutz7ElU_zK1kAqS33s2JRWgWhNg3cFB70AzS-w5ZP0QPHd00uWGuhN1mR-9MdKEUl4Jnbi0W3_kbq8T2nViXrxONj-JMy9QbO1mRazujEqEyx80/s878/img6.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;City Data&quot; border=&quot;0&quot; data-original-height=&quot;534&quot; data-original-width=&quot;878&quot; height=&quot;244&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgA5zXMwn47oSBLQfMqd8eliEPurRtutz7ElU_zK1kAqS33s2JRWgWhNg3cFB70AzS-w5ZP0QPHd00uWGuhN1mR-9MdKEUl4Jnbi0W3_kbq8T2nViXrxONj-JMy9QbO1mRazujEqEyx80/w400-h244/img6.png&quot; title=&quot;City Data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Get specific group  
 grp_city.get_group(&#39;Mumbai&#39;)
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLYe2zBlZZYRrYebpUJf8To5d8fWzyZfDfAAKqaS7QR37zhLCRDZPe2ekmeG6vTW7KIqDlzKHdIzo-HR7YIFYcrseb0rVazqgrBTEoHYaZSr2pYU4MV9At-Nt2KNHiD1u6qBhXyOFHJUk/s754/img7.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;get specific group&quot; border=&quot;0&quot; data-original-height=&quot;252&quot; data-original-width=&quot;754&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLYe2zBlZZYRrYebpUJf8To5d8fWzyZfDfAAKqaS7QR37zhLCRDZPe2ekmeG6vTW7KIqDlzKHdIzo-HR7YIFYcrseb0rVazqgrBTEoHYaZSr2pYU4MV9At-Nt2KNHiD1u6qBhXyOFHJUk/w400-h134/img7.png&quot; title=&quot;get specific group&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  print(grp_city.max())  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik7ihoMOgiSrL8zxjKvo0qJumijDjayCQnMY5G4FqdLGQpdq5YR_KGyCc8_GqjdIeGa9Tgbs6yadRRknWRJcc1yHGrjC8f1Sh12AMprqvBcTqr4SeWg1FjORXhifqVEdoaC7PQcq-Sl1s/s790/img8.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;City Max&quot; border=&quot;0&quot; data-original-height=&quot;225&quot; data-original-width=&quot;790&quot; height=&quot;114&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik7ihoMOgiSrL8zxjKvo0qJumijDjayCQnMY5G4FqdLGQpdq5YR_KGyCc8_GqjdIeGa9Tgbs6yadRRknWRJcc1yHGrjC8f1Sh12AMprqvBcTqr4SeWg1FjORXhifqVEdoaC7PQcq-Sl1s/w400-h114/img8.png&quot; title=&quot;City Max&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
  print(grp_city.mean())  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVka3ZSyfzw_D4uMYqt4wGzPF7_cyZq9dG0s1BVxixxnVC7RjbFoc3OQCbZxZHSvJvp43FdAUd5fiNGVxX2SV0m3oGKatRg8MZuDtJfyXpLVSsJSehH6q1fgZLzLpTqND2omjjTSRXKBg/s473/img9.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;City Mean&quot; border=&quot;0&quot; data-original-height=&quot;224&quot; data-original-width=&quot;473&quot; height=&quot;190&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVka3ZSyfzw_D4uMYqt4wGzPF7_cyZq9dG0s1BVxixxnVC7RjbFoc3OQCbZxZHSvJvp43FdAUd5fiNGVxX2SV0m3oGKatRg8MZuDtJfyXpLVSsJSehH6q1fgZLzLpTqND2omjjTSRXKBg/w400-h190/img9.png&quot; title=&quot;City Mean&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  print(grp_city.describe())  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-family: times; font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWxgtX1C2nmwz3IDM9qGStKO1yDSVGY-4muxEuKYqD83Mmu6Q0HIYD8Yw3UhytKs28M4sHd5vyihSHa77jjD6y6VSltf6F97q-vhNIV1rbrsBYRufTquXWs0U-SI1YpjfDRkLQHk2xeLg/s1492/img10.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Group city describe&quot; border=&quot;0&quot; data-original-height=&quot;584&quot; data-original-width=&quot;1492&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWxgtX1C2nmwz3IDM9qGStKO1yDSVGY-4muxEuKYqD83Mmu6Q0HIYD8Yw3UhytKs28M4sHd5vyihSHa77jjD6y6VSltf6F97q-vhNIV1rbrsBYRufTquXWs0U-SI1YpjfDRkLQHk2xeLg/w640-h250/img10.png&quot; title=&quot;Group city describe&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;8.) Concat,
Merge, Join&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbRXOKSfdCbTHBMbM7mZcaaf3RJLES5PbAr5Xi2oRuFRXntgowvRFcI0rbQhKYrDnawaJIi-Kb4bBQq7iKnYvt_yhKox3mNjlWBVkLkrd27JS6PlCokNaOrSpaDK-FB1FJvr1GfWrpYlM/s1820/MergeVideoHero2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Concat, Merge, &amp;amp;  Join&quot; border=&quot;0&quot; data-original-height=&quot;1234&quot; data-original-width=&quot;1820&quot; height=&quot;434&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbRXOKSfdCbTHBMbM7mZcaaf3RJLES5PbAr5Xi2oRuFRXntgowvRFcI0rbQhKYrDnawaJIi-Kb4bBQq7iKnYvt_yhKox3mNjlWBVkLkrd27JS6PlCokNaOrSpaDK-FB1FJvr1GfWrpYlM/w640-h434/MergeVideoHero2.png&quot; title=&quot;Concat, Merge, &amp;amp;  Join&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Works like how
we had worked on SQL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  Maharashtra_weather_data = pd.DataFrame({  
   &#39;city&#39;: [&#39;Mumbai&#39;, &#39;Pune&#39;, &#39;Thane&#39;],  
   &#39;temperature&#39;: [32, 45, 30],  
   &#39;humidity&#39;: [80, 60, 78]  
 })  
 Maharashtra_weather_data  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWKoDfc7B0gIV8EdeaclYAVPKKsGaN7c2XmW_5IMWqZD-jOdz0yl7S7F9D0nyLlMOKK_bEKkhDUebNC7dNHfYCwW4uRk6X2bKPIhUgwdMCe33ADrzLeiTJdCCt16WcUaI4bHH0iF3dAMA/s533/img11.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Maharashtra weather data&quot; border=&quot;0&quot; data-original-height=&quot;268&quot; data-original-width=&quot;533&quot; height=&quot;201&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWKoDfc7B0gIV8EdeaclYAVPKKsGaN7c2XmW_5IMWqZD-jOdz0yl7S7F9D0nyLlMOKK_bEKkhDUebNC7dNHfYCwW4uRk6X2bKPIhUgwdMCe33ADrzLeiTJdCCt16WcUaI4bHH0iF3dAMA/w400-h201/img11.png&quot; title=&quot;Maharashtra weather data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
  
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 Gujarat_weather_data = pd.DataFrame({  
   &#39;city&#39;: [&#39;Surat&#39;, &#39;Rajkot&#39;, &#39;Mehsana&#39;],  
   &#39;temperature&#39;: [21, 24, 35],  
   &#39;humidity&#39;: [68, 65, 75]  
 })  
 
 Gujarat_weather_data 
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDGmeeg05oAQvVLSnmiw8dhoDC1ri9vjRgu6ZuETNT-ljadm7a7ZwYPAZCo6ZMXOPWmVYVRhmYEXBEyCoCn9dBt7o0wEXDtkPi6_jpjJ2R-JtuskFOYkiaEhsyKUkwX9_Hv46hmUfdPLA/s551/img12.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Gujarat weather data&quot; border=&quot;0&quot; data-original-height=&quot;242&quot; data-original-width=&quot;551&quot; height=&quot;176&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDGmeeg05oAQvVLSnmiw8dhoDC1ri9vjRgu6ZuETNT-ljadm7a7ZwYPAZCo6ZMXOPWmVYVRhmYEXBEyCoCn9dBt7o0wEXDtkPi6_jpjJ2R-JtuskFOYkiaEhsyKUkwX9_Hv46hmUfdPLA/w400-h176/img12.png&quot; title=&quot;Gujarat weather data&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(i) Concat:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;i&gt;-Column Wise
Concatenation&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
  
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 df = pd.concat([Maharashtra_weather_data, Gujarat_weather_data])  
 df
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;  
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV2lslLPBtJb8sTH2JvFgGJWEMmC06d0eSbHFlmCwyT4tnqGABJyoLSDzaAjZZL24VO1a4g7-XwiFm6uqMctF5UfNSr0ZoTakTMmbbQ-D8Oqtk-IHBMCbpNU7gtporvtgFFd7tj_GnC-I/s545/img13.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;427&quot; data-original-width=&quot;545&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV2lslLPBtJb8sTH2JvFgGJWEMmC06d0eSbHFlmCwyT4tnqGABJyoLSDzaAjZZL24VO1a4g7-XwiFm6uqMctF5UfNSr0ZoTakTMmbbQ-D8Oqtk-IHBMCbpNU7gtporvtgFFd7tj_GnC-I/s320/img13.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;i&gt;-Row Wise Concatenation&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 df = pd.concat([Maharashtra_weather_data, Gujarat_weather_data], axis=1)  
 df  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUsvVF6GU-7k1a1e6qlxRe3rVAxPWZWLcxUJiDup-2o6imumxtcBfeBiwefuFpwQ4j93SO0SpvkjmjfjW-Ph7PnalMYd70wByfDBz3xzMb6BrnZZb124Vqbu7JRduEaPQlDn_i9852wsc/s1043/img14.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Row wise&quot; border=&quot;0&quot; data-original-height=&quot;238&quot; data-original-width=&quot;1043&quot; height=&quot;146&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUsvVF6GU-7k1a1e6qlxRe3rVAxPWZWLcxUJiDup-2o6imumxtcBfeBiwefuFpwQ4j93SO0SpvkjmjfjW-Ph7PnalMYd70wByfDBz3xzMb6BrnZZb124Vqbu7JRduEaPQlDn_i9852wsc/w640-h146/img14.png&quot; title=&quot;Row wise&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(ii) Merge&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  temp_data = pd.DataFrame({  
   &#39;city&#39;:[&#39;Mumbai&#39;,&#39;Delhi&#39;,&#39;Banglore&#39;,&#39;Hydrabad&#39;],  
   &#39;temp&#39;:[32,45,30,40]  
 })  
 temp_data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7m84u2erfwIkU7jbk575eki32nikNHoIvj8tiqFlI-T5NuyIMMzsiPPL9KoHoJhkrpStYKVgyk5ZfS86Sz7OF70IxUUX1_dc2R6IxTmG8smiEK_EWS0wuQmYEvM6_K388c3x6yoKlxpY/s304/img15.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Temperature city&quot; border=&quot;0&quot; data-original-height=&quot;285&quot; data-original-width=&quot;304&quot; height=&quot;188&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7m84u2erfwIkU7jbk575eki32nikNHoIvj8tiqFlI-T5NuyIMMzsiPPL9KoHoJhkrpStYKVgyk5ZfS86Sz7OF70IxUUX1_dc2R6IxTmG8smiEK_EWS0wuQmYEvM6_K388c3x6yoKlxpY/w200-h188/img15.png&quot; title=&quot;Temperature city&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 humidity_data = pd.DataFrame({  
   &#39;city&#39;:[&#39;Mumbai&#39;,&#39;Delhi&#39;,&#39;Banglore&#39;],  
   &#39;humidity&#39;:[62,65,70]  
 })  
 humidity_data
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMTfrFXxsI-Lc6kZY3KNkTMyxWwmt42Khia_YUgUVSkxZosqMt3nHFsVaIyWdzXvnqpKD6yMUOELDRUy8q1QDeqT8cjGH-rStpI1yw6omDJrfPPy1nC815zddSgqaPbvJs6ciRNAGZxiw/s347/img16.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Humidity city&quot; border=&quot;0&quot; data-original-height=&quot;237&quot; data-original-width=&quot;347&quot; height=&quot;219&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMTfrFXxsI-Lc6kZY3KNkTMyxWwmt42Khia_YUgUVSkxZosqMt3nHFsVaIyWdzXvnqpKD6yMUOELDRUy8q1QDeqT8cjGH-rStpI1yw6omDJrfPPy1nC815zddSgqaPbvJs6ciRNAGZxiw/w320-h219/img16.png&quot; title=&quot;Humidity city&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
  
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Merge 2 dataframe without explicitly mentioning the index  
 
 df = pd.merge(temp_data, humidity_data, on=&#39;city&#39;)  
 df  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXCvP9TXWtmN7c9ZJA3_zhKXlyVfwDQufAyQ6Qu2ojAkCJq-a47sMLKJcUtpPzzV5g_XapPTrrzKvvoN6yXiznZtw5JpomKAYh2VdKL0pwtrv126AK6Y2Jx0bW7k8Um20ztznWOJOrog/s448/img17.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Merge Data&quot; border=&quot;0&quot; data-original-height=&quot;244&quot; data-original-width=&quot;448&quot; height=&quot;174&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXCvP9TXWtmN7c9ZJA3_zhKXlyVfwDQufAyQ6Qu2ojAkCJq-a47sMLKJcUtpPzzV5g_XapPTrrzKvvoN6yXiznZtw5JpomKAYh2VdKL0pwtrv126AK6Y2Jx0bW7k8Um20ztznWOJOrog/w320-h174/img17.png&quot; title=&quot;Merge Data&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(iii) Join&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 df = pd.merge(temp_data, humidity_data, on=&#39;city&#39;,how=&#39;outer&#39;)  
 df  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWcJw7a7Wj9HwhDSkQNbnbJmImZ21vv9R7fy_epaHVk2jHgXfq4v4uZi06m-8O5lhGJHiY3iDY60MO3MZayPrLcIZlYbE62cqCClgEV5FcWbsSW_VnTc7QakNSTMkdADwOPr6iqJCKY_g/s445/img18.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;join data&quot; border=&quot;0&quot; data-original-height=&quot;289&quot; data-original-width=&quot;445&quot; height=&quot;208&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWcJw7a7Wj9HwhDSkQNbnbJmImZ21vv9R7fy_epaHVk2jHgXfq4v4uZi06m-8O5lhGJHiY3iDY60MO3MZayPrLcIZlYbE62cqCClgEV5FcWbsSW_VnTc7QakNSTMkdADwOPr6iqJCKY_g/w320-h208/img18.png&quot; title=&quot;join data&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: x-large;&quot;&gt;&lt;i&gt;&lt;u&gt;9.) Scaling&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZHTte0IZD_6WJZ_52mlpeIW413t95CduXWirS35CZf8te1ARk1_M8usyyVisLV79n5HGJwKZtmSJbeKohPJ1iP0EfbsZMOPLhaf-7mcuD0BU1kinMwY6oGOeOrG_-gV65D6zsgodQe4Y/s640/scaling.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Data Scaling&quot; border=&quot;0&quot; data-original-height=&quot;480&quot; data-original-width=&quot;640&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZHTte0IZD_6WJZ_52mlpeIW413t95CduXWirS35CZf8te1ARk1_M8usyyVisLV79n5HGJwKZtmSJbeKohPJ1iP0EfbsZMOPLhaf-7mcuD0BU1kinMwY6oGOeOrG_-gV65D6zsgodQe4Y/w640-h480/scaling.png&quot; title=&quot;Data Scaling&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Scaling&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;are done basically in 2 ways first is
Normalization and the second is Standardization.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 data = pd.DataFrame({  
   &#39;name&#39;:[&#39;Ram&#39;, &#39;Lakhan&#39;, &#39;Shiva&#39;, &#39;Ria&#39;, &#39;Lucy&#39;, &#39;Suraj&#39;, &#39;Rohan&#39;, &#39;Anny&#39;, &#39;Priya&#39;, &#39;Niraj&#39;],  
   &#39;age&#39;:[25,40,33,26,30,35,28,43,36,50],  
   &#39;Salary&#39;:[25000, 32000, 50000, 33000, 20000, 29000, 22000, 52000, 23000, 26000],  
   &#39;purchased&#39;:[1,0,1,1,0,0,0,1,0,1]  
 })  
 data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwYSWWXy1IydXfYEo7Dd1n9kEKk4W9PnXZZdiwRJvvqxma39mSjsYiD-xo8p45Fw69hQKAOeeMqZv_BKbJX8lXU-FrqNCCVaSNejK7KkyUA5nm4jSukZfgTuTlWZSyY3IYyIdNCsiaVuA/s649/img19.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Data for Normalization&quot; border=&quot;0&quot; data-original-height=&quot;649&quot; data-original-width=&quot;554&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwYSWWXy1IydXfYEo7Dd1n9kEKk4W9PnXZZdiwRJvvqxma39mSjsYiD-xo8p45Fw69hQKAOeeMqZv_BKbJX8lXU-FrqNCCVaSNejK7KkyUA5nm4jSukZfgTuTlWZSyY3IYyIdNCsiaVuA/w341-h400/img19.png&quot; title=&quot;Data for Normalization&quot; width=&quot;341&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(i) Normalization
(MinMaxScaler)&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;* X_norm = X – X_min
/ X_max – X_min&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;* Range 0 to 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;* Due to the decrease in standard deviation the effect of outliers increases.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Before
Normalization, it is recommended to handle the outliers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 from sklearn.model_selection import train_test_split  
 X = data.drop([&#39;name&#39;,&#39;purchased&#39;], axis=1)  
 y = data[&#39;purchased&#39;]  
 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) 
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 from sklearn.preprocessing import MinMaxScaler  

 Min_Max_scaler = MinMaxScaler()  
 
 Min_Max_X_train = Min_Max_scaler.fit_transform(X_train)  
 Min_Max_X_test = Min_Max_scaler.transform(X_test)  
 
 Min_Max_X_train  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSVX7euc3ub9Og4cjjefi0EWUQWBzc5bXmffYhubBAoFxKoa93i10XsbjAKH05WL7UJczaogXwPozrAdryqtMQ4yryMBuHxcjjfQPuGITUct4iDmiMSksQAuIXtl81C8z2opm7iEAVP00/s643/img20.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Min Max Scaled Train&quot; border=&quot;0&quot; data-original-height=&quot;335&quot; data-original-width=&quot;643&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSVX7euc3ub9Og4cjjefi0EWUQWBzc5bXmffYhubBAoFxKoa93i10XsbjAKH05WL7UJczaogXwPozrAdryqtMQ4yryMBuHxcjjfQPuGITUct4iDmiMSksQAuIXtl81C8z2opm7iEAVP00/w400-h209/img20.png&quot; title=&quot;Min Max Scaled Train&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  Min_Max_X_test 
  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKTBur2hi4W_fufgHscuMnxUUNA25D8Linpp4cr6yba6S99rqVSjyM0wNG2MOarOcE0pMJ8h88bYyrCYk8VNBDzQZVACPHQaw8ErlydzI0B9jxKkYrTU5OR5Xs6dbPpIxosMn0jp_OjM8/s678/img21.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Min Max Scaled Test&quot; border=&quot;0&quot; data-original-height=&quot;106&quot; data-original-width=&quot;678&quot; height=&quot;100&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKTBur2hi4W_fufgHscuMnxUUNA25D8Linpp4cr6yba6S99rqVSjyM0wNG2MOarOcE0pMJ8h88bYyrCYk8VNBDzQZVACPHQaw8ErlydzI0B9jxKkYrTU5OR5Xs6dbPpIxosMn0jp_OjM8/w640-h100/img21.png&quot; title=&quot;Min Max Scaled Test&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;background-color: white; font-family: times; font-size: x-large; text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;b&gt;(ii) Standardization
(StandardScaler)&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;*Z = X - &lt;span style=&quot;mso-tab-count: 1;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; line-height: 107%;&quot;&gt;μ / &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124;&quot;&gt;σ&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; line-height: 107%;&quot;&gt;μ = 0 and &lt;/span&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124;&quot;&gt;σ = 1 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Range -1 to 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*If the standard
deviation of feature is different, their range also would differ from each
other.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 from sklearn.preprocessing import StandardScaler  
 
 StandardScaler_scaler = StandardScaler()  
 
 StandardScaler_X_train = StandardScaler_scaler.fit_transform(X_train)  
 StandardScaler_X_test = StandardScaler_scaler.transform(X_test)  
 
 StandardScaler_X_train  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPuUza4zGVs03mGU2SsgF9893HtJLwHCUWyioPHlalA6GDnM_2dFvbzMPGhxewsgkx66ATAERR_6hY44tBD82dLrVnOtqvc72dgNFXdyB0KbM4l_OtoIZM1RniAqdeSstaHC-zcgIzK10/s695/img22.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Standard Scaler Train&quot; border=&quot;0&quot; data-original-height=&quot;345&quot; data-original-width=&quot;695&quot; height=&quot;199&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPuUza4zGVs03mGU2SsgF9893HtJLwHCUWyioPHlalA6GDnM_2dFvbzMPGhxewsgkx66ATAERR_6hY44tBD82dLrVnOtqvc72dgNFXdyB0KbM4l_OtoIZM1RniAqdeSstaHC-zcgIzK10/w400-h199/img22.png&quot; title=&quot;Standard Scaler Train&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
 
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 StandardScaler_X_test  

&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: black; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPlTST18ocIc5L1riIVMTK_5GJgAsR3zbfSsEo44ZyNDa9kcy_8lsss9oQsuzSpxKSA2tvtO0fj7niwZVUKgS76rzdVyh9cAw8DMM7AzVVJdVwBqvoy6-4SpUREvBUZ59-nHqTim648rM/s674/img23.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Standard Scaler Test&quot; border=&quot;0&quot; data-original-height=&quot;115&quot; data-original-width=&quot;674&quot; height=&quot;110&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPlTST18ocIc5L1riIVMTK_5GJgAsR3zbfSsEo44ZyNDa9kcy_8lsss9oQsuzSpxKSA2tvtO0fj7niwZVUKgS76rzdVyh9cAw8DMM7AzVVJdVwBqvoy6-4SpUREvBUZ59-nHqTim648rM/w640-h110/img23.png&quot; title=&quot;Standard Scaler Test&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: times; font-weight: normal;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: black; font-size: x-large; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-color-alt: windowtext;&quot;&gt;&lt;u&gt;&lt;i&gt;10.) Extracting
Date &lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieWyS2qjTN_5vUI1PFQ_7KxC8o3pJzMavAzPzTlzf7fJYxGIdtvJUdpjYxBZVDXpJtRIrq73FhI4c4iaG8wnwj-Lxm22aHrCyOEHtg0lo7I11EgEZaYEXAHzOy3UL0LFGXFzl0K-Czg5U/s392/extract-data-from-mdf-file.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;extract-data&quot; border=&quot;0&quot; data-original-height=&quot;266&quot; data-original-width=&quot;392&quot; height=&quot;434&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieWyS2qjTN_5vUI1PFQ_7KxC8o3pJzMavAzPzTlzf7fJYxGIdtvJUdpjYxBZVDXpJtRIrq73FhI4c4iaG8wnwj-Lxm22aHrCyOEHtg0lo7I11EgEZaYEXAHzOy3UL0LFGXFzl0K-Czg5U/w640-h434/extract-data-from-mdf-file.png&quot; title=&quot;extract-data&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;There are 3 ways we can preprocessing
date&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Extracting the parts of the date
into the different columns: YEAR, MONTH, DAY.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Extracting the time period between
the current date and column in terms of YEAR, MONTH, DAY.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*Extracting some specific features
from the date such as the name of the weekday, weekend, etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background: white none repeat scroll 0% 0%; color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;*With dealing with date features
like that our machine learning model can easily understand data and deal with
the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 from datetime import date  
 data = pd.DataFrame({  
   &#39;date&#39;: [&#39;01/01/2017&#39;, &#39;04/12/2000&#39;, &#39;23/04/2011&#39;, &#39;11/02/2008&#39;, &#39;08/08/2018&#39;]  
 })  
 
 data
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD6u0sP4sMMaL4l1l_uLB7E_GiSurfrCMjsUd4l10coD3Mmj_UZltRPgw8nfZ1ErM63isGjCiy5o3_vPGpIk0F_gnSlPiZrFGFP0EQJIXcdaKMYdbnNi24VvwbGyhRTi8db4Ntn8vLcDo/s354/img24.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Time series data&quot; border=&quot;0&quot; data-original-height=&quot;354&quot; data-original-width=&quot;221&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD6u0sP4sMMaL4l1l_uLB7E_GiSurfrCMjsUd4l10coD3Mmj_UZltRPgw8nfZ1ErM63isGjCiy5o3_vPGpIk0F_gnSlPiZrFGFP0EQJIXcdaKMYdbnNi24VvwbGyhRTi8db4Ntn8vLcDo/w200-h320/img24.png&quot; title=&quot;Time series data&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  data.info()
  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsKVI1IX-ODHDKNEyOpDLfztC3GG030KduYRwunhublGfQ1Kzd6y4HN8lLmXTtXBbugMrQuMkcFhcXSkDAbDKTAFgG4VcwTZ3RVM_b2h3MwMsviIiRvf6050sD4rDbnCJNjnI2DngRZZ4/s736/img24_1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Time series data info&quot; border=&quot;0&quot; data-original-height=&quot;348&quot; data-original-width=&quot;736&quot; height=&quot;189&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsKVI1IX-ODHDKNEyOpDLfztC3GG030KduYRwunhublGfQ1Kzd6y4HN8lLmXTtXBbugMrQuMkcFhcXSkDAbDKTAFgG4VcwTZ3RVM_b2h3MwMsviIiRvf6050sD4rDbnCJNjnI2DngRZZ4/w400-h189/img24_1.png&quot; title=&quot;Time series data info&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Transform String to Date  
 
 data[&#39;date&#39;] = pd.to_datetime(data.date, format=&#39;%d/%m/%Y&#39;)  
 data.info()
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin4n3l9rY9TJF85h3TtbboZpthX9UXquQcqE2SZQWZZ8LPrNBmHniGg1LPWSFPKXgyTI3lExg1pL4GwogkNlHLWulNPD8QUAmzQIqWHf0kwJc7op1epyHeMr7saIyXcNcmaVRw01eMZuQ/s867/img24_2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Transforming string to date&quot; border=&quot;0&quot; data-original-height=&quot;362&quot; data-original-width=&quot;867&quot; height=&quot;168&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin4n3l9rY9TJF85h3TtbboZpthX9UXquQcqE2SZQWZZ8LPrNBmHniGg1LPWSFPKXgyTI3lExg1pL4GwogkNlHLWulNPD8QUAmzQIqWHf0kwJc7op1epyHeMr7saIyXcNcmaVRw01eMZuQ/w400-h168/img24_2.png&quot; title=&quot;Transforming string to date&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # Extracat year  
 
 data[&#39;year&#39;] = data[&#39;date&#39;].dt.year  
 data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHYMscV8BTofgWLfdFRjk7WoD1wYwhD9VzKRgEntZJa9jw4OlyD1lb3Sk9Z3clWjeYC_IDdbbImj2ZHFHolA5vj4pboeQUs-OHGSpk3VTHGJrlrYB33uKkjXLYr3E6EJNSyzGRb-QMo2Y/s441/img24_3.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Year extraction&quot; border=&quot;0&quot; data-original-height=&quot;366&quot; data-original-width=&quot;441&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHYMscV8BTofgWLfdFRjk7WoD1wYwhD9VzKRgEntZJa9jw4OlyD1lb3Sk9Z3clWjeYC_IDdbbImj2ZHFHolA5vj4pboeQUs-OHGSpk3VTHGJrlrYB33uKkjXLYr3E6EJNSyzGRb-QMo2Y/w320-h266/img24_3.png&quot; title=&quot;Year extraction&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Extract month  
 
 data[&#39;month&#39;] = data[&#39;date&#39;].dt.month  
 data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD88UhKy0oRLCJFFFmdawtjsLs-ZjcZtLglAA0RjTyuJqfP6e7FHKsOb_h8fbc-eI4nRxU4GrV2yhMqV67S5vSL1XWJBlmOvo2_aymquS7t-Mk5Qq1zujM2n9koW6mJDCyrVC06FtBu9Y/s444/img24_4.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Month extraction&quot; border=&quot;0&quot; data-original-height=&quot;350&quot; data-original-width=&quot;444&quot; height=&quot;252&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD88UhKy0oRLCJFFFmdawtjsLs-ZjcZtLglAA0RjTyuJqfP6e7FHKsOb_h8fbc-eI4nRxU4GrV2yhMqV67S5vSL1XWJBlmOvo2_aymquS7t-Mk5Qq1zujM2n9koW6mJDCyrVC06FtBu9Y/w320-h252/img24_4.png&quot; title=&quot;Month extraction&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
 # Extract day  
 
 data[&#39;day&#39;] = data[&#39;date&#39;].dt.day  
 data
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc8N9UIGFTLJCUC19TqakRjJirr4X7Ve9odv-dp3cic1lVJAb-bj32hd-LuOl48ZusA0F3u6PKhPKKovUXfrXufHY_EATAsyfA2ZuiX6WLh3EmRMR1mpNwVi6zxiBgp7n2EkybezPlSHU/s518/img24_5.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Day extraction&quot; border=&quot;0&quot; data-original-height=&quot;356&quot; data-original-width=&quot;518&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc8N9UIGFTLJCUC19TqakRjJirr4X7Ve9odv-dp3cic1lVJAb-bj32hd-LuOl48ZusA0F3u6PKhPKKovUXfrXufHY_EATAsyfA2ZuiX6WLh3EmRMR1mpNwVi6zxiBgp7n2EkybezPlSHU/w320-h220/img24_5.png&quot; title=&quot;Day extraction&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # Extracting passed year since the date   
 
 data[&#39;passed_years&#39;] = date.today().year - data[&#39;date&#39;].dt.year  
 data
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggITjuwL0JzQV_5IoY4T9OOMqKZ_Ea1ZllTSMtYiM_2mMnNMVH-z40p-ugDCRZMRHFAqlSbnhUuxy_s1AdvvkQDkaqvbYyE7LkqXHmnDhCg_UT8mbNoOKTr_FSzWAmopvuRudfJyvG1JA/s741/img24_6.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Passed Year&quot; border=&quot;0&quot; data-original-height=&quot;374&quot; data-original-width=&quot;741&quot; height=&quot;203&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggITjuwL0JzQV_5IoY4T9OOMqKZ_Ea1ZllTSMtYiM_2mMnNMVH-z40p-ugDCRZMRHFAqlSbnhUuxy_s1AdvvkQDkaqvbYyE7LkqXHmnDhCg_UT8mbNoOKTr_FSzWAmopvuRudfJyvG1JA/w400-h203/img24_6.png&quot; title=&quot;Passed Year&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 16px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
 # Extracting passed month since the date   
 
 data[&#39;passed_months&#39;] = (date.today().year - data[&#39;date&#39;].dt.year)*12 + (date.today().month - data[&#39;date&#39;].dt.month)  
 data  
 
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #202124; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;
  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiewyhIKLGCj-Ut3wTYMznS1Y2o6hzx5gPBEhnKHj_d2toP2WIoeJBBdOv5cgmBcEG1AunzviP77NvrVzyhn6bwKiY3yNZiJD_Av5cWciJu0pe9sUc1abYw3HtkO4eaORUgCn_va_xZLQ/s1001/img24_7.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Extracting passed month since the date&quot; border=&quot;0&quot; data-original-height=&quot;371&quot; data-original-width=&quot;1001&quot; height=&quot;149&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiewyhIKLGCj-Ut3wTYMznS1Y2o6hzx5gPBEhnKHj_d2toP2WIoeJBBdOv5cgmBcEG1AunzviP77NvrVzyhn6bwKiY3yNZiJD_Av5cWciJu0pe9sUc1abYw3HtkO4eaORUgCn_va_xZLQ/w400-h149/img24_7.png&quot; title=&quot;Extracting passed month since the date&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: white; color: #202124; font-family: times; font-size: x-large;&quot;&gt;&amp;nbsp;Here is the Github link of all the code which is mentioned here:&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: white; color: #202124; font-family: times; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: white; color: #202124; font-family: times; font-size: x-large;&quot;&gt;Github Link of the Notebook: &lt;a href=&quot;https://github.com/Vegadhardik7/MY_PROJECTS/blob/master/Projects/Best%20Techniques%20of%20Feature%20Engineering.ipynb&quot; target=&quot;_blank&quot;&gt;Link&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: white; color: #202124; font-family: times; font-size: x-large;&quot;&gt;Use all the tips and tricks which are mentioned above and you will surely get amazing data to train your model on.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;So we hope that you enjoyed this session. If you did then please share it with your friends and spread this knowledge.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: large;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Facebook :&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Twitter :&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/5956088854207052951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/12/top-10-jutsus-of-feature-engineering.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5956088854207052951'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5956088854207052951'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/12/top-10-jutsus-of-feature-engineering.html' title='TOP 10 JUTSUS OF FEATURE ENGINEERING EVERY DATA SCIENTISTS NINJA SHOULD KNOW RIGHT NOW'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkeAS8pnyrPEPQ437Fy9ifAQNdQmPqkb3G02i6iS8yod0o6DAo8AUJh_47Kj0PQcpxam_xqSBdAWoOzL121Q3xn24s1nZHlYHR5kokOD42DXfO6brXb7Mq8K9kOecKJ5ZSYCrHBiEMQYY/s72-c/thisisengineering-raeng-WDCE0T4khsE-unsplash.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-6328192996593988924</id><published>2020-10-26T16:54:00.010+05:30</published><updated>2023-08-22T19:54:44.855+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>Unable to render code block error in Github Solution</title><content type='html'>&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 25pt; line-height: 107%;&quot;&gt;&lt;u&gt;Unable to render code block&lt;/u&gt;&lt;b&gt;&lt;u&gt;&amp;nbsp;Github Error for
.ipynb Solution&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGn1kKcfmgmECQ-wjmSpXX0VZkMSE5I8O9L0hX6d4kcZdwy4n5LJYj8Zd7Xke_iKSvlPkz7qiUFzEm2CGBSmrCVwKxfRcSwA4sX6Mo3ea0wz34jWLtPu5pTkxuwndnhcfBP3j0jCEx1l4/s1920/mistake-3085712_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Sorry, something went wrong. Reload? Error in Github Solution&quot; border=&quot;0&quot; data-original-height=&quot;1297&quot; data-original-width=&quot;1920&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGn1kKcfmgmECQ-wjmSpXX0VZkMSE5I8O9L0hX6d4kcZdwy4n5LJYj8Zd7Xke_iKSvlPkz7qiUFzEm2CGBSmrCVwKxfRcSwA4sX6Mo3ea0wz34jWLtPu5pTkxuwndnhcfBP3j0jCEx1l4/s16000/mistake-3085712_1920.jpg&quot; title=&quot;Sorry, something went wrong. Reload? Error in Github Solution&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;I am sure most of you Data science enthusiasts are facing
this kind of error while you open your any .ipynb on GitHub via a link.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhSNY5uPVUIU0srq8LPE69d2fo4Jzi9vW-MQpEtrE1Z4PawdXHdsCxQmj7V2DYn3u2Wc3vlRty2R7DiWiImGQ-ptXpRvJpZNnhGAphYWUlXACo31Qpqn4pigC9wTIXwNq5qzHDwtBWYGQ/s1536/ipynb_error.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Sorry, something went wrong. Reload?&quot; border=&quot;0&quot; data-original-height=&quot;149&quot; data-original-width=&quot;1536&quot; height=&quot;62&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhSNY5uPVUIU0srq8LPE69d2fo4Jzi9vW-MQpEtrE1Z4PawdXHdsCxQmj7V2DYn3u2Wc3vlRty2R7DiWiImGQ-ptXpRvJpZNnhGAphYWUlXACo31Qpqn4pigC9wTIXwNq5qzHDwtBWYGQ/w640-h62/ipynb_error.png&quot; title=&quot;Sorry, something went wrong. Reload?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;Today I’m going to give you a very simple solution to
fix this issue... No, it’s not to keep clicking on the reload button.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;b&gt;Step 1&lt;/b&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;First, go to your .ipynb file which is showing an error
and copy the URL of that .ipynb file.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFhTQ2ascQfkbMEL1MkyaK0dKUV6pcN4LCQ-m2j1F7JAePjLxatlmfv-soZAg1gJlrgom2rmpCgIUogW7Ko1xhx8Js7nUNcVyEwsxdFJ0dxvolac_6CEw09_IyjkY4-h1Vysi7aCG8v-c/s1920/step_1_errorWord.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;copy url&quot; border=&quot;0&quot; data-original-height=&quot;972&quot; data-original-width=&quot;1920&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFhTQ2ascQfkbMEL1MkyaK0dKUV6pcN4LCQ-m2j1F7JAePjLxatlmfv-soZAg1gJlrgom2rmpCgIUogW7Ko1xhx8Js7nUNcVyEwsxdFJ0dxvolac_6CEw09_IyjkY4-h1Vysi7aCG8v-c/w640-h324/step_1_errorWord.png&quot; title=&quot;copy url&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;&lt;b&gt;Step 2&lt;/b&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;Visit the following link:-&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://nbviewer.jupyter.org/&quot; target=&quot;_blank&quot;&gt;https://nbviewer.jupyter.org/&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMX5jzwQT2mL4kW7WKQSEzeGzCTo9nPZqnbXf5OMNiCI5ySpwEbOY5VmgKotHJ0Da0k0ZJtDO0I7r4tCPlAeMO_Xzojfz-q3dNxgPP7fjNahlBjuJveoWO2Y4fIp9nqb7PBZCdtaiCaHE/s1795/step2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Visit nbviewer&quot; border=&quot;0&quot; data-original-height=&quot;952&quot; data-original-width=&quot;1795&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMX5jzwQT2mL4kW7WKQSEzeGzCTo9nPZqnbXf5OMNiCI5ySpwEbOY5VmgKotHJ0Da0k0ZJtDO0I7r4tCPlAeMO_Xzojfz-q3dNxgPP7fjNahlBjuJveoWO2Y4fIp9nqb7PBZCdtaiCaHE/w640-h340/step2.png&quot; title=&quot;Visit nbviewer&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;b&gt;Step 3&lt;/b&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;Paste your copied link and hit enter.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg04_XELVevaaBNJwjI0VS9sM9DvpkpJqlFyFeNOvv_cvhWj8-zdF2Z9McIrKsklHF4RMHscVXewo__hTS-lv5OgSTJnuEq0lfN8_820QGp8DBew-bTPbXWCkory7k92nPtdB8RHc7plrY/s1754/step3.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Paste link in nbviewer&quot; border=&quot;0&quot; data-original-height=&quot;952&quot; data-original-width=&quot;1754&quot; height=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg04_XELVevaaBNJwjI0VS9sM9DvpkpJqlFyFeNOvv_cvhWj8-zdF2Z9McIrKsklHF4RMHscVXewo__hTS-lv5OgSTJnuEq0lfN8_820QGp8DBew-bTPbXWCkory7k92nPtdB8RHc7plrY/w640-h348/step3.png&quot; title=&quot;Paste link in nbviewer&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;b&gt;Result&lt;/b&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSKFCUc55eraF1NH5qyhOUC6M_qHdQfwYKyvK0e0lRMAokdXKPAid1Pq_WITQqfkLyLmteHd5bYtfDIBMZTJUY1655AufgMzEfzOxBAS0wAfEz1PeMorRjkg9HlXG0I4lOeRScTvjYrFU/s1899/2020-10-26+16_46_15-Jupyter+Notebook+Viewer.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Final result&quot; border=&quot;0&quot; data-original-height=&quot;910&quot; data-original-width=&quot;1899&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSKFCUc55eraF1NH5qyhOUC6M_qHdQfwYKyvK0e0lRMAokdXKPAid1Pq_WITQqfkLyLmteHd5bYtfDIBMZTJUY1655AufgMzEfzOxBAS0wAfEz1PeMorRjkg9HlXG0I4lOeRScTvjYrFU/w640-h306/2020-10-26+16_46_15-Jupyter+Notebook+Viewer.png&quot; title=&quot;Final result&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;I hope this helped you. If it did then please share it with your friends and spread this knowledge.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;https://www.instagram.com/infinitycode_x/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: times new roman, serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/6328192996593988924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/10/sorry-something-went-wrong-reload-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/6328192996593988924'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/6328192996593988924'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/10/sorry-something-went-wrong-reload-error.html' title='Unable to render code block error in Github Solution'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGn1kKcfmgmECQ-wjmSpXX0VZkMSE5I8O9L0hX6d4kcZdwy4n5LJYj8Zd7Xke_iKSvlPkz7qiUFzEm2CGBSmrCVwKxfRcSwA4sX6Mo3ea0wz34jWLtPu5pTkxuwndnhcfBP3j0jCEx1l4/s72-c/mistake-3085712_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-2441868407218695677</id><published>2020-10-14T11:49:00.003+05:30</published><updated>2020-12-02T16:23:58.549+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>Heart Disease Prediction End to End  Machine Learning Project (Interface Creation)</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 30pt; line-height: 107%;&quot;&gt;Heart
Disease Prediction End to End&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 30pt; line-height: 107%;&quot;&gt;&amp;nbsp;Machine Learning Project&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;

&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(&lt;u&gt;Interface
Creation&lt;/u&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 23pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 23pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYUxNfjN0Is81H_mtgdzPIcFBNdtMBhqguR10IzUhUHqR3Ky8LAq6RhK3Tmo44IWN3vwHleeKsyDKXe7QzpY8NEZm48-rNuG8vQ0okaMZda7ITETOzBhikxsohAauFMHaySpEsLav3WFg/s1622/2020-10-14+11_44_51-Heart+Disease+Prediction.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;FINAL RESULT&quot; border=&quot;0&quot; data-original-height=&quot;1622&quot; data-original-width=&quot;1067&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYUxNfjN0Is81H_mtgdzPIcFBNdtMBhqguR10IzUhUHqR3Ky8LAq6RhK3Tmo44IWN3vwHleeKsyDKXe7QzpY8NEZm48-rNuG8vQ0okaMZda7ITETOzBhikxsohAauFMHaySpEsLav3WFg/s16000/2020-10-14+11_44_51-Heart+Disease+Prediction.png&quot; title=&quot;FINAL RESULT&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 23pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;span&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;b&gt;Part2:&lt;/b&gt; &lt;u&gt;Creating a Web Interface for our Machine
Learning Model&lt;/u&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;In this part, we are going to create a simple web
application using HTML and CSS which will make our model more interactive with the
user.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 16pt;&quot;&gt;If you haven’t checked our Part1 where we had created
our machine learning model to predict heart disease, I will highly recommend
you to check that part and then dive into this.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;b&gt;Part1: &lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;background-color: #fcff01; font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/heart-disease-prediction-end-to-end&quot; target=&quot;_blank&quot;&gt;Heart
Disease Prediction End to End&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Machine
Learning Project&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/heart-disease-prediction-end-to-end&quot; style=&quot;background-color: #fcff01;&quot; target=&quot;_blank&quot;&gt;(Model Creation)&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
  &lt;b&gt;Here is the app.py code:&lt;/b&gt;
  &lt;/span&gt;&lt;/p&gt;

&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 14.5px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; from flask import Flask, request, render_template  
 import joblib  
 import sklearn  
 import pickle, gzip  
 import pandas as pd  
 import numpy as np  
 app = Flask(__name__)  
 model = joblib.load(&#39;Heart_Disease_Prediction.pkl&#39;)  
 @app.route(&#39;/&#39;)  
 def home():  
   return render_template(&quot;home.html&quot;)  
 @app.route(&quot;/predict&quot;, methods=[&quot;POST&quot;])  
 def predict():  
   age = request.form[&quot;age&quot;]  
   sex = request.form[&quot;sex&quot;]  
   trestbps = request.form[&quot;trestbps&quot;]  
   chol = request.form[&quot;chol&quot;]  
   oldpeak = request.form[&quot;oldpeak&quot;]  
   thalach = request.form[&quot;thalach&quot;]  
   fbs = request.form[&quot;fbs&quot;]  
   exang = request.form[&quot;exang&quot;]  
   slope = request.form[&quot;slope&quot;]  
   cp = request.form[&quot;cp&quot;]  
   thal = request.form[&quot;thal&quot;]  
   ca = request.form[&quot;ca&quot;]  
   restecg = request.form[&quot;restecg&quot;]  
   arr = np.array([[age, sex, cp, trestbps,  
            chol, fbs, restecg, thalach,  
            exang, oldpeak, slope, ca,  
            thal]])  
   pred = model.predict(arr)  
   if pred == 0:  
     res_val = &quot;NO HEART PROBLEM&quot;  
   else:  
     res_val = &quot;HEART PROBLEM&quot;  
   return render_template(&#39;home.html&#39;, prediction_text=&#39;PATIENT HAS {}&#39;.format(res_val))  
 if __name__ == &quot;__main__&quot;:  
   app.run(debug=True)  
&lt;/code&gt;&lt;/pre&gt;


&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
  &lt;b&gt;Here is the HTML &amp;amp; CSS code:&lt;/b&gt;
  &lt;/span&gt;&lt;/p&gt;

&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSik_Fivv5IdVjk15d53dPGa7q069NrHkojTIrZZkNrw8uHgdqyoiFFuUijFcX2fKr4CppBtgqHBSCZ6MZgGOXeiF3jmvFbFE7cIDe9415ys6w7oJSmG7ttGaamoNxHIY3ksBWTy7OCGKa/s320/codebg.gif); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 14.5px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; &amp;lt;html lang=&quot;en&quot;&amp;gt;  
 &amp;lt;head&amp;gt;  
   &amp;lt;meta charset=&quot;UTF-8&quot;&amp;gt;  
   &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&amp;gt;  
   &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&amp;gt;  
 &amp;lt;!--  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&amp;gt;--&amp;gt;  
   &amp;lt;title&amp;gt;Heart Disease Prediction&amp;lt;/title&amp;gt;  
 &amp;lt;/head&amp;gt;  
 &amp;lt;style&amp;gt;  
   @import url(&#39;https://fonts.googleapis.com/css2?family=Montserrat:wght@500&amp;amp;display=swap&#39;);  
 *{  
   margin: 0;  
   padding: 0;  
   box-sizing: border-box;  
   font-family: &#39;Montserrat&#39;, sans-serif;  
   color:black;  
 }  
 body{  
   background: url(&quot;https://cdn.pixabay.com/photo/2016/08/10/20/26/stethoscope-1584223_1280.jpg&quot;) no-repeat top center;  
   padding: 0 10px;  
   background-size: cover;  
 }  
 .wrapper{  
   max-width: 500px;  
   width: 100%;  
   background: rgba(0, 0, 0, 0.7);  
   margin: 20px auto;  
   padding: 30px;  
   box-shadow: 1px 1px 2px rgba(0, 0, 0, 1.25);  
 }  
 .wrapper .title{  
   font-size: 24px;  
   font-weight: 700;  
   margin-bottom: 25px;  
   color: #fec107;  
   text-transform: uppercase;  
   text-align: center;  
 }  
 .wrapper .form{  
   width: 100%;  
 }  
 .wrapper .form .input_field{  
   margin-bottom: 15px;  
   display: flex;  
   align-items: center;  
 }  
 .wrapper .form .input_field label{  
   width:80px;  
   font: bold;  
   color: wheat;  
   margin-right: 10px;  
   font-size: 14px;  
 }  
 .wrapper .form .input_field input{  
   width: 100px;  
 }  
 .wrapper .form .input_field .textarea{  
   resize: none;  
   height: 250px;  
   width: 500px;  
 }  
 &amp;lt;/style&amp;gt;  
 &amp;lt;body&amp;gt;  
 &amp;lt;form action=&quot;{{ url_for(&#39;predict&#39;)}}&quot; method=&quot;post&quot;&amp;gt;  
   &amp;lt;div class=&quot;wrapper&quot;&amp;gt;  
     &amp;lt;div class=&quot;title&quot;&amp;gt;  
       &amp;lt;h1 style=&quot;color: white;&quot;&amp;gt;Heart Disease Prediction&amp;lt;/h1&amp;gt;  
     &amp;lt;/div&amp;gt;  
     &amp;lt;div class=&quot;form&quot;&amp;gt;  
       &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;textarea style=&quot;color: white; background: rgba(0, 0, 0, 0.3);&quot; class=&quot;textarea&quot; readonly&amp;gt;  
 It&#39;s a clean, easy to understand set of data. However, the meaning of some of the column headers are not obvious. Here&#39;s what they mean,  
 Age: displays the age of the individual.  
 Sex: displays the gender of the individual using the following format :  
 1 = male  
 0 = female  
 Chest-pain type: displays the type of chest-pain experienced by the individual using the following format :  
 0 = typical angina  
 1 = atypical angina  
 2 = non — anginal pain  
 3 = asymptotic  
 Resting Blood Pressure: displays the resting blood pressure value of an individual in mmHg (unit)  
 Serum Cholestrol: displays the serum cholesterol in mg/dl (unit)  
 Fasting Blood Sugar: compares the fasting blood sugar value of an individual with 120mg/dl.  
 If fasting blood sugar &amp;gt; 120mg/dl then : 1 (true) else : 0 (false)  
 Resting ECG : displays resting electrocardiographic results  
 0 = normal  
 1 = having ST-T wave abnormality  
 2 = left ventricular hyperthrophy  
 Max heart rate achieved : displays the max heart rate achieved by an individual.  
 Exercise induced angina :  
 1 = yes  
 0 = no  
 ST depression induced by exercise relative to rest: displays the value which is an integer or float.  
 Peak exercise ST segment :  
 1 = upsloping  
 2 = flat  
 3 = downsloping  
 Number of major vessels (0–3) colored by flourosopy : displays the value as integer or float.  
 Thal : displays the thalassemia :  
 0 = normal  
 1 = fixed defect  
 2 = reversible defect  
 Diagnosis of heart disease : Displays whether the individual is suffering from heart disease or not :  
 0 = absence  
 1, 2, 3, 4 = present.  
           &amp;lt;/textarea&amp;gt;  
        &amp;lt;/div&amp;gt;  
       &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;AGE&amp;lt;/label&amp;gt;  
         &amp;lt;input type=&quot;number&quot; id=&quot;age&quot; min=&quot;0&quot; max=&quot;150&quot; name=&quot;age&quot; class=&quot;input_text&quot;&amp;gt;  
         &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Age: 1 - 150)&amp;lt;/i&amp;gt;  
       &amp;lt;/div&amp;gt;  
       &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;SEX&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; min=&quot;0&quot; max=&quot;1&quot; name=&quot;sex&quot; id=&quot;sex&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Male: 1 &amp;amp; Female: 0)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;CP&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; name=&quot;cp&quot; id=&quot;cp&quot; min=&quot;0&quot; max=&quot;3&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Single Value From Range 0-3)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;TRESTBPS&amp;lt;/label&amp;gt;  
          &amp;lt;input name=&quot;trestbps&quot; id=&quot;trestbps&quot; type=&quot;number&quot; min=&quot;0&quot; step=&quot;1&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Non-Decimal Value)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;CHOL&amp;lt;/label&amp;gt;  
          &amp;lt;input name=&quot;chol&quot; id=&quot;chol&quot; type=&quot;number&quot; min=&quot;0&quot; step=&quot;1&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Non-Decimal Value)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;FBS&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; min=&quot;0&quot; max=&quot;1&quot; name=&quot;fbs&quot; id=&quot;fbs&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(1 = True; 0 = False)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;RESTECG&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; name=&quot;restecg&quot; min=&quot;0&quot; max=&quot;2&quot; id=&quot;restecg&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Single Value From Range 0-2)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;THALACH&amp;lt;/label&amp;gt;  
          &amp;lt;input name=&quot;thalach&quot; id=&quot;thalach&quot; type=&quot;number&quot; min=&quot;0&quot; step=&quot;1&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Non-Decimal Value)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;EXANG&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; min=&quot;0&quot; max=&quot;1&quot; name=&quot;exang&quot; id=&quot;exang&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Exercise: 1 = YES; 0 = NO)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;OLDPEAK&amp;lt;/label&amp;gt;  
          &amp;lt;input name=&quot;oldpeak&quot; id=&quot;oldpeak&quot; type=&quot;number&quot; min=&quot;0&quot; step=&quot;0.01&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Decimal Value)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;SLOPE&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; min=&quot;0&quot; max=&quot;2&quot; name=&quot;slope&quot; id=&quot;slope&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Single Value From Range 0-2)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;CA&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; name=&quot;ca&quot; min=&quot;0&quot; max=&quot;4&quot; id=&quot;ca&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Single Value From Range 0-4)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;label&amp;gt;THAL&amp;lt;/label&amp;gt;  
          &amp;lt;input type=&quot;number&quot; name=&quot;thal&quot; min=&quot;0&quot; max=&quot;3&quot; id=&quot;thal&quot; class=&quot;input_text&quot;&amp;gt;  
          &amp;lt;br&amp;gt;&amp;nbsp;&amp;nbsp;&amp;lt;i style=&quot;font-size: 10px; color: white;&quot;&amp;gt;(Enter Single Value From Range 0-3)&amp;lt;/i&amp;gt;  
        &amp;lt;/div&amp;gt;  
        &amp;lt;div class=&quot;input_field&quot;&amp;gt;  
         &amp;lt;input type=&quot;submit&quot; style=&quot;color:black; background: skyblue;&quot; id=&quot;submit&quot; value=&quot;SUBMIT&quot;&amp;gt;  
       &amp;lt;/div&amp;gt;  
       &amp;lt;div&amp;gt;  
         &amp;lt;center&amp;gt;  
           &amp;lt;h2 style=&quot;color: white; margin-bottom:10px;&quot;&amp;gt;  
             {{prediction_text}}  
           &amp;lt;/h2&amp;gt;  
         &amp;lt;/center&amp;gt;  
       &amp;lt;/div&amp;gt;  
     &amp;lt;/div&amp;gt;  
   &amp;lt;/div&amp;gt;  
 &amp;lt;/form&amp;gt;  
 &amp;lt;/body&amp;gt;  
 &amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;


&lt;br /&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
  Go to the visual code or notepad and create an HTML file name as &lt;b&gt;home.html&lt;/b&gt; then paste this above code into it.
  &lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
  Create a new file named requirements.txt and paste the below text into that file.
  &lt;/span&gt;&lt;/p&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
Flask==1.1.2&lt;br /&gt;
pandas==1.0.4&lt;br /&gt;
numpy==1.18.4&lt;br /&gt;
joblib==0.15.1&lt;br /&gt;
scikit_learn==0.23.2&lt;br /&gt;
gunicorn==20.0.4&lt;br /&gt;
Werkzeug==0.16.0&lt;br /&gt;
Jinja2==2.10.1&lt;br /&gt;
itsdangerous==1.1.0&lt;br /&gt;
MarkupSafe==1.1.1
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
  Go to your jupyter notebook folder and create a file and put the below text in that file and remember &lt;b&gt;DO NOT PUT ANY EXTENSIONS TO THAT FILE LIKE .txt, .css,...&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
web: gunicorn app: app
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 16pt; line-height: 107%;&quot;&gt;
Now we are can bring all the files together and save them to the same location, create a git repository, and push that file into that repositories. Now create an account in Heroku and launch our we application.
  &lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;

&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Facebook :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Twitter :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;












</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/2441868407218695677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/10/heart-disease-prediction-end-to-end_14.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/2441868407218695677'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/2441868407218695677'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/10/heart-disease-prediction-end-to-end_14.html' title='Heart Disease Prediction End to End  Machine Learning Project (Interface Creation)'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYUxNfjN0Is81H_mtgdzPIcFBNdtMBhqguR10IzUhUHqR3Ky8LAq6RhK3Tmo44IWN3vwHleeKsyDKXe7QzpY8NEZm48-rNuG8vQ0okaMZda7ITETOzBhikxsohAauFMHaySpEsLav3WFg/s72-c/2020-10-14+11_44_51-Heart+Disease+Prediction.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-3230642177814940153</id><published>2020-10-13T17:49:00.009+05:30</published><updated>2020-10-16T17:11:29.900+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Heart Disease Prediction End to End Machine Learning Project (Model Creation)</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;br /&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 30pt; line-height: 107%;&quot;&gt;Heart
Disease Prediction End to End&amp;nbsp;&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 30pt; line-height: 107%;&quot;&gt;Machine Learning Project&amp;nbsp;&lt;/span&gt;&lt;/u&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman, serif; font-size: large;&quot;&gt;&lt;u&gt;(Model Creation)&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-YI1dSeOAXwgAV9SjgpYZdddfL94GmT66oy0P-fO7qHNUB7_hq2UcgjqvKlQuxcuxnWi10EGYu3LwVhpgk2EbtzCUakICXUInllTV80cao9f8QV3nKbF6s9DTFpCIcw2gqmt0G4Psjyk/s1920/hand-2308932_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;HEART&quot; border=&quot;0&quot; data-original-height=&quot;1278&quot; data-original-width=&quot;1920&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-YI1dSeOAXwgAV9SjgpYZdddfL94GmT66oy0P-fO7qHNUB7_hq2UcgjqvKlQuxcuxnWi10EGYu3LwVhpgk2EbtzCUakICXUInllTV80cao9f8QV3nKbF6s9DTFpCIcw2gqmt0G4Psjyk/s16000/hand-2308932_1920.jpg&quot; title=&quot;HEART&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;span&gt;&lt;/span&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;o:p&gt;&lt;span&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 20pt; line-height: 107%;&quot;&gt;Part1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 20pt; line-height: 107%;&quot;&gt;: &lt;u style=&quot;text-underline: double;&quot;&gt;Creating a Machine Learning Model&lt;/u&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: large;&quot;&gt;In this part we are going to write a code to create a machine-learning model which will help us to predict is that person is
suffering from heart disease or not.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: large;&quot;&gt;Data Set For Heart Disease Prediction Project: &lt;span style=&quot;background-color: #fcff01;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;a href=&quot;https://drive.google.com/uc?export=download&amp;amp;id=1981Ps7yNYE5rb_LToKxQmu744bPOo_6X&quot; target=&quot;_blank&quot;&gt;DATASET&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 25.68px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 25.68px;&quot;&gt;Requirements:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 25.68px;&quot;&gt;&amp;nbsp;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Python &amp;gt;= 3.6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; line-height: 17.12px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;Jupyter Notebook&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;
  
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
  
It&#39;s a clean, easy to understand set of data. However, the meaning of some of the column headers is not obvious. Here&#39;s what they mean,
&lt;br /&gt;&lt;br /&gt;
1.age: The person&#39;s age in years
&lt;br /&gt;&lt;br /&gt;
2.sex: The person&#39;s sex (1 = male, 0 = female)
&lt;br /&gt;&lt;br /&gt;
3.cp: The chest pain experienced (Value 1: typical angina, Value 2: atypical angina, Value 3: non-anginal pain, Value 4: asymptomatic)
&lt;br /&gt;&lt;br /&gt;
4.trestbps: The person&#39;s resting blood pressure (mm Hg on admission to the hospital)
&lt;br /&gt;&lt;br /&gt;
5.chol: The person&#39;s cholesterol measurement in mg/dl
&lt;br /&gt;&lt;br /&gt;
6.fbs: The person&#39;s fasting blood sugar (&amp;gt; 120 mg/dl, 1 = true; 0 = false)
&lt;br /&gt;&lt;br /&gt;
7.restecg: Resting electrocardiographic measurement (0 = normal, 1 = having ST-T wave abnormality, 2 = showing probable or definite left ventricular hypertrophy by Estes&#39; criteria)
&lt;br /&gt;&lt;br /&gt;
8.thalach: The person&#39;s maximum heart rate achieved
&lt;br /&gt;&lt;br /&gt;
9.exang: Exercise-induced angina (1 = yes; 0 = no)
&lt;br /&gt;&lt;br /&gt;
10.oldpeak: ST depression induced by exercise relative to rest (&#39;ST&#39; relates to positions on the ECG plot. See more here)
&lt;br /&gt;&lt;br /&gt;
11.slope: the slope of the peak exercise ST segment (Value 1: upsloping, Value 2: flat, Value 3: downsloping)
&lt;br /&gt;&lt;br /&gt;
12.ca: The number of major vessels (0-3)
&lt;br /&gt;&lt;br /&gt;
13.thal: A blood disorder called thalassemia (3 = normal; 6 = fixed defect; 7 = reversable defect)
&lt;br /&gt;&lt;br /&gt;
14.target: Heart disease (0 = no, 1 = yes)

&lt;/span&gt;  
  
  &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: large;&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;  
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 14pt;&quot;&gt;# Importing Essential Libraries&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
import pandas as pd&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
import seaborn as sns&lt;br /&gt;
%matplotlib inline
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# calling our CSV file (Your Dataset should be of CSV format)&lt;br /&gt;
# To create your CSV file go to Excel file and save as CSV : Ctrl + S  } Format==&amp;gt;CSV&lt;br /&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
data = pd.read_csv(&quot;D:\corona\heart_Disease\heart.csv&quot;)&lt;br /&gt;
data.head()
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh33NJ728um_Ot0cq_gF-mxnjWZGcHvvJSDhMBAlVfpSYHA7ikF5H43kx9cv1rygmsyaQwUtDKTxQ94wXfeOWvkjUioFq19xVwJmCex1PB_JOdsl3FZo7w2_e2-fkMu8cKMZ4VdMobPk7g/s770/head.png&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;HEAD&quot; border=&quot;0&quot; data-original-height=&quot;215&quot; data-original-width=&quot;770&quot; height=&quot;179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh33NJ728um_Ot0cq_gF-mxnjWZGcHvvJSDhMBAlVfpSYHA7ikF5H43kx9cv1rygmsyaQwUtDKTxQ94wXfeOWvkjUioFq19xVwJmCex1PB_JOdsl3FZo7w2_e2-fkMu8cKMZ4VdMobPk7g/w640-h179/head.png&quot; title=&quot;HEAD&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Gives Complete information of the data values such as Number of Data present, Null or Not-Null, Data type
&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
data.info()&lt;br /&gt;
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsHuZBKw8TXD79hplL2RtJNnxDzViyy9_qMFKYBcrQ-sNmi5OdBQ0MxUPdUzR8OlM5xuDVJQ6jo1rbqq4pu8i_9oQZebV2J3OhuV_giZ1hTtJksOOXKO6t9ZJCbMbsbxPzTppBAcwJdYw/s455/info.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;DATA INFORMATION&quot; border=&quot;0&quot; data-original-height=&quot;447&quot; data-original-width=&quot;455&quot; height=&quot;393&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsHuZBKw8TXD79hplL2RtJNnxDzViyy9_qMFKYBcrQ-sNmi5OdBQ0MxUPdUzR8OlM5xuDVJQ6jo1rbqq4pu8i_9oQZebV2J3OhuV_giZ1hTtJksOOXKO6t9ZJCbMbsbxPzTppBAcwJdYw/w400-h393/info.png&quot; title=&quot;DATA INFORMATION&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Counting the target values
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
data.target.value_counts()
  &lt;br /&gt;
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
1  165&lt;br /&gt;
0  138&lt;br /&gt;
Name: target, dtype: int64
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;


&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Give a complete statistical description of the Data
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
data.describe().T
  &lt;br /&gt;
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr5Fkbl5WzBffAD-fjqa0JNEnVDulMNVK01IVp4MeTuYFI45XnhPgwRQJLQCahf5hFcSIDzEc5-Hj3-Dxyca03ImfCqp1Y5b3ddKlMnWrj3m4EFOX4BLfTjomFzliWeX4tmr6RyIK-dQM/s589/describe_T.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;DESCRIBE&quot; border=&quot;0&quot; data-original-height=&quot;482&quot; data-original-width=&quot;589&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr5Fkbl5WzBffAD-fjqa0JNEnVDulMNVK01IVp4MeTuYFI45XnhPgwRQJLQCahf5hFcSIDzEc5-Hj3-Dxyca03ImfCqp1Y5b3ddKlMnWrj3m4EFOX4BLfTjomFzliWeX4tmr6RyIK-dQM/w400-h328/describe_T.png&quot; title=&quot;DESCRIBE&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# This will show us people who suffer from heart disease with respect to the sex i.e Male and Female
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
pd.crosstab(data.sex, data.target).plot(kind=&quot;bar&quot;,figsize=(10,5),color=[&#39;blue&#39;,&#39;red&#39; ])
&lt;br /&gt;&lt;br /&gt;
plt.xlabel(&#39;Sex (0 = Female, 1 = Male)&#39;)             &lt;i&gt;# X-Label &lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;
plt.xticks(rotation=0)                               &lt;i&gt;# Get or set the current tick locations and labels of the x-axis.&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;
plt.legend([&quot;Haven&#39;t Disease&quot;, &quot;Have Disease&quot;])      &lt;i&gt;# legend = Index&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;
plt.ylabel(&#39;Frequency&#39;)                              &lt;i&gt;# X-Label&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;
plt.show()                                           &lt;i&gt;# Help to show our diagram&lt;/i&gt;
  &lt;br /&gt;
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOWj0SCv0zvJD6Od9No2HzrZrwSQm176_Vl-eV9STDqVbKDeKc_cOlVc3kF0rewSaTlRIMAuk-WVJCpypPFrWAWg2WTY9K11DC4goN012tCjjY2SkxMK7i0f-RH8CP4ZxRPlYjcDIUMxc/s900/g1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;FREQUENCY VS SEX&quot; border=&quot;0&quot; data-original-height=&quot;412&quot; data-original-width=&quot;900&quot; height=&quot;292&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOWj0SCv0zvJD6Od9No2HzrZrwSQm176_Vl-eV9STDqVbKDeKc_cOlVc3kF0rewSaTlRIMAuk-WVJCpypPFrWAWg2WTY9K11DC4goN012tCjjY2SkxMK7i0f-RH8CP4ZxRPlYjcDIUMxc/w640-h292/g1.png&quot; title=&quot;FREQUENCY VS SEX&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Finding the numbers of outliers which are present in each feature
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
Q1 = data.quantile(0.25)&lt;br /&gt;
Q3 = data.quantile(0.75)&lt;br /&gt;
&lt;br /&gt;
IQR = Q3 - Q1&lt;br /&gt;
&lt;br /&gt;
((data &amp;lt; (Q1 - 1.5 * IQR)) | (data &amp;lt; (Q3 - 1.5 * IQR))).sum()
  &lt;br /&gt;
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOXGTZbgWuB6e8Os7-nDmY6CiB8bJJIgUpz2I5EeNcCJqabYsE7_WNyF2eWt3oR926EilSQLH8PWWpUpS3IzaUVr8ridevCpjn90wQET9uo6_7wANV-IeC2-oCB-tSRzOKrF48WonEzts/s325/Qs.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;NUMBER OF OUTLIERS IN EACH COLUMN&quot; border=&quot;0&quot; data-original-height=&quot;325&quot; data-original-width=&quot;218&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOXGTZbgWuB6e8Os7-nDmY6CiB8bJJIgUpz2I5EeNcCJqabYsE7_WNyF2eWt3oR926EilSQLH8PWWpUpS3IzaUVr8ridevCpjn90wQET9uo6_7wANV-IeC2-oCB-tSRzOKrF48WonEzts/w269-h400/Qs.png&quot; title=&quot;NUMBER OF OUTLIERS IN EACH COLUMN&quot; width=&quot;269&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Let&#39;s Find out the Distribution of Continuous values
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
for feature in data:&lt;br /&gt;
      dataset = data.copy()&lt;br /&gt;
      dataset[feature].hist(bins=25)&lt;br /&gt;
      plt.xlabel(feature)&lt;br /&gt;
      plt.ylabel(&quot;Count&quot;)&lt;br /&gt;
      plt.title(feature)&lt;br /&gt;
      plt.show()  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq5qyffE4YRhPjyOtWCYJ4q1p8ycguPeEXjKB43msDc7y21GLYOoqX3Fj6Cjf9kIudRC_dlJJPj1km0XbcmeRYf7-lWrjWwewsuRqZfMYMLMqBdRO5AVMrCXOh-za17Wx1Ed15b1fWtFY/s1374/g2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;DISTRIBUTION OF DATA&quot; border=&quot;0&quot; data-original-height=&quot;423&quot; data-original-width=&quot;1374&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq5qyffE4YRhPjyOtWCYJ4q1p8ycguPeEXjKB43msDc7y21GLYOoqX3Fj6Cjf9kIudRC_dlJJPj1km0XbcmeRYf7-lWrjWwewsuRqZfMYMLMqBdRO5AVMrCXOh-za17Wx1Ed15b1fWtFY/w640-h197/g2.png&quot; title=&quot;DISTRIBUTION OF DATA&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Analyzing and treating outliers with a box plot
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
for feature in data:&lt;br /&gt;
      dataset = data.copy()
&lt;br /&gt;&lt;br /&gt;    
      if 0 in dataset[feature].unique():&lt;br /&gt;
            pass&lt;br /&gt;
      else:&lt;br /&gt;
            dataset[feature] = np.log(dataset[feature])&lt;br /&gt;
            dataset.boxplot(column=feature)&lt;br /&gt;
            plt.ylabel(feature)&lt;br /&gt;
            plt.title(feature)&lt;br /&gt;
            plt.show()  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnTMd6GoAGEDjPMXXW87T9A1RYtb5h2FAfqlKeWHGhhG9jyL43wpIO6VJUKclRHYPNjVhxgfX1Ghhi4oI4bJpuEubAENQjyAMckdw_K8PZQxUZ4jYrzldKuer6jKyc0GUzES_sAX-fbvM/s1384/g3.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;BOX PLOT OUTLIER DETECTION&quot; border=&quot;0&quot; data-original-height=&quot;1384&quot; data-original-width=&quot;693&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnTMd6GoAGEDjPMXXW87T9A1RYtb5h2FAfqlKeWHGhhG9jyL43wpIO6VJUKclRHYPNjVhxgfX1Ghhi4oI4bJpuEubAENQjyAMckdw_K8PZQxUZ4jYrzldKuer6jKyc0GUzES_sAX-fbvM/s16000/g3.png&quot; title=&quot;BOX PLOT OUTLIER DETECTION&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Detecting outliers using z_score&amp;nbsp;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;div&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;#&amp;nbsp; z = (x-μ)/σ&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
outliers = []&lt;br /&gt;
def detect_outliers(values):&lt;br /&gt;
      Threshold = 3&lt;br /&gt;
      mean_val = np.mean(values)&lt;br /&gt;
      std_val = np.std(values)&lt;br /&gt;&lt;br /&gt;
    
      for i in values:&lt;br /&gt;
            z_score = (i-mean_val)/std_val&lt;br /&gt;
            if np.abs(z_score) &amp;gt; Threshold:&lt;br /&gt;
                  outliers.append(i)&lt;br /&gt;
      return outliers&lt;br /&gt;&lt;br /&gt;

out = detect_outliers(data[&#39;age&#39;])&lt;br /&gt;
out  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
[]
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
outliers = []&lt;br /&gt;
def detect_outliers(values):&lt;br /&gt;
      Threshold = 3&lt;br /&gt;
      mean_val = np.mean(values)&lt;br /&gt;
      std_val = np.std(values)&lt;br /&gt;&lt;br /&gt;
    
      for i in values:&lt;br /&gt;
            z_score = (i-mean_val)/std_val&lt;br /&gt;
            if np.abs(z_score) &amp;gt; Threshold:&lt;br /&gt;
                  outliers.append(i)&lt;br /&gt;
      return outliers&lt;br /&gt;&lt;br /&gt;

out = detect_outliers(data[&#39;trestbps&#39;])&lt;br /&gt;
out
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
[200,192]
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
outliers = []&lt;br /&gt;
def detect_outliers(values):&lt;br /&gt;
      Threshold = 3&lt;br /&gt;
      mean_val = np.mean(values)&lt;br /&gt;
      std_val = np.std(values)&lt;br /&gt;&lt;br /&gt;
    
      for i in values:&lt;br /&gt;
            z_score = (i-mean_val)/std_val&lt;br /&gt;
            if np.abs(z_score) &amp;gt; Threshold:&lt;br /&gt;
                  outliers.append(i)&lt;br /&gt;
      return outliers&lt;br /&gt;&lt;br /&gt;

out = detect_outliers(data[&#39;chol&#39;])&lt;br /&gt;
out

  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
[417, 564, 407, 409]
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
outliers = []&lt;br /&gt;
def detect_outliers(values):&lt;br /&gt;
      Threshold = 3&lt;br /&gt;
      mean_val = np.mean(values)&lt;br /&gt;
      std_val = np.std(values)&lt;br /&gt;&lt;br /&gt;
    
      for i in values:&lt;br /&gt;
            z_score = (i-mean_val)/std_val&lt;br /&gt;
            if np.abs(z_score) &amp;gt; Threshold:&lt;br /&gt;
                  outliers.append(i)&lt;br /&gt;
      return outliers&lt;br /&gt;&lt;br /&gt;

out = detect_outliers(data[&#39;thalach&#39;])&lt;br /&gt;
out
  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
[71]
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# From the above analysis we can say that we lack the domain knowledge, so it would be best if we just keep all the dataset as it is.
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Finding the correlation between variables
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
data.corr()[&#39;chol&#39;].sort_values().plot(kind=&#39;bar&#39;)
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOVkjXKgfbzv2DUdW5OlajKM1EmNPiVnwDOqOfu3qccWY4Ml956BIUFWx93VxoNbgc6OLVXMyckFscQ3DFwwX_dMkImOme5UmuzH4wUremRE6XPSmuIUpqVM-1McA_moZ9KifB0pWXmJA/s568/g4.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;BAR CHART COORELATION&quot; border=&quot;0&quot; data-original-height=&quot;403&quot; data-original-width=&quot;568&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOVkjXKgfbzv2DUdW5OlajKM1EmNPiVnwDOqOfu3qccWY4Ml956BIUFWx93VxoNbgc6OLVXMyckFscQ3DFwwX_dMkImOme5UmuzH4wUremRE6XPSmuIUpqVM-1McA_moZ9KifB0pWXmJA/s16000/g4.png&quot; title=&quot;BAR CHART COORELATION&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# This will give the correlation between that features
&lt;br /&gt;&lt;br /&gt;
# Example: age in Y-axis and age in X-axis will have the maximum correlation that&#39;s why it&#39;s dark in color
&lt;br /&gt;&lt;br /&gt;
# annot: Help to see the value inbox&lt;br /&gt;&lt;br /&gt;
# cmap: The mapping from data values to color space.&lt;br /&gt;&lt;br /&gt;
# fmt: String formatting code to use when adding annotations.
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;


&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
plt.figure(figsize=(14,10))                                       # Help to set figure size                                     
&lt;br /&gt;&lt;br /&gt;
sns.heatmap(data.corr(),annot=True,cmap=&#39;hsv&#39;,fmt=&#39;.3f&#39;,linewidths=2)    &lt;br /&gt;&lt;br /&gt;
plt.ylim(15,0)                                                     # show us the exact number of values we want&lt;br /&gt;&lt;br /&gt;
plt.show()
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheUhwUpZzkX7lzNTzJ1bGrHXf70xeuW5yUnQQ6JBKFm-7XyjlCYpwV75H5QuaIOBcittmNt_Jg-OVAMcRDdrmRM6pUlFffumGWbCNRyMurkK8mr1GcphO0O11l-e8zwa0lGBbgV59j0LY/s992/g5.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;COORELATION MATRIX&quot; border=&quot;0&quot; data-original-height=&quot;728&quot; data-original-width=&quot;992&quot; height=&quot;470&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheUhwUpZzkX7lzNTzJ1bGrHXf70xeuW5yUnQQ6JBKFm-7XyjlCYpwV75H5QuaIOBcittmNt_Jg-OVAMcRDdrmRM6pUlFffumGWbCNRyMurkK8mr1GcphO0O11l-e8zwa0lGBbgV59j0LY/w640-h470/g5.png&quot; title=&quot;COORELATION MATRIX&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# This will show us Heart Disease Frequency for Ages&lt;br /&gt;&lt;br /&gt;
# Target: YES/NO&lt;br /&gt;&lt;br /&gt;
# color: Green / Yellow
&lt;br /&gt;&lt;br /&gt;
  
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
pd.crosstab(data.age,data.target).plot(kind=&quot;bar&quot;,figsize=(25,8),color=[&#39;green&#39;,&#39;yellow&#39; ]) &lt;br /&gt;
plt.title(&#39;Heart Disease Frequency for Ages&#39;)&lt;br /&gt;
plt.xlabel(&#39;Age&#39;)&lt;br /&gt;
plt.ylabel(&#39;Frequency&#39;)&lt;br /&gt;
plt.show()
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcFHnAAQQeEIaKstecqv9kHkj-QVivbcHq-cWZYp66zZgs9dGzBiVibvAoGDyqalskyMFut1Cw5q6j_LYIpX2v90TFmO1qZHR4M6D2_15uL2TvMiOgaecx_2V0sryiwY6RLTHc3r9IaZE/s1246/g6.png&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;GENDER VS FREQUENCY&quot; border=&quot;0&quot; data-original-height=&quot;430&quot; data-original-width=&quot;1246&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcFHnAAQQeEIaKstecqv9kHkj-QVivbcHq-cWZYp66zZgs9dGzBiVibvAoGDyqalskyMFut1Cw5q6j_LYIpX2v90TFmO1qZHR4M6D2_15uL2TvMiOgaecx_2V0sryiwY6RLTHc3r9IaZE/w640-h221/g6.png&quot; title=&quot;GENDER VS FREQUENCY&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# The train_test_split function is for splitting a single dataset for two different purposes: training and testing. The testing subset is for building your model. The testing subset is for using the model on unknown data to evaluate the performance of the model.
&lt;br /&gt;&lt;br /&gt;

# train_test_split is a function in Sklearn model selection for splitting data arrays into two subsets: for training data and for testing data. With this function, you don&#39;t need to divide the dataset manually. By default, Sklearn train_test_split will make random partitions for the two subsets. However, you can also specify a random state for the operation.

&lt;br /&gt;&lt;br /&gt;

# .values: This returns back the numpy array&lt;br /&gt;&lt;br /&gt;
# X, y: The first parameter is the dataset you&#39;re selecting to use.&lt;br /&gt;&lt;br /&gt;
# train_size: This parameter sets the size of the training dataset. There are three options: None, which is the default, Int, which requires the exact number of samples, and float, which ranges from 0.1 to 1.0.&lt;br /&gt;&lt;br /&gt;
# test_size: This parameter specifies the size of the testing dataset. The default state suits the training size. It will be set to 0.25 if the training size is set to default.&lt;br /&gt;&lt;br /&gt;
# random_state: The default mode performs a random split using np.random. Alternatively, you can add an integer using an exact number.
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
from sklearn.model_selection import train_test_split&lt;br /&gt;
&lt;br /&gt;
X = data.drop(&#39;target&#39;, axis=1).values&lt;br /&gt;
y = data[&#39;target&#39;].values&lt;br /&gt;
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=2)
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;  
  
  
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
# Database normalization is the process of structuring a relational database in accordance with a series of so-called normal forms in order to reduce data redundancy and improve data integrity.
&lt;br /&gt;&lt;br /&gt;


# Transform features by scaling each feature to a given range.
&lt;br /&gt;&lt;br /&gt;
# MinMaxScaler: This estimator scales and translates each feature individually such that it is in the given range on the training set, e.g. between zero and one.
&lt;br /&gt;&lt;br /&gt;


# By fit the imputer calculates the means of columns from some data, and by transforming it applies those means to some data (which is just replacing missing values with the means). If both these data are the same (i.e. the data for calculating the means and the data that means are applied to) you can use fit_transform which is basically a fit followed by a transform.

  
  &lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
from sklearn.preprocessing import MinMaxScaler
&lt;br /&gt;&lt;br /&gt;
scaler = MinMaxScaler()
&lt;br /&gt;&lt;br /&gt;
X_train = scaler.fit_transform(X_train)&lt;br /&gt;
X_test = scaler.transform(X_test)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;  
  
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
Creating Machine Learning Model.&lt;br /&gt;
&lt;br /&gt;
  &lt;h3&gt;1)Logistic Regression:&lt;/h3&gt;
  If you want to know more about Logistic Regression, you can definitely check out these blogs which are written in very simple language.&lt;br /&gt;&lt;br /&gt;
Logistic Regression Blogs:
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.infinitycodex.in/logistic-regression-in-machine-learning&quot; target=&quot;_blank&quot;&gt;7 most frequently asked Logistic Regression Questions Answered in 1 blog.&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.infinitycodex.in/how-to-find-optimal-threshold-value-and&quot; target=&quot;_blank&quot;&gt;How To Find Optimal Threshold Value And Change Threshold Value In Logistic Regression?&lt;/a&gt;
  &lt;/span&gt;
  &lt;br /&gt;
  
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
from sklearn.linear_model import LogisticRegression&lt;br /&gt;&lt;br /&gt;

lr_model = LogisticRegression()&lt;br /&gt;&lt;br /&gt;

lr_model.fit(X_train,y_train)&lt;br /&gt;&lt;br /&gt;

lr_pred = lr_model.predict(X_test)&lt;br /&gt;&lt;br /&gt;


from sklearn.metrics import classification_report, confusion_matrix
&lt;br /&gt;&lt;br /&gt;
print(classification_report(y_test,lr_pred))
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFQ4c9INCmkokpxcDt64EWyV3Xkfury2ATp_b1HKSYeAzia_ANQSEQkM-KbrdGZAKRfotJUIT1LF8C5U3Hd4mgR_CTPWUmCZoUnuu3V31u81Nz8g5UuexJRDB8wSCOeD6vao7wRByxzpw/s581/LG.PNG&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;LOGISTIC REGRESSION CLASSIFICATION REPORT&quot; border=&quot;0&quot; data-original-height=&quot;190&quot; data-original-width=&quot;581&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFQ4c9INCmkokpxcDt64EWyV3Xkfury2ATp_b1HKSYeAzia_ANQSEQkM-KbrdGZAKRfotJUIT1LF8C5U3Hd4mgR_CTPWUmCZoUnuu3V31u81Nz8g5UuexJRDB8wSCOeD6vao7wRByxzpw/s16000/LG.PNG&quot; title=&quot;LOGISTIC REGRESSION CLASSIFICATION REPORT&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
print(confusion_matrix(y_test,lr_pred))
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
[[25  7]&lt;br /&gt;
 [ 1 28]]&amp;nbsp;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;2)Support Vector Machine:&lt;/h3&gt;
  If you want to know more about Support Vector Machine, you can definitely check out our blog which is written in very simple language.&lt;br /&gt;&lt;br /&gt;
Support Vector Machine Blog:
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.infinitycodex.in/support-vector-machine-in-machine&quot; target=&quot;_blank&quot;&gt;Support Vector Machine in Machine Learning&lt;/a&gt;
  &lt;/span&gt;
  &lt;br /&gt;
  
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
from sklearn import svm&lt;br /&gt;&lt;br /&gt;

clf_model = svm.SVC(kernel=&#39;rbf&#39;)&lt;br /&gt;&lt;br /&gt;

clf_model.fit(X_train,y_train)&lt;br /&gt;&lt;br /&gt;

clf_pred = clf_model.predict(X_test)&lt;br /&gt;&lt;br /&gt;


from sklearn.metrics import classification_report, confusion_matrix
&lt;br /&gt;&lt;br /&gt;
print(classification_report(y_test,clf_pred))
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh7jNNixSOvt1hmc3t17gw3jv7JZY4yyVpejpNnWfchmE9035I1m2woxiUoqeQwl9nYhLSC0ZCr8oDRpwXfibjEwVfLSYzyzEKVpjR9trWBn6HzbEaP6UnUriTVwTAsCN_HiIUd6s9Q4I/s613/SVM.PNG&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;SVM CLASSIFICATION REPORT&quot; border=&quot;0&quot; data-original-height=&quot;199&quot; data-original-width=&quot;613&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh7jNNixSOvt1hmc3t17gw3jv7JZY4yyVpejpNnWfchmE9035I1m2woxiUoqeQwl9nYhLSC0ZCr8oDRpwXfibjEwVfLSYzyzEKVpjR9trWBn6HzbEaP6UnUriTVwTAsCN_HiIUd6s9Q4I/s16000/SVM.PNG&quot; title=&quot;SVM CLASSIFICATION REPORT&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
print(confusion_matrix(y_test,clf_pred))
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
[[26  6]&lt;br /&gt;
 [ 1 28]]&amp;nbsp;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;&lt;br /&gt;
  
  
  
  
  
  
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
  &lt;h3&gt;3)Random Forest:&lt;/h3&gt;
  If you want to know more about Random Forest, you can definitely check out our blog which is written in very simple language.&lt;br /&gt;&lt;br /&gt;
Random Forest Blog:
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.infinitycodex.in/top-10-strategies-which-will-make-you&quot; target=&quot;_blank&quot;&gt;Top 10 Strategies Which Will Make You King Of  RANDOM FOREST [2020]&lt;/a&gt;
  &lt;/span&gt;
  &lt;br /&gt;
  
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
from sklearn.ensemble import RandomForestClassifier&lt;br /&gt;&lt;br /&gt;

rf_model = RandomForestClassifier(n_estimators=200)&lt;br /&gt;&lt;br /&gt;

rf_model.fit(X_train,y_train)&lt;br /&gt;&lt;br /&gt;


rf_pred = rf_model.predict(X_test)&lt;br /&gt;&lt;br /&gt;


from sklearn.metrics import classification_report, confusion_matrix
&lt;br /&gt;&lt;br /&gt;
print(classification_report(y_test,rf_pred))
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9sboqfsG2pHJf_h-qGqbPLppg8Iyr8Ko_xaMwBV5DaO4edGa27s35s6MLEkITihEfL9wuhc1ZIeRIt_93RydT4VZz8J2uAv50LJGn_hwPtWzVdg7l_T5LTCnfHYrPCqXfb6wLXDivcvE/s564/RF.PNG&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;RANDOM FOREST CLASSIFICATION REPORT&quot; border=&quot;0&quot; data-original-height=&quot;190&quot; data-original-width=&quot;564&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9sboqfsG2pHJf_h-qGqbPLppg8Iyr8Ko_xaMwBV5DaO4edGa27s35s6MLEkITihEfL9wuhc1ZIeRIt_93RydT4VZz8J2uAv50LJGn_hwPtWzVdg7l_T5LTCnfHYrPCqXfb6wLXDivcvE/s16000/RF.PNG&quot; title=&quot;RANDOM FOREST CLASSIFICATION REPORT&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
print(confusion_matrix(y_test,rf_pred))
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
[[26  6]&lt;br /&gt;
 [ 0 29]]
&lt;br /&gt;&lt;br /&gt;
  

&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
# RANDOM FOREST GAVE US THE BEST RESULT
&lt;br /&gt;&lt;br /&gt;
import joblib&lt;br /&gt;
joblib.dump(rf_model,&quot;Heart_Disease_Prediction.pkl&quot;)
  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

[&#39;Heart_Disease_Prediction.pkl&#39;]
&lt;br /&gt;&lt;br /&gt;  

  
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
# Testing our model performance&lt;br /&gt;
m = joblib.load(&#39;Heart_Disease_Prediction.pkl&#39;)&lt;br /&gt;
m.predict([[55,1,3,145,233,0,0,150,0,2.2,0,0,1]])  &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
array([1], dtype=int64)
&lt;br /&gt;&lt;br /&gt;  

&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;
So From these, we can conclude that our model is performing great and we are ready to deploy it with the help of flask, which we will see at our next blog.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: 18px;&quot;&gt;&lt;b&gt;Click this link for part 2&lt;/b&gt;:&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/heart-disease-prediction-end-to-end_14&quot; target=&quot;_blank&quot;&gt;Heart Disease Prediction End to End Machine Learning Project (Interface Creation)&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,serif; font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Facebook :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Twitter :&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/3230642177814940153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/10/heart-disease-prediction-end-to-end.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/3230642177814940153'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/3230642177814940153'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/10/heart-disease-prediction-end-to-end.html' title='Heart Disease Prediction End to End Machine Learning Project (Model Creation)'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-YI1dSeOAXwgAV9SjgpYZdddfL94GmT66oy0P-fO7qHNUB7_hq2UcgjqvKlQuxcuxnWi10EGYu3LwVhpgk2EbtzCUakICXUInllTV80cao9f8QV3nKbF6s9DTFpCIcw2gqmt0G4Psjyk/s72-c/hand-2308932_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-1964511320619948794</id><published>2020-08-22T17:22:00.006+05:30</published><updated>2023-06-08T09:15:43.770+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>How To Find Optimal Threshold Value And Change Threshold Value In Logistic Regression</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;/h1&gt;&lt;h1 style=&quot;line-height: normal;&quot;&gt;&lt;/h1&gt;&lt;h1 style=&quot;line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 1; text-align: center;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, serif; font-size: 30pt;&quot;&gt;How To Find Optimal Threshold Value&amp;nbsp;And Change Threshold Value
In&amp;nbsp;Logistic Regression&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h1&gt;&lt;div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Whenever we learn Logistic Regression, we always
encounter the Question that How to find the optimal Threshold value for our
model? or How we can change the Threshold value as per user’s requirement?&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKrxJ61eCGqzcRliuU4QSrJMcFt9PUI-7I6rJRnwvJJ-SaFvHS1SpNCUsOzp4jhjTwhVD71XwXExn_IBl3R9hqrNGjYjy5tHyWhgmIOvVf4NSuumGc6RR0aSmtxln6wOVzFjkOqU8AW4/s1920/question-mark-1872665_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;HOW TO FIND THRESHOLD VALUE&quot; border=&quot;0&quot; data-original-height=&quot;1056&quot; data-original-width=&quot;1920&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKrxJ61eCGqzcRliuU4QSrJMcFt9PUI-7I6rJRnwvJJ-SaFvHS1SpNCUsOzp4jhjTwhVD71XwXExn_IBl3R9hqrNGjYjy5tHyWhgmIOvVf4NSuumGc6RR0aSmtxln6wOVzFjkOqU8AW4/d/question-mark-1872665_1920.jpg&quot; title=&quot;HOW TO FIND THRESHOLD VALUE&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;If someone who doesn’t know what is a Threshold value in Logistic
Regression then you must check out this link&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;background-color: #fcff01; font-size: x-large;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/logistic-regression-in-machine-learning&quot; target=&quot;_blank&quot;&gt;https://www.infinitycodex.in/logistic-regression-in-machine-learning&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;And for those who know what threshold value is can
keep on reading.&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Now why some users/client want to change there
threshold value &amp;amp; at which problem we should decide that we have to change
the threshold value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Now the threshold value can be increased or decreased
based on the problem or dataset we are dealing with. By the way, the &lt;b&gt;default
threshold value in Logistic Regression is 0.5&lt;/b&gt;. Now you must be thinking why
the hell we want to increase or decrease the threshold value?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Let’s understand this with 2 simple scenarios one for
decreasing and others for increasing the threshold value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;1.) &lt;u&gt;Decreasing the Threshold value&lt;/u&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Let’s say you want to predict that the students who score
less than 30% failed in there examination. So at this problem statement, you have
to reduce the threshold value at 30%.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;2.) &lt;u&gt;Increasing the Threshold value&lt;/u&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Let’s say you got a cancer dataset and doctor’s told
you that you have to predict the person is having cancer or not. If the person is above 80% infected than that person should be considered as worst infected by
cancer and need immediate chemotherapy if that person is having less than 80% the chance that we can consider that person can be treated with normal medication.&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;I know most of them to know all this thing already by the main question is how do we code this entire process from finding optimal
Threshold value till the changing the threshold value.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;We will be using the ROC Curve which will help us to predict the optimal threshold value. For those who don&#39;t know what the ROC Curve is... ROC Curve is known as &lt;b&gt;Receiver Operating Characteristic&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;* ROC Curve is used in &lt;b&gt;Binary Classification&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;* It is a plot of True Positive Rate(1) on Y-Axis against False Positive Rate(0) on X-Axis.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;* Once you get the output in probability. You can use the different cut-off to distinguish what is going to be the True Case and what will be the False Case.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;* ROC Curve say when your curve is closer to the Y-Axis that is &lt;b&gt;True Positive Rate&lt;/b&gt; than it is a &lt;b&gt;very good model&lt;/b&gt; and your &lt;b&gt;model is in between&lt;/b&gt; that is 0.5 than it&#39;s an &lt;b&gt;average model&lt;/b&gt; and if your curve is towards the &lt;b&gt;False Positive Rate&lt;/b&gt; than it&#39;s the &lt;b&gt;worst model&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;ROC Curve looks something like this:&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBkzpYNEl3lLyupypiBfzndN5s_1ayRv9vrxS7jgZAn3cXurzFWUVKOZp-K8LHXr22BxmxyaU0Vu-Z4uQ1TQzQVdKYyhpMEykR2pBZmyC_UHw58Oe2-i_r9G1Zu4uRxkEGy48Nwcvhw5w/s532/ROC_curve.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;ROC CURVE&quot; border=&quot;0&quot; data-original-height=&quot;343&quot; data-original-width=&quot;532&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBkzpYNEl3lLyupypiBfzndN5s_1ayRv9vrxS7jgZAn3cXurzFWUVKOZp-K8LHXr22BxmxyaU0Vu-Z4uQ1TQzQVdKYyhpMEykR2pBZmyC_UHw58Oe2-i_r9G1Zu4uRxkEGy48Nwcvhw5w/d/ROC_curve.png&quot; title=&quot;ROC CURVE&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;&lt;b&gt;CODE:&lt;/b&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
  
import pandas as pd &lt;br /&gt;
import numpy as np  &lt;br /&gt;&lt;br /&gt;
  
data = pd.read_csv(&quot;D:\corona\heart_Disease\heart.csv&quot;)&lt;br /&gt;
data.head()  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3QaK0bnJP3lQh222pmjM0877JeTJ4yDQ80xpaboeFec-ScZgPl1r3QaF81gY6Vl8PJpb12uP0-BcZ-nWLEl7RnMgD6RRceoU_1-kZMNubRrQ3E6CacXsAJGt_agLVUTwUHxPDq0MNBoU/s759/head.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;199&quot; data-original-width=&quot;759&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3QaK0bnJP3lQh222pmjM0877JeTJ4yDQ80xpaboeFec-ScZgPl1r3QaF81gY6Vl8PJpb12uP0-BcZ-nWLEl7RnMgD6RRceoU_1-kZMNubRrQ3E6CacXsAJGt_agLVUTwUHxPDq0MNBoU/s640/head.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
data = pd.get_dummies(data, columns=[&#39;cp&#39;,&#39;slope&#39;,&#39;thal&#39;,&#39;restecg&#39;], drop_first=True)&lt;br /&gt;
data.head()
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3_aoHVsQ0Ukq577gsdmXECUjE_-brZXnezl3ZCJrzldBdCARIcwCNsspMgaekgPCn4Xmz3YJhsfNAE0k0Y0yjbnfZRT1H1l1KyZpKP9rm-gnac8LHjYW9Bcip-8ZL2t3PjED-WbccYE8/s1200/head_after_drop_and_dummies.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;HEAD AFTER DUMMIES&quot; border=&quot;0&quot; data-original-height=&quot;195&quot; data-original-width=&quot;1200&quot; height=&quot;104&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3_aoHVsQ0Ukq577gsdmXECUjE_-brZXnezl3ZCJrzldBdCARIcwCNsspMgaekgPCn4Xmz3YJhsfNAE0k0Y0yjbnfZRT1H1l1KyZpKP9rm-gnac8LHjYW9Bcip-8ZL2t3PjED-WbccYE8/w640-h104/head_after_drop_and_dummies.png&quot; title=&quot;HEAD AFTER DUMMIES&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
from sklearn.model_selection import train_test_split
&lt;br /&gt;&lt;br /&gt;
X = data.drop(&#39;target&#39;, axis=1).values&lt;br /&gt;
y = data[&#39;target&#39;].values&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
  &lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;Normalizing the values using MinMaxScaler.&lt;br /&gt;
&lt;/span&gt;


&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
from sklearn.preprocessing import MinMaxScaler
&lt;br /&gt;&lt;br /&gt;
scaler = MinMaxScaler()
&lt;br /&gt;&lt;br /&gt;
X_train = scaler.fit_transform(X_train)&lt;br /&gt;
X_test = scaler.transform(X_test)
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;&lt;b&gt;Find Threshold Value&lt;/b&gt;
&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
  Here you can use &lt;b&gt;Decision Tree&lt;/b&gt;, &lt;b&gt;Random Forest&lt;/b&gt;, &lt;b&gt;Bagging&lt;/b&gt;, &lt;b&gt;Boosting&lt;/b&gt;.. etc.&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;

from sklearn.metrics import roc_auc_score, roc_curve &lt;br /&gt;&lt;br /&gt;

# Random Forest&lt;br /&gt;
from sklearn.ensemble import RandomForestClassifier&lt;br /&gt;&lt;br /&gt;

rf_model = RandomForestClassifier()&lt;br /&gt;
rf_model.fit(X_train, y_train)&lt;br /&gt;
&lt;br /&gt;
rf_ytrain_pred = rf_model.predict_proba(X_train)&lt;br /&gt;
print(&quot;RF Train roc-auc:{}&quot;.format(roc_auc_score(y_train, rf_ytrain_pred[:,1])))&lt;br /&gt;&lt;br /&gt;

rf_y_test_pred = rf_model.predict_proba(X_test)&lt;br /&gt;
print(&quot;RF Test roc-acc:{}&quot;.format(roc_auc_score(y_test, rf_y_test_pred[:,1])))&lt;br /&gt;&lt;br /&gt;

#----------------------------------------------------------------------------------&amp;nbsp;&lt;br /&gt;&lt;br /&gt;

# Logistic Regression&lt;br /&gt;
from sklearn.linear_model import LogisticRegression&lt;br /&gt;&lt;br /&gt; 

lg_model = LogisticRegression()&lt;br /&gt;
lg_model.fit(X_train, y_train)&lt;br /&gt;
&lt;br /&gt;
lg_ytrain_pred = lg_model.predict_proba(X_train)&lt;br /&gt;
print(&quot;LG Train roc-auc:{}&quot;.format(roc_auc_score(y_train, lg_ytrain_pred[:,1])))&lt;br /&gt;&lt;br /&gt;

lg_y_test_pred = lg_model.predict_proba(X_test)&lt;br /&gt;
print(&quot;LG Test roc-auc:{}&quot;.format(roc_auc_score(y_test, lg_y_test_pred[:,1])))
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
  &lt;b&gt;Output:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;

RF Train roc-auc:1.0&lt;br /&gt;
RF Test roc-acc:0.915948275862069&lt;br /&gt;
LG Train roc-auc:0.9226736566186108&lt;br /&gt;
LG Test roc-auc:0.9450431034482759  
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;


&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;
  &lt;b&gt;Selection Of Best Threshold Value For Accuracy&lt;/b&gt;
  &lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
pred = []&lt;br /&gt;&lt;br /&gt;

for model in [rf_model, lg_model]:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pred.append(pd.Series(model.predict_proba(X_test)[:,1]))&lt;br /&gt;&lt;br /&gt;
    
final_pred = pd.concat(pred, axis=1).mean(axis=1)&lt;br /&gt;
print(&quot;Ensemble test roc-auc:{}&quot;.format(roc_auc_score(y_test,final_pred)))
  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
&lt;b&gt;Output:&lt;/b&gt;
&lt;br /&gt;&lt;br /&gt;
Ensemble test roc-auc:0.9407327586206897
&lt;br /&gt;
&lt;/span&gt;


&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
# Calculate the roc-curve
&lt;br /&gt;&lt;br /&gt;
False_pos_rate, True_pos_rate, threshold = roc_curve(y_test, final_pred)
&lt;br /&gt;&lt;br /&gt;
threshold
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
  &lt;b&gt;Output:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;
  array([1.97525308, 0.97525308, 0.82803343, 0.82740393, 0.61206134,
       0.5829135 , 0.48185878, 0.45554149, 0.45229139, 0.38156861,
       0.21880427, 0.07000419, 0.06909258, 0.0069847 ])
  
  &lt;br /&gt;&lt;br /&gt;
  These are some of the best candidates from which we can select our threshold value.
&lt;/span&gt;


&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;

from sklearn.metrics import accuracy_score&lt;br /&gt;&lt;br /&gt;

acc = []&lt;br /&gt;&lt;br /&gt;

for thres in threshold:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y_pred = np.where(final_pred&amp;gt;thres,1,0)
&lt;br /&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#what ever prediction i am getting and if it is greater than threshold i&#39;ll be converting as 1 or i&#39;ll keep it as 0.&lt;br /&gt;
    &lt;br /&gt;&lt;br /&gt;    
    &lt;br /&gt;&lt;br /&gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;acc.append(accuracy_score(y_test,y_pred,normalize=True))&lt;br /&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#Then i&#39;ll be computing my accuracy score with my y_test and then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#append the accuracy inside acc list. 
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
acc = pd.concat([pd.Series(threshold), pd.Series(acc)], axis=1)&lt;br /&gt;
acc.columns = [&#39;threshold&#39;,&#39;accuracy&#39;]&lt;br /&gt;
acc.sort_values(by=&quot;accuracy&quot;, ascending=False, inplace = True)&lt;br /&gt;
acc.head()  
  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj30B0fVWtA0kJmHZDeHT3l3Bih662OrFarh4ecIEk0tVBemEbpK-vCc1Mki6aFfxkXCZwWKSLzS5t-8jYMkeF43aUB_ZG95TGKNjexlQDjBxYXs-5cs3xDapFWEL4sHsG6jSpAUWC9fZo/s204/Top_5_thresholds.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;TOP 5 THRESHOLD VALUES&quot; border=&quot;0&quot; data-original-height=&quot;193&quot; data-original-width=&quot;204&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj30B0fVWtA0kJmHZDeHT3l3Bih662OrFarh4ecIEk0tVBemEbpK-vCc1Mki6aFfxkXCZwWKSLzS5t-8jYMkeF43aUB_ZG95TGKNjexlQDjBxYXs-5cs3xDapFWEL4sHsG6jSpAUWC9fZo/d/Top_5_thresholds.png&quot; title=&quot;TOP 5 THRESHOLD VALUES&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;&lt;br /&gt;
  &lt;br /&gt;These are top 5 threshold values.
&lt;/span&gt;



&lt;br /&gt;

&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;

import matplotlib.pyplot as plt&lt;br /&gt;
def plot_roc_curve(False_pos_rate,True_pos_rate):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.plot(False_pos_rate, True_pos_rate, label=&quot;ROC&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.plot([0,1],[0,1],color=&quot;Red&quot;,linestyle=&quot;--&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.xlabel(&quot;False_Positive_rate&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.ylabel(&quot;True_Positive_rate&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.title(&quot;ROC Curve&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.legend&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    plt.show()&lt;br /&gt;&lt;br /&gt;  
plot_roc_curve(False_pos_rate,True_pos_rate)
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd4AjIZIDWm9Isu2wKkofIqkMLtHqyMm-3LKm565ysjmgjJ0KEq71MJdwzsAGSeMHoKj2XFvZCFpEHZWDIQpv-zXIvqKksb46VK8TfuJMTqKOZQIAOBt_nOs9GCAiqhr8RsSsB5El5IPQ/s210/model_result.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MODEL RESULT&quot; border=&quot;0&quot; data-original-height=&quot;158&quot; data-original-width=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd4AjIZIDWm9Isu2wKkofIqkMLtHqyMm-3LKm565ysjmgjJ0KEq71MJdwzsAGSeMHoKj2XFvZCFpEHZWDIQpv-zXIvqKksb46VK8TfuJMTqKOZQIAOBt_nOs9GCAiqhr8RsSsB5El5IPQ/d/model_result.png&quot; title=&quot;MODEL RESULT&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;&lt;br /&gt;&lt;br /&gt;
  These are some of the best candidates from which we can select our threshold value.
&lt;/span&gt;





&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;&lt;br /&gt;
  &lt;b&gt;Create A Model with 0.61 Threshold&lt;/b&gt;
  &lt;br /&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;

from sklearn.linear_model import LogisticRegression&lt;br /&gt;
from sklearn.metrics import accuracy_score, confusion_matrix, recall_score, roc_auc_score, precision_score, classification_report&lt;br /&gt;&lt;br /&gt;

clf = LogisticRegression(class_weight=&quot;balanced&quot;)&lt;br /&gt;
clf.fit(X_train, y_train)&lt;br /&gt;&lt;br /&gt;
THRESHOLD = 0.61&lt;br /&gt;
preds = np.where(clf.predict_proba(X_test)[:,1] &amp;gt; THRESHOLD, 1, 0)&lt;br /&gt;&lt;br /&gt;

pd.DataFrame(data=[accuracy_score(y_test, preds), recall_score(y_test, preds),
                   precision_score(y_test, preds), roc_auc_score(y_test, preds)],
             index=[&quot;accuracy&quot;, &quot;recall&quot;, &quot;precision&quot;, &quot;roc_auc_score&quot;])
  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV9w81Sa2NOnMS0DbW-oDMG77QHaUHSUnF8srddD01Kp___mMABSban1CLKEsEYv4HaCWukvSG3x_HGvA0hjEUra6oX45huOnLEYLNLPeAy-10hWToT5n6kk-1HhGv65x-_s-M2iVMFEA/s532/ROC_curve.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;ROC CURVE&quot; border=&quot;0&quot; data-original-height=&quot;343&quot; data-original-width=&quot;532&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV9w81Sa2NOnMS0DbW-oDMG77QHaUHSUnF8srddD01Kp___mMABSban1CLKEsEYv4HaCWukvSG3x_HGvA0hjEUra6oX45huOnLEYLNLPeAy-10hWToT5n6kk-1HhGv65x-_s-M2iVMFEA/d/ROC_curve.png&quot; title=&quot;ROC CURVE&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 30px;&quot;&gt;&lt;b&gt;A model with Changed threshold value&lt;/b&gt;
  &lt;br /&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
print(classification_report(y_test,preds))  
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;


&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfGOgDtsZgSgGdCJ763RDGmlyExGONdzAe1ZV0Q4Q0wYaOobJqqXPDvfdbVFgLkpwLTIhJInVEEfz62g8ABvkhFKfJA0-k1Wxd6BMsTs231xiEJ519GrLnvLod2LRUajRkhH8rmRhFPZk/s566/Classification_report.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;CLASSIFICATION REPORT&quot; border=&quot;0&quot; data-original-height=&quot;197&quot; data-original-width=&quot;566&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfGOgDtsZgSgGdCJ763RDGmlyExGONdzAe1ZV0Q4Q0wYaOobJqqXPDvfdbVFgLkpwLTIhJInVEEfz62g8ABvkhFKfJA0-k1Wxd6BMsTs231xiEJ519GrLnvLod2LRUajRkhH8rmRhFPZk/d/Classification_report.png&quot; title=&quot;CLASSIFICATION REPORT&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
print(confusion_matrix(y_test,preds))
  &lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
[[28  1]&lt;br /&gt;
&amp;nbsp; [ 9 23]]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 22px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;&quot; style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So we hope that you find the solution. If you found this helpful then please share it with your friends and spread this knowledge.&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span face=&quot;&quot; style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;&lt;/span&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/1964511320619948794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/08/how-to-find-optimal-threshold-value-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/1964511320619948794'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/1964511320619948794'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/08/how-to-find-optimal-threshold-value-and.html' title='How To Find Optimal Threshold Value And Change Threshold Value In Logistic Regression'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKrxJ61eCGqzcRliuU4QSrJMcFt9PUI-7I6rJRnwvJJ-SaFvHS1SpNCUsOzp4jhjTwhVD71XwXExn_IBl3R9hqrNGjYjy5tHyWhgmIOvVf4NSuumGc6RR0aSmtxln6wOVzFjkOqU8AW4/s72-c-d/question-mark-1872665_1920.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-4272238960031983878</id><published>2020-07-25T11:12:00.001+05:30</published><updated>2020-07-25T11:22:34.970+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArtificialIntelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Easy Number Plate Scanner Project Using OpenCV</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;h2&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 28.0pt; line-height: 107%;&quot;&gt;Easy
Number Plate Scanner Project Using OpenCV&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Before diving into the project let us discuss the term
Artificial Intelligence, then we will see what is computer vision, and finally
we will start with our project.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtdf44hT5xP3N6Z3v5ZS3PmkhxrINGek5w58cRJ7mX9QMz13U6J1iZs1XWeIyDQIMquQoggP4xObz7X7gqt008kXANUBpZmuViHD2-JEn2hJq1akGGtPEH-2iu3mmo_jn8TDXoevV9n9c/s1600/corvette-171422_1920.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;CAR&quot; border=&quot;0&quot; data-original-height=&quot;1100&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtdf44hT5xP3N6Z3v5ZS3PmkhxrINGek5w58cRJ7mX9QMz13U6J1iZs1XWeIyDQIMquQoggP4xObz7X7gqt008kXANUBpZmuViHD2-JEn2hJq1akGGtPEH-2iu3mmo_jn8TDXoevV9n9c/s1600/corvette-171422_1920.jpg&quot; title=&quot;CAR&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CAR&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: x-large; line-height: 107%;&quot;&gt;What is Artificial Intelligence?&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;The theory and the development of a computer system able
to perform tasks normally requiring human intelligence, such as visual
perceptron, speech recognition, etc.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now let’s divide this term into 2 parts i.e &lt;b&gt;Artificial&lt;/b&gt;
and &lt;b&gt;Intelligence&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;So what do we mean by &lt;b&gt;Artificial&lt;/b&gt;, Anything that
is made by humans things which are not natural and what do we mean by &lt;b&gt;Intelligence&lt;/b&gt;,
It is the ability to understand think and learn. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;When we combine both these terms &lt;b&gt;Artificial&lt;/b&gt; + &lt;b&gt;Intelligence&lt;/b&gt;
we get a field where it seems like machines have human intelligence. The goal
of AI is to mimic the human brain and create systems that can function
intelligently and independently.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHMlzaG5NbMF0dwTLwR-nIQrxZpXu1gSGrpLLrplvl_B1CLB7khvXfakNuhU4o6r6e-pol-W24Jm7Sr076MFRKUAQyNlSPRFhRlPa9VB7fntSDrVNrkGTVxWp8206Y8AtG2IGDSR9Doy0/s1600/anatomy-1751201_1280.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ARTIFICIAL INTELLIGENCE&quot; border=&quot;0&quot; data-original-height=&quot;1088&quot; data-original-width=&quot;1280&quot; height=&quot;544&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHMlzaG5NbMF0dwTLwR-nIQrxZpXu1gSGrpLLrplvl_B1CLB7khvXfakNuhU4o6r6e-pol-W24Jm7Sr076MFRKUAQyNlSPRFhRlPa9VB7fntSDrVNrkGTVxWp8206Y8AtG2IGDSR9Doy0/s640/anatomy-1751201_1280.png&quot; title=&quot;ARTIFICIAL INTELLIGENCE&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;ARTIFICIAL INTELLIGENCE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: x-large; line-height: 107%;&quot;&gt;What is Computer Vision?&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;Human vision is far advance and complex than any
camera on this planet. As the AI field is developing rapidly computer vision plays
an important role in it.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Computer Vision is the way of teaching intelligence to
the machines and making them see things just like humans. So what happens when
a human sees an image, that human will be able to recognize that image through
patterns, colors, etc. So simply we can say that computer vision is what allows
the computer to see and process visual data like humans. Computer vision involves
analyzing images to produce useful information. For example, your face
recognition system can easily detect your face and unlock your phone quite
easily.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Computer vision is a form of Artificial
Intelligence that let’s computer identify things using various algorithms
trained to collect predefined features helping them pick objects out of the crowd
potentially millions of objects with faster and faster recognition.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJbyiE6EYhZF2lMGbfHm5fzG9ZcJjIZ0tF6ZFUQwNht7ZFNTdpdYtJnbzlCb3yV41g_IVTD73irgN71L4CecAdL0N8QJEg6dowgodCyyFJRMQ7P0db0iRqhSG4IKK5ZXxwI23d2fQe2wA/s1600/computer_vision.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;COMPUTER VISION&quot; border=&quot;0&quot; data-original-height=&quot;1067&quot; data-original-width=&quot;1600&quot; height=&quot;426&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJbyiE6EYhZF2lMGbfHm5fzG9ZcJjIZ0tF6ZFUQwNht7ZFNTdpdYtJnbzlCb3yV41g_IVTD73irgN71L4CecAdL0N8QJEg6dowgodCyyFJRMQ7P0db0iRqhSG4IKK5ZXxwI23d2fQe2wA/s640/computer_vision.jpg&quot; title=&quot;COMPUTER VISION&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;COMPUTER VISION&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: x-large; line-height: 107%;&quot;&gt;What is OpenCV?&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;OpenCV stands for &lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;Open Source Computer Vision &lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;it
is a library of programming functions mainly aimed at real-time computer
vision, it is originally developed by &lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;Intel&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt; and it was later supported by
&lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;Willow Garage&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt; and now it’s supported and maintained by &lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;itseez&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbU90cjwOUtSBslYSs1YmVkacR22UqtyrID2nHRHFNz81EDz7rpWp8yAf3NFAEVPBU7tk94oq6lw9iN8H7QnyrJ1DvY2wDbq3XrmcnVKWNVmnpQ0YkE1wYHgE1iilHygAhoZ7joK_kYJE/s1600/Daco_384674.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;OPENCV&quot; border=&quot;0&quot; data-original-height=&quot;739&quot; data-original-width=&quot;600&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbU90cjwOUtSBslYSs1YmVkacR22UqtyrID2nHRHFNz81EDz7rpWp8yAf3NFAEVPBU7tk94oq6lw9iN8H7QnyrJ1DvY2wDbq3XrmcnVKWNVmnpQ0YkE1wYHgE1iilHygAhoZ7joK_kYJE/s400/Daco_384674.png&quot; title=&quot;OPENCV&quot; width=&quot;323&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;OPENCV&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;Now OpenCV is a cross-platform library which means that we
can use it on Mac, Windows, and Linux.&lt;/span&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAOJAjUr8Fe-RTYYeB8vQ7TsQm9TMkCt9jJs3O0c3eIZygw98BFtb8snzyMj1xTkKKo12MCwvEMiUDV8v_ai8bwCtd1XsCsYvUJX0fZfJtIwr8TQLTMJO2IJYSJ-0YSGi2PCVfn_1zdIg/s1600/clipart3018604.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;OPERATING SYSTEMS&quot; border=&quot;0&quot; data-original-height=&quot;462&quot; data-original-width=&quot;423&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAOJAjUr8Fe-RTYYeB8vQ7TsQm9TMkCt9jJs3O0c3eIZygw98BFtb8snzyMj1xTkKKo12MCwvEMiUDV8v_ai8bwCtd1XsCsYvUJX0fZfJtIwr8TQLTMJO2IJYSJ-0YSGi2PCVfn_1zdIg/s400/clipart3018604.png&quot; title=&quot;OPERATING SYSTEMS&quot; width=&quot;365&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;OPERATING SYSTEMS&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;You can work on OpenCV with languages such as &lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;C&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;,
&lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;C++&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;, &lt;/span&gt;&lt;b style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;Python,&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt; etc. Your project will be done using python. OpenCV is
free and Open source, easy to use, and install.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;To install OpenCV just go to the command prompt and
type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;pip
install opencv-python&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;To know more about the image processing by the computer you can read this article, which will help you a lot.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://setosa.io/ev/image-kernels/&quot; style=&quot;background-color: #ffd966;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;https://setosa.io/ev/image-kernels/&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now let’s began with the project, so here is the final output of our project.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3vyy0yLQVtFb8CjjsjAHSahj1ylgtHe9FCJ2C0fM7PngYbAXkmOlKIpnx8z2LzEiHzlMJ1fyTAfjnWPhWJUM522kHQ7fYcG2fk3COtIKyGysIZYuewxOlXjVJbsPCLfwEb7zgN9NOJSg/s1600/numberplate.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FINAL RESULT&quot; border=&quot;0&quot; data-original-height=&quot;898&quot; data-original-width=&quot;1589&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3vyy0yLQVtFb8CjjsjAHSahj1ylgtHe9FCJ2C0fM7PngYbAXkmOlKIpnx8z2LzEiHzlMJ1fyTAfjnWPhWJUM522kHQ7fYcG2fk3COtIKyGysIZYuewxOlXjVJbsPCLfwEb7zgN9NOJSg/s1600/numberplate.png&quot; title=&quot;FINAL RESULT&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FINAL RESULT&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;This project will not only identify the number plate
of the vehicle, but it will take a snap-shot of it and save it in a folder by clicking &quot;&lt;b&gt;S&lt;/b&gt;&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Don’t forget to download this and save it in the same
folder or the folder you want.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://github.com/spmallick/mallick_cascades/blob/master/haarcascades/haarcascade_russian_plate_number.xml&quot; target=&quot;_blank&quot;&gt;harrcascade_russian_plate_number&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;u&gt;This project will be created in &lt;b&gt;five easy steps&lt;/b&gt;&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;Step one&lt;/b&gt;, you will be importing some essential libraries.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;Step two&lt;/b&gt;, you will be creating haarcascade variable.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;Step three,&lt;/b&gt; you will be initializing the variables.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;Step four&lt;/b&gt;, the most important step in this you will be creating a frame and creating an area where the number plate would be cropped in real-time.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; text-align: left;&quot;&gt;&lt;b&gt;Step five,&lt;/b&gt; you will be creating a snap-shot feature where if you click &quot;&lt;b&gt;S&lt;/b&gt;&quot; the snap-shot will be taken of that cropped number plate and saved it in a folder.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 17px;&quot;&gt;

&lt;b&gt;# Import Import Libraries&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;

import cv2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#For computer vision&lt;br /&gt;
import numpy as np &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# provides a high-performance multidimensional array
&lt;br /&gt;&lt;br /&gt;

# ----------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;# Creating Haarcascade Variable&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;

nplateCascade = &lt;br /&gt;cv2.CascadeClassifier(&quot;E:\OpenCV_PROJECT\Resources\haarcascade_russian_plate_number.xml&quot;)
&lt;br /&gt;&lt;br /&gt;

# ---------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;# Initializing Variable&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;


minarea = 500&lt;br /&gt;
count = 0&lt;br /&gt;
framewidth = 6400&lt;br /&gt;
frameheight = 480&lt;br /&gt;
&lt;br /&gt;

# ---------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;# Number Plate Capturing&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;


web_cap = cv2.VideoCapture(0)&lt;br /&gt;
web_cap.set(3,framewidth)&lt;br /&gt;
web_cap.set(4,frameheight)&lt;br /&gt;
web_cap.set(10,1000)  # Brightness id = 10 and 100 intensity level
&lt;br /&gt;&lt;br /&gt;
while True :&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;success, img = web_cap.read()&lt;br /&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)&lt;br /&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numberplates = nplateCascade.detectMultiScale(imgGray, 1.1, 4)  # 4 : minimum neighbour&lt;br /&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Create bounding box&lt;br /&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (x, y, w, h) in numberplates:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;area = w*h&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if area &amp;gt; minarea:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0),2)  # (x,y) : Initial points &amp;amp; (x+w,y+h) : Diagonal points&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.putText(img,&quot;Number plate&quot;,(x,y-5),cv2.FONT_HERSHEY_COMPLEX,1,(255,0,0),2)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;imgRoi = img[y:y+h,x:x+w]  # Region of number plate&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.imshow(&quot;ROI IMAGE&quot;, imgRoi)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# ---------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;b&gt;# Saving Snap-Shot&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.imshow(&quot;Video&quot;,img)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if cv2.waitKey(1) &amp;amp; 0xFF == ord(&quot;s&quot;):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.imwrite(&quot;Resources/scan/NoPlate &quot;+str(count)+&quot;.jpg&quot;,imgRoi)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.rectangle(img,(0,200),(640,300),(0,255,0),cv2.FILLED)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.putText(img,&quot;scan saved&quot;,(150,265),cv2.FONT_HERSHEY_COMPLEX,2,(0,255,0),2)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.imshow(&quot;Result&quot;,img)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cv2.waitKey(5000)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;count += 1&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/4272238960031983878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/07/easy-number-plate-scanner-project-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/4272238960031983878'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/4272238960031983878'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/07/easy-number-plate-scanner-project-using.html' title='Easy Number Plate Scanner Project Using OpenCV'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtdf44hT5xP3N6Z3v5ZS3PmkhxrINGek5w58cRJ7mX9QMz13U6J1iZs1XWeIyDQIMquQoggP4xObz7X7gqt008kXANUBpZmuViHD2-JEn2hJq1akGGtPEH-2iu3mmo_jn8TDXoevV9n9c/s72-c/corvette-171422_1920.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-5608882250320180457</id><published>2020-07-18T14:41:00.001+05:30</published><updated>2020-07-25T11:26:21.082+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>Create ChatBot Easily Using Python</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;h2&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 28.0pt;&quot;&gt;Create ChatBot Project Using Python&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;i&gt;A chatbot is a computer program simulates a conversation between a user and computer through the auditory or textual method, it works as a real conversational partner and eases your work.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQehT9XUhj0OW6-BUlCM_y-aovtQGfljdMGBzcbjWhB2Wxx_gseF3EiK7scflHe7bP9OJB_ec0x9s8NSmV0FR7euIo9XJSdva_Ku0Ny3TS2qpSrjmOaEirbWxaAUERtzenPys6FWBUFOU/s1600/chatbot-4071274_1920.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Chatbot&quot; border=&quot;0&quot; data-original-height=&quot;1015&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQehT9XUhj0OW6-BUlCM_y-aovtQGfljdMGBzcbjWhB2Wxx_gseF3EiK7scflHe7bP9OJB_ec0x9s8NSmV0FR7euIo9XJSdva_Ku0Ny3TS2qpSrjmOaEirbWxaAUERtzenPys6FWBUFOU/s1600/chatbot-4071274_1920.jpg&quot; title=&quot;Chatbot&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;CHATBOT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;Now
let’s take the real-world example of this, I would be sure that you all know
about Siri, Alexa, OkGoogle, Cortana, or even Natasha from the hike. They all are
complicated chatbots which are made with the power of Deep Learning (Neural
Network). Which actually makes them smart, quick to respond, and accurate.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;You
would be surprised that the chatbot is not new to us the first of it’s kind
was developed in 1966 called ELIZA.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDWppn0jODTHgpfIaNH6Jt_vBbnUeKt5QrlnquB_i9mqrT-OHNQA4XTCgyyAdh9lodHeeU0Z-ujy01RWuTTCqoKeUxiLojlENwljfEbk3647ykEXos4SRLzjDByUIxolr7yBeIbaFvmrg/s1600/elizabot.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ELIZA&quot; border=&quot;0&quot; data-original-height=&quot;364&quot; data-original-width=&quot;517&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDWppn0jODTHgpfIaNH6Jt_vBbnUeKt5QrlnquB_i9mqrT-OHNQA4XTCgyyAdh9lodHeeU0Z-ujy01RWuTTCqoKeUxiLojlENwljfEbk3647ykEXos4SRLzjDByUIxolr7yBeIbaFvmrg/s1600/elizabot.jpg&quot; title=&quot;ELIZA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;text-indent: 48px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ELIZA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 144.0pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36.0pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;This chatbot was developed by &lt;b&gt;Sir Joseph Weizenbaum&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;img alt=&quot;Sir Joseph Weizenbaum&quot; border=&quot;0&quot; data-original-height=&quot;205&quot; data-original-width=&quot;154&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizKYw7JqXAOaOfiOIr-vJom80moql2INRLQw9akeX7HzdJpO4CsS_NddERWbkFHFH3JptkRjbSIU3M0sgG71PhjQ7QFomOly9oJfq3oJD1L36x5E78zbA7qUGfnX4JXCXpGoYz9NL77ik/s1600/joseph.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot; title=&quot;Sir Joseph Weizenbaum&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Sir Joseph Weizenbaum&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;If
you want to want to know more about the history of this, you can check out this
link &lt;a href=&quot;https://analyticsindiamag.com/story-eliza-first-chatbot-developed-1966/&quot; target=&quot;_blank&quot;&gt;&lt;i style=&quot;background-color: #fff2cc;&quot;&gt;History Of Chatbots&lt;/i&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;Now
talking about the evolution of chatbots it took a very drastic turn during this
decades and the future of the chatbots looks very promising as well, chatbots
are expected to complete around 80% of all the works in the coming decade.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;The task that is completed by the chatbots includes simply giving out the
information or booking tickets etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;Whenever
we are making chatbot we have to consider a few things such as we should know our
target audience and we must understand the natural language of communication as
well.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;What
we are going to create?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi0Yry2WtCXUjUilF_SUFh5iIMyxrESzbiQYsV1E3Wo9wFKHO-39kNLffaswDdC0H3fEujme-M2quw9JSKd0Lq5MRicTkFBfzFVZ8uhO3TnZbADYmQTUf8u3tUhVuzXNweh79Gbbv5wdc/s1600/chatbot_theme.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FINAL CHATBOT APPLICATION&quot; border=&quot;0&quot; data-original-height=&quot;857&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi0Yry2WtCXUjUilF_SUFh5iIMyxrESzbiQYsV1E3Wo9wFKHO-39kNLffaswDdC0H3fEujme-M2quw9JSKd0Lq5MRicTkFBfzFVZ8uhO3TnZbADYmQTUf8u3tUhVuzXNweh79Gbbv5wdc/s1600/chatbot_theme.png&quot; title=&quot;FINAL CHATBOT APPLICATION&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FINAL CHATBOT&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;APPLICATION&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;The
chatbot which we are going to create can be used by any organization or community,
but for example, we are going to create a chatbot specifically for the Computer
Science Departement of college where parents will be able to know all the
details about the CS department with the help of a chatbot. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;We
are going to create a chatbot application using:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-&amp;nbsp;&lt;b&gt;Python&lt;/b&gt;:
Programming Language (&lt;b&gt;Version: 3.6&lt;/b&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-&amp;nbsp;&lt;b&gt;Chatterbot&lt;/b&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* Library
in python which generates the responses to the user input.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* It
uses a number of machine learning algorithms to produce a variety of responses.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* It
is easy to use and implement.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* With
the help of chatterbot library we can train our chatbot in multiple languages it
supports languages such a Hindi, English, Spanish, etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* It
easily get trained.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;If
you want to know more about ChatterBot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;Click
Here: &lt;a href=&quot;https://chatterbot.readthedocs.io/en/stable/&quot; target=&quot;_blank&quot;&gt;&lt;i style=&quot;background-color: #fff2cc;&quot;&gt;ChatterBot&lt;/i&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-&amp;nbsp;&lt;b&gt;Tkinter&lt;/b&gt;:
Python GUI ( Graphical User Interface ) Library.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-&amp;nbsp;&lt;b&gt;Notepad&lt;/b&gt;:
To save our questions and user queries.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-&amp;nbsp;&lt;b&gt;Pycharm&lt;/b&gt;:
IDE ( Integrated Development Environment ).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Let’s
start to create a chatbot from scratch steps&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;[ THE WHOLE PROJECT WILL BE CREATED IN WINDOWS &amp;amp; ALL THE STEPS WILL BE RESPECT TO
WINDOWS USERS ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;* Install
PyCharm in your system:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.jetbrains.com/pycharm/&quot; target=&quot;_blank&quot;&gt;&lt;i style=&quot;background-color: #fff2cc;&quot;&gt;PyCharm&lt;/i&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;* Go
to start Enter “&lt;b&gt;cmd&lt;/b&gt;”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;a&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Type “ &lt;b&gt;pip
install chatterbot&lt;/b&gt; ” after installation &lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;à&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt; Type “ &lt;b&gt;pip install&lt;/b&gt; &lt;b&gt;chatterbot_corpus&lt;/b&gt; ”&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;[ WHILE
INSTALLING “&lt;b&gt;chatterbot&lt;/b&gt; &amp;amp; &lt;b&gt;chatterbot_corpus&lt;/b&gt;” PLEASE SELECT THE
SAME PYTHON VERSION WHICH YOU ARE GOING TO USE ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*Now
open your PyCharm :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;-Create
a new python file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;-Now
click on &lt;b&gt;file a setting&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;a&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt; Project: your_proj_name &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;a&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt; Project Interpreter &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;a&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;click on “&lt;b&gt; + &lt;/b&gt;” at the right side of the
window a&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;Now search and
install the libraries:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*chatterbot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*chatterbot-corpus&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*PyAudio&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*NumPy&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*pypiwin32&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*pyttsx3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*pywin32&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;*PyYAML&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;All
the required file will be available here :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;a href=&quot;https://github.com/Vegadhardik7/MY_CHATBOT_PROJECT&quot; style=&quot;background-color: #fff2cc;&quot; target=&quot;_blank&quot;&gt;chatbotdata&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;After
all the steps you had done if you still get errors like these here are it’s
solutions:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Error_1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;from chatterbot_corpus.corpus import
DATA_DIRECTORY&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;modulenotfounderror: no module named
&#39;chatterbot_corpus&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Solution&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;(i)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Go
to: https://github.com/gunthercox/chatterbot-corpus&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(ii) Click on download or clone a file &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(iii) Download Zip&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(iv) Save it at a certain location &amp;gt; unzip
it&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(v)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Copy chatterbot_corpus folder from the unzipped file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(vi) Go to My_project(your_project_location)
&amp;gt; venv &amp;gt; Lib &amp;gt; site-packages ;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Now paste that chatterbot_corpus&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;problem
solved.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Error_2&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;import pythoncom&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;ModuleNotFoundError : No module name
&#39;pythoncom&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Solution&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;(i)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Open Pycharm&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(ii) Go to file &amp;gt; settings &amp;gt;
Project:(Project_name) &amp;gt; Project&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;Interpreter &amp;gt; Click on the (+) which is
near scrollbar.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(iii)search (pypiwin32) &amp;gt; install it&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;(iv) close all tab &amp;amp; import this into
your project &amp;gt; import win32com.client&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;problem
solved.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Error_3&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;Error in set_trainer in chatterbot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;I think the set_trainer was removed. You have
to use the training method&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;from chatterbot import ChatBot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;from chatterbot.trainers import
ChatterBotCorpusTrainer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;chatbot = ChatBot(&#39;Ron Obvious&#39;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;# Create a new trainer for the chatbot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;trainer = ChatterBotCorpusTrainer(chatbot)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;# Train the chatbot based on the English
corpus&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;trainer.train(&quot;chatterbot.corpus.english&quot;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;# Get a response to an input statement&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;chatbot.get_response(&quot;Hello,
how are you today?&quot;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;problem
solved.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt;&quot;&gt;Now
let’s start to create our chatbot:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Create a file where you would save all the files and go to your PyCharm and paste this code:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;from chatterbot import ChatBot&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
from chatterbot.trainers import ListTrainer&lt;br /&gt;
from chatterbot.logic import logic_adapter&lt;br /&gt;
from tkinter import *&lt;br /&gt;
from tkinter import font&lt;br /&gt;
from tkinter import messagebox&lt;br /&gt;
import speech_recognition as s&lt;br /&gt;
import threading&lt;br /&gt;
import pyaudio&lt;br /&gt;
import pyttsx3 as pp&lt;br /&gt;
import win32com.client&lt;br /&gt;
import os&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;

main=Tk()&lt;br /&gt;
frame = Frame(main)&lt;br /&gt;
ment=StringVar()&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
main.geometry(&quot;500x700&quot;)&lt;br /&gt;
main.title(&quot;CS Department&quot;)&lt;br /&gt;
img=PhotoImage(file=&#39;unnamed.png&#39;)&lt;br /&gt;
photo=Label(main,image=img)&lt;br /&gt;
photo.place(x=1,y=440)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
eng=pp.init()&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
voices = eng.getProperty(&#39;voices&#39;)&lt;br /&gt;
print(voices)&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
i=IntVar()&lt;br /&gt;&lt;br /&gt;
def speak(word):&lt;br /&gt;
    if i.get()==1:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.setProperty(&#39;voice&#39;, voices[0].id)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.say(word)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.runAndWait()&lt;br /&gt;&lt;br /&gt;
    elif i.get()==2:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.setProperty(&#39;voice&#39;, voices[1].id)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.say(word)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.runAndWait()&lt;br /&gt;&lt;br /&gt;
    else:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eng.runAndWait()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;br /&gt;

lbl=Label(main,text=&quot;Select Gender of voice :&quot;,font=40).place(x=100,y=50)
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
r1=Radiobutton(main,text=&quot;Male Voice&quot;,value=1,variable=i,command=speak,font=35).place(x=100,y=100)
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
r2=Radiobutton(main,text=&quot;Female Voice&quot;,value=2,variable=i,command=speak,font=35).place(x=100,y=150)
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
r3=Radiobutton(main,text=&quot;Sound ON/OF&quot;,value=3,variable=i,command=speak,font=35).place(x=100,y=200)
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
#import conversation&lt;br /&gt;
chatbot=ChatBot(&#39;Bot&#39;)&lt;br /&gt;
&lt;br /&gt;
for _file in os.listdir(&#39;files&#39;):&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; chats=open(&#39;files/&#39; + _file,&#39;r&#39;).readlines()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; trainer = ListTrainer(chatbot)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; trainer.train(chats)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sy=Scrollbar(main)&lt;br /&gt;
&lt;br /&gt;
fnt = font.Font(size=10)&lt;br /&gt;&lt;br /&gt;
lbl2=Label(main,text=&quot;List of Questions you may ask :&quot;,font=35).place(x=1150,y=15)&lt;br /&gt;&lt;br /&gt;
txt=Listbox(main,width=55,height=44,font=fnt,yscrollcommand=sy.set, bd=5)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;

txt.insert(1,&quot;  ADMISSION INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(2,&quot;\n&quot;)&lt;br /&gt;
txt.insert(3,&quot; what is the registration process&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(4,&quot; what document will be required&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(5,&quot; what are the timing for admission&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(6,&quot; Form where do we have to collect forms&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(7,&quot; How to fill form&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(8,&quot; can we cancel admission&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(9,&quot; Refund&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(10,&quot;\n&quot;)&lt;br /&gt;
txt.insert(11,&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(12,&quot;  FEES INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(13,&quot;\n&quot;)&lt;br /&gt;
txt.insert(14,&quot; What is the Fees for computer science&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(15,&quot; what document will be required&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(16,&quot; Fees for open categories&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(17,&quot; What is Fees for NT cast&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(18,&quot; Whats is Fees for Other Backward Class&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(19,&quot; What is the Fees for extracurricular activities&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(20,&quot;\n&quot;)&lt;br /&gt;
txt.insert(21,&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(22,&quot;  EXTRACURRICULAR INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(23,&quot;\n&quot;)&lt;br /&gt;
txt.insert(24,&quot; extracurricular activities are there in you college&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(25,&quot; what document will be required&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(26,&quot; what link of extracurricular activities will be provided&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(27,&quot; how will extracurricular activities will help to my child&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(28,&quot;\n&quot;)&lt;br /&gt;
txt.insert(29,&quot;\n&quot;)&lt;br /&gt;
txt.insert(30,&quot;  CONCESSION INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(31,&quot;\n&quot;)&lt;br /&gt;
txt.insert(32,&quot; what kind of concession will be provided&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(32,&quot; Any specific concession for girls&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(33,&quot;\n&quot;)&lt;br /&gt;
txt.insert(34,&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(35,&quot;  PAYMENT INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(36,&quot;\n&quot;)&lt;br /&gt;
txt.insert(37,&quot; What are the Payment procedure&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(38,&quot; Can payment be done in installment&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(39,&quot; Do you support UPI&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(40,&quot; Any cash back is available for specific bank&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(41,&quot;\n&quot;)&lt;br /&gt;
txt.insert(42,&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(43,&quot;  STAFF INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(44,&quot;\n&quot;)&lt;br /&gt;
txt.insert(45,&quot; how is your teaching staff&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(46,&quot; how teachers will inform us about our childs progress&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(47,&quot; how technically advance are you laboratory&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(48,&quot; what placement opportunity will be provided to over child&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(49,&quot;\n&quot;)&lt;br /&gt;
txt.insert(50,&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;
txt.insert(51,&quot;  CONTACT INFORMATION:  &quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(52,&quot;\n&quot;)&lt;br /&gt;
txt.insert(53,&quot; I need a help&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(54,&quot; what is your contact number&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(55,&quot; Help&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(56,&quot; How can I contact you&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(57,&quot; how can I get further information&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(58,&quot; I do not get you&quot;+&quot;\n&quot;)&lt;br /&gt;
txt.insert(59,&quot; calling which number might help me&quot;+&quot;\n&quot;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;

txt.config()&lt;br /&gt;
sy.pack(side=RIGHT,fill=Y)&lt;br /&gt;
txt.place(x=1125,y=45)&lt;br /&gt;&lt;br /&gt;

#I do not get you&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;
lbl3=Label(main,text=&quot;Help us to Advance, Enter your unanswered Query :&quot;,font=35).place(x=525,y=585)&lt;br /&gt;
# txt1=Entry(main,bd=5,width=20)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
# txt1.place(x=515,y=580)&lt;br /&gt;&lt;br /&gt;

txt1 = Entry(main,font=10, bd=5)&lt;br /&gt;
txt1.place(width=500,height=50,x=515,y=650)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;



def Unsolved():&lt;br /&gt;
    q = txt1.get()&lt;br /&gt;&lt;br /&gt;

    if len(q) &amp;lt; 5 :&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; messagebox.showinfo(&quot;Error&quot;,&quot;Please Enter Your Unsolved Query&quot;)&lt;br /&gt;
    else:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; f=open(&#39;Unsolved_Query.txt&#39;,&#39;a&#39;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; f.write(q+&quot;\n&quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; f.close()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; messagebox.showinfo(&quot;Congratulations&quot;, &quot;Your Query is Accepted Successfully&quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; txt1.delete(0, END)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;



btn1=Button(main, text=&quot;Enter Query&quot;, font=(&quot;Times&quot;, 16),command=Unsolved).place(x=710,y=710)&lt;br /&gt;&lt;br /&gt;

sc=Scrollbar(frame)&lt;br /&gt;
scx=Scrollbar(frame,orient=HORIZONTAL)&lt;br /&gt;&lt;br /&gt;

msg=Listbox(frame,width=100,height=25,yscrollcommand=sc.set,xscrollcommand=scx.set, bd=5)&lt;br /&gt;
scx.pack(side=BOTTOM,fill=X)&lt;br /&gt;&lt;br /&gt;

scx.config(command=msg.xview)&lt;br /&gt;
msg.config()&lt;br /&gt;&lt;br /&gt;

msg.pack(side=LEFT,fill=BOTH,pady=10)&lt;br /&gt;
sc.pack(side=RIGHT,fill=Y)&lt;br /&gt;
frame.pack()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;

def take_query():&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sr=s.Recognizer()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sr.pause_threshold=1&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; print(&quot;Your Bot is listening try to speak&quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; with s.Microphone() as m:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; audio = sr.listen(m)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; question = sr.recognize_google(audio, language=&#39;eng-in&#39;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(question)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text.delete(0, END)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text.insert(0, question)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Ask_from_Bot()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except Exception as e:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(e)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(&quot;Not recognized&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;def Ask_from_Bot():&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; question = text.get()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if question == &#39;Bye&#39; or question == &#39;bye&#39;:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(&quot;ChatBot:Bye&quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; main.destroy()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = chatbot.get_response(question)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; msg.insert(END, &quot;You : &quot; + question + &#39;\n&#39;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(type(ans))&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; msg.insert(END, &quot;Bot : &quot; + str(ans))&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; speak(ans)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text.delete(0, END)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; msg.xview()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; msg.yview(END)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;


# Creating a text field&lt;br /&gt;
text = Entry(main, bd=5,font=(&quot;Times&quot;, 15))&lt;br /&gt;
text.place(x=650,y=450,width=220,height=35)&lt;br /&gt;&lt;br /&gt;

btn = Button(main, text=&quot;Ask From Bot&quot;, font=(&quot;Times&quot;, 16), command=Ask_from_Bot)&lt;br /&gt;
btn.place(x=695,y=510)&lt;br /&gt;
&lt;br /&gt;
# Press Enter &amp;amp; get Output&lt;br /&gt;
def Enter_fun(event):&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; btn.invoke()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;


# going to bind the main window with entering key&lt;br /&gt;&lt;br /&gt;

main.bind(&#39;&lt;return&gt;&#39;, Enter_fun)&lt;br /&gt;
def repeatL():&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while True:&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; take_query()&lt;br /&gt;t=threading.Thread(target=repeatL)&lt;/return&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;return&gt;t.start()&lt;br /&gt;
main.mainloop()&lt;br /&gt;








&lt;/return&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Before executing this code first go to the location where all the files are saved, create a new &lt;b&gt;Notepad&lt;/b&gt; file name it &lt;b&gt;Unsolved_Query.txt&lt;/b&gt;, now at the same location creates a folder named&amp;nbsp;&lt;b&gt;&amp;nbsp;files &lt;/b&gt;in that folder create new txt files names:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;- admission.txt&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;- consession.txt&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;- contact.txt&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;-&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;extracurricularactivities.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;- fees.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;- greeting.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;- payment.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;- teachingstaff.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;[ ALL THE FILES WHICH ARE MENTIONED, ARE ALREADY IN THE LINK ABOVE IN THE &quot;&lt;b&gt;chatbotdata&lt;/b&gt;&quot; LINK. ]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;Now let&#39;s discuss all the steps :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;b&gt;[ CODE EXPLANATION ]&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;In the initial step, we imported all the important libraries let&#39;s discuss all the libraries one by one.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;→&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;chatterbot &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;ChatBot&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;ChatterBot is a python library that makes it easy to generate automated responses to a user&#39;s input. Before we do anything else, ChatterBot needs to be imported. The import for ChatterBot should look like as mentioned above.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;chatterbot.trainers &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;ListTrainer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;If you want to create a list of conversation in your code directly like this;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;box-sizing: border-box; color: #404040; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; line-height: 1.4; overflow: auto; padding: 12px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s1&quot; style=&quot;box-sizing: border-box; color: #4070a0;&quot;&gt;&#39;How are you?&#39;&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot; style=&quot;box-sizing: border-box; color: #4070a0;&quot;&gt;&#39;I am good.&#39;&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot; style=&quot;box-sizing: border-box; color: #4070a0;&quot;&gt;&#39;That is good to hear.&#39;&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot; style=&quot;box-sizing: border-box; color: #4070a0;&quot;&gt;&#39;Thank you&#39;&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot; style=&quot;box-sizing: border-box; color: #4070a0;&quot;&gt;&#39;You are welcome.&#39;&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;box-sizing: border-box; color: #404040; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; line-height: 1.4; overflow: auto; padding: 12px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;]&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;you can use this but in our project, we had created a Folder named as a &lt;b&gt;file&lt;/b&gt; in which we had we had created multiple&amp;nbsp;&lt;b&gt;.txt&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;files that hold your conversation.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;chatterbot.logic &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;logic_adapter&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Logic adapters determine the logic for how ChatterBot selects a response to a given input statement. But in our project, we didn&#39;t implement this because it&#39;s a simply enquire chatbot not a chatbot for reasoning. So this import is &lt;b&gt;optional&lt;/b&gt; &lt;b&gt;in our project&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;tkinter &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Tkinter to create a graphical user interface for the end-user.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;tkinter &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;font&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;This import is for font various fonts.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;from &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;tkinter &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;messagebox&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Tkinter to create a graphical user interface for the end-user. This import is used to create a messagebox where our conversation will be placed.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;speech_recognition &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;as &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;This import is used for speech recognition before using this import you have to install it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: rgba(0 , 0 , 0 , 0.15); font-family: &amp;quot;source code pro&amp;quot; , monospace; font-size: 19.2px;&quot;&gt;pip install SpeechRecognition&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;threading&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Python threading allows you to have different parts of the program run concurrently and can simplify your design.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;pyaudio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;With PyAudio, you can easily use Python to play and record audio on a variety of platforms such as Linux, Mac, and Windows.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Before using this import you have to install it.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: rgba(0 , 0 , 0 , 0.15); font-family: &amp;quot;source code pro&amp;quot; , monospace; font-size: 19.2px;&quot;&gt;pip install PyAudio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: rgba(0 , 0 , 0 , 0.15); font-family: &amp;quot;source code pro&amp;quot; , monospace; font-size: 19.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&amp;nbsp;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;pyttsx3 &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;as &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;pp&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;pyttsx3&lt;/b&gt; is a text-to-speech conversation library in python. Unlike alternative libraries, it works offline and is compatible with both Python 2 and 3.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Before using this import you have to install it.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: rgba(0 , 0 , 0 , 0.15); font-family: &amp;quot;source code pro&amp;quot; , monospace; font-size: 19.2px;&quot;&gt;pip install pyttsx3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: rgba(0 , 0 , 0 , 0.15); font-family: &amp;quot;source code pro&amp;quot; , monospace; font-size: 19.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&amp;nbsp;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;win32com.client&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;consolas&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;It is an essential library which is used to avoid a certain error in our program.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: xx-large;&quot;&gt;→&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: large;&quot;&gt;&lt;b style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;consolas&amp;quot;; font-size: 20.0pt; line-height: 107%;&quot;&gt;import &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 20pt; line-height: 107%;&quot;&gt;os&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;The &lt;b&gt;os&lt;/b&gt; module is used to read and write file directly.&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;pre style=&quot;background-color: white; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;After importing all the libraries&amp;nbsp; we will create a object of chatbot&amp;nbsp; and we named that object as &lt;b&gt;chatbot &lt;/b&gt;and named your bot as &lt;b&gt;Bot&lt;/b&gt;. Now we will create a list trainer object which we named as &lt;b&gt;trainer &lt;/b&gt;but as we are going to have our conversation in .txt format we would read our folder named as &lt;b&gt;files &lt;/b&gt;which contains all our .txt files, which will help you chatbot to learn.&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;
&lt;/span&gt;&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px; white-space: normal;&quot;&gt;We would also a function named as speak in which will help us to get the audio output both in male voice or female voice, for that we had created a radio button by clicking which the output will be get as male voice or female voice.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;
&lt;/span&gt;&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px; white-space: normal;&quot;&gt;For end users we would also create a Listbox where we will show them what kind of conversations that they can do with our bot.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;
&lt;/span&gt;&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px; white-space: normal;&quot;&gt;If any user didn&#39;t get appropriate out put or have any query they can post them in the textbox, where all the queries which are enteried by the end user will be saved in the &lt;b&gt;Unsolved_Query.txt &lt;/b&gt;than when the developer want to update the chatbot they can add the unsolved or unanswered queries which are constantly asked by the end user.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;
&lt;/span&gt;&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;With the help of the microphone user can even use speech in english to have a nice conversation with our chatbot this speech feature is availabe in the &lt;b&gt;take_query()&lt;/b&gt; function.&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;
&lt;/span&gt;&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;And if end user type &lt;b&gt;bye&lt;/b&gt;&amp;nbsp;at the end of the conversation the chatbot will automatically get closed.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px; white-space: normal;&quot;&gt;So we hope that you enjoyed this project. If you did then please share it with your friends and shpread this knowledge.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;b&gt;Follow us at :&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Facebook :&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Twitter :&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;


&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/5608882250320180457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/07/create-chatbot-easily-using-python.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5608882250320180457'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/5608882250320180457'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/07/create-chatbot-easily-using-python.html' title='Create ChatBot Easily Using Python'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQehT9XUhj0OW6-BUlCM_y-aovtQGfljdMGBzcbjWhB2Wxx_gseF3EiK7scflHe7bP9OJB_ec0x9s8NSmV0FR7euIo9XJSdva_Ku0Ny3TS2qpSrjmOaEirbWxaAUERtzenPys6FWBUFOU/s72-c/chatbot-4071274_1920.jpg" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-2557559036237009570</id><published>2020-07-15T16:59:00.001+05:30</published><updated>2020-07-27T11:19:32.043+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="DeepLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>Google Stock Price Prediction Using RNN - LSTM Python</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;h2&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 28.0pt; line-height: 107%;&quot;&gt;&lt;u&gt;&lt;b&gt;Google Stock Price Prediction Using RNN - LSTM Python&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 25.68px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 25.68px;&quot;&gt;In this article, we are going to look at an outstanding end-to-end real-life Recurrent Neural Network (RNN) - LSTM project where we will predict the price of google stock. We will be using Python, Keras, Jupyter Notebook, and Tensorflow for this project.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 25.68px;&quot;&gt;Before directly diving into the code let’s have an overview of the topics such as RNN and LSTM network.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 6;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbllRCISM9MAFMEK2_O0bASCoBixFLKABPX5bdcuJ2njVxgGDGTXt9Yi2MKMVK1CthQ7-VP7L0nmQDsz1xis85goe4Upq7kQmxo2SYDDkt0zIGwFXvZYVhzyCrQF3t7p3-UFvh83H341s/s1600/stocks.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;stocks_image&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbllRCISM9MAFMEK2_O0bASCoBixFLKABPX5bdcuJ2njVxgGDGTXt9Yi2MKMVK1CthQ7-VP7L0nmQDsz1xis85goe4Upq7kQmxo2SYDDkt0zIGwFXvZYVhzyCrQF3t7p3-UFvh83H341s/s640/stocks.jpg&quot; title=&quot;stocks_image&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;STOCKS IMAGE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Q.)What is RNN?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;b&gt;RNN&lt;/b&gt; also is known as &lt;b&gt;Recurrent Neural
Network&lt;/b&gt; has unique properties that allow them to be more effective for
sequence data, sequence data can be a variety of data sources it can be anything
from timestamps sales data or sequence of text in a sentence or biological data
like heartbeat data overtime etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Basically, RNN helps us to predict future sequential data more accurately which learns from history.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;To do this properly, we need to
somehow let the neuron “Know ” about its previous history of outputs. One of
the easy ways to do this is to simply feed it’s output back into itself as an
input.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Let’s look at the normal neuron in
feed-forward network&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-bookmark: _Hlk45532546;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 4;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmsN4VHGVVyYBEbSWILtHSmcJ3rbJE94HnwWVCuqAwfCzKF8wAVy559YY5mMasIzIi8v59iD-fRVa96IEMvtn0lUEsFvaSCHuAavbzKQjKppUjeLUpxplnijbD_uP8k0efjO66dptuivs/s1600/neuron.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img alt=&quot;Neuron&quot; border=&quot;0&quot; data-original-height=&quot;512&quot; data-original-width=&quot;578&quot; height=&quot;353&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmsN4VHGVVyYBEbSWILtHSmcJ3rbJE94HnwWVCuqAwfCzKF8wAVy559YY5mMasIzIi8v59iD-fRVa96IEMvtn0lUEsFvaSCHuAavbzKQjKppUjeLUpxplnijbD_uP8k0efjO66dptuivs/s400/neuron.png&quot; title=&quot;Neuron&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;NEURON&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; mso-tab-count: 4;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now how we
will take advantage of being able to relay back the history with a neuron?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSk3kyLce0VdpapO_L_ZXOIHkUEYiPR24RMhCVwzZ5s2VT0e5qTwAW-f53wFTX0xpbwxTUWZNQwyO-nIHIXaDmrcP-sekSUIz3mnGl8z9i_HP2RK6c-gz_uhGQDEhFF9WXaYHHO9wWeWg/s1600/neuron_inverse.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;493&quot; data-original-width=&quot;564&quot; height=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSk3kyLce0VdpapO_L_ZXOIHkUEYiPR24RMhCVwzZ5s2VT0e5qTwAW-f53wFTX0xpbwxTUWZNQwyO-nIHIXaDmrcP-sekSUIz3mnGl8z9i_HP2RK6c-gz_uhGQDEhFF9WXaYHHO9wWeWg/s400/neuron_inverse.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NEURON INVERSE&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Here we can
use a Recurrent Neuron. In Recurrent Neuron the main difference here not only sends the output out to the next layer, it takes that output and feeds it back
to itself. So over time, we can unroll this.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now go one
timestamp into the past at Time(t-1) so as you can see we have some input
coming in at t-1 this can be batch of sequence data which are aggregated and
passed to the activation function and we get the output of this Recurrent a neuron at t-1.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLooOG_ayspmX-26LB1cNG0gGWjzmelgXW7kJ5Pprcd5FTeRZnqvTFM0F9f9pNm-QcXL8rfj7gV4WEjR6iBBg2yfgoWEwNd0-FVQ6msjWSyJt3mAy7qrjZdtQERNkOBW2Q9dlVFa5wwCw/s1600/further_neuron.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FUTURE NEURON&quot; border=&quot;0&quot; data-original-height=&quot;550&quot; data-original-width=&quot;982&quot; height=&quot;356&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLooOG_ayspmX-26LB1cNG0gGWjzmelgXW7kJ5Pprcd5FTeRZnqvTFM0F9f9pNm-QcXL8rfj7gV4WEjR6iBBg2yfgoWEwNd0-FVQ6msjWSyJt3mAy7qrjZdtQERNkOBW2Q9dlVFa5wwCw/s640/further_neuron.png&quot; title=&quot;FUTURE NEURON&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FUTURE NEURON&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;As time goes
on we end up doing for that next input batch of another sequence or input at
time t, here we are not only going to feed in the input at time t but we also
feed in the information of the output of Recurrent neuron times (t-1) which
then give us the output at time t. Then we take that output at time t and feed
it along with the input at a time (t+1) that way we are retaining the historical
information. This is the Recurrent neuron essentially unrolled throughout
time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhar-I1qGR9z5WGoTzvTA_wIjotpcjPkTnbr2llYw4nl4uuupH8rR-ooZRbpjVfoa-TyvZ7lQQqWmcIl8R6c1ptuGeGp5QeH8aCayyTW_cPKSom3WAVv382WLkY8m86VRJhipioLN7E_Jc/s1600/rnn.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;RECURRENT NEURON&quot; border=&quot;0&quot; data-original-height=&quot;638&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhar-I1qGR9z5WGoTzvTA_wIjotpcjPkTnbr2llYw4nl4uuupH8rR-ooZRbpjVfoa-TyvZ7lQQqWmcIl8R6c1ptuGeGp5QeH8aCayyTW_cPKSom3WAVv382WLkY8m86VRJhipioLN7E_Jc/s1600/rnn.png&quot; title=&quot;RECURRENT NEURON&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RECURRENT NEURON&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Cells that
are a function of inputs from previous time steps are known as memory cells.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;RNN is also
flexible in their inputs and outputs, for both sequence and single vector
values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;We can
actually, create entire layers of Recurrent Neurons.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Here is an
simple diagrammatic representation of it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;(Artificial
Neural Network) ANN&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;
:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi98tHdTlf12bhiThDlMfxRhWTkyooKuxRGH9uTI7JmmbzUX4ERwrgmoM06JzVZBMlfLodtsDooTu4U9C6XgtXFAZhPH8y62P0C40vJNDBCkaveaHKLegkleHPCOCksxITBf-PYz9NGzH8/s1600/ann.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;NORMAL ANN&quot; border=&quot;0&quot; data-original-height=&quot;623&quot; data-original-width=&quot;1314&quot; height=&quot;302&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi98tHdTlf12bhiThDlMfxRhWTkyooKuxRGH9uTI7JmmbzUX4ERwrgmoM06JzVZBMlfLodtsDooTu4U9C6XgtXFAZhPH8y62P0C40vJNDBCkaveaHKLegkleHPCOCksxITBf-PYz9NGzH8/s640/ann.png&quot; title=&quot;NORMAL ANN&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NORMAL ANN&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;(Recurrent
Neural Network) RNN&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;
:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMeU5trYEFv1yCmBcHVBEEqiED9uNeL1ESBAryB4EWdi8ZlZd9Hv2GBDsW1GoYe-GdWbcTqX_JzMRQppqvSXIjjn6m7fqiP3tdIPlgRuvwLZwhHtW3m7GoZK587LJAqt9cVta_14jDEs/s1600/rnn_neural_network.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;NORMAL RNN&quot; border=&quot;0&quot; data-original-height=&quot;675&quot; data-original-width=&quot;1289&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMeU5trYEFv1yCmBcHVBEEqiED9uNeL1ESBAryB4EWdi8ZlZd9Hv2GBDsW1GoYe-GdWbcTqX_JzMRQppqvSXIjjn6m7fqiP3tdIPlgRuvwLZwhHtW3m7GoZK587LJAqt9cVta_14jDEs/s640/rnn_neural_network.png&quot; title=&quot;NORMAL RNN&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NORMAL RNN&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now we can
just unroll this layer in the same fashion. We pass input as time t = 0 into the
layer and then the output of the layer is time t+1, than t+2, and so on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8RzUvfHvOUF5157yWk7VTh8dWQffEZUt_okMFqYRveO6YkJpRh-q3JZAkaDCT44Bm2o2I-grVRxn4r8NqrZ54Ly2b6IU7aEAUcj8_b979TbnaT21HRVUHim92NW0uggm9K4KX2Ceqc64/s1600/rnn_roll.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;RNN UNROLLED LAYER&quot; border=&quot;0&quot; data-original-height=&quot;687&quot; data-original-width=&quot;1236&quot; height=&quot;354&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8RzUvfHvOUF5157yWk7VTh8dWQffEZUt_okMFqYRveO6YkJpRh-q3JZAkaDCT44Bm2o2I-grVRxn4r8NqrZ54Ly2b6IU7aEAUcj8_b979TbnaT21HRVUHim92NW0uggm9K4KX2Ceqc64/s640/rnn_roll.png&quot; title=&quot;RNN UNROLLED LAYER&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RNN UNROLLED LAYER&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;As I have
mentioned earlier that the RNN are very flexible in their inputs and outputs.
There are different types of architectures we can use here. Let’s see some of
them:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;b&gt;1.) Sequence
to Sequence (Many to Many):&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxGY0l9OflBSPUBERGLjaWH7iLM6DSjP3NSLbaiO1JaiFQAchVF5f6d8QskY_ozs9KHqP1pLqffNoNnFBVWZXi72bAaaWpmPov9MhOrDcofTkcsh5C6PVDda3z8cEMHDKm97h5bAGD7Ec/s1600/s_to_s.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SEQUENCE TO SEQUENCE&quot; border=&quot;0&quot; data-original-height=&quot;528&quot; data-original-width=&quot;1467&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxGY0l9OflBSPUBERGLjaWH7iLM6DSjP3NSLbaiO1JaiFQAchVF5f6d8QskY_ozs9KHqP1pLqffNoNnFBVWZXi72bAaaWpmPov9MhOrDcofTkcsh5C6PVDda3z8cEMHDKm97h5bAGD7Ec/s1600/s_to_s.png&quot; title=&quot;SEQUENCE TO SEQUENCE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SEQUENCE TO SEQUENCE&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;In this, you
pass in a sequence and you expect a sequence out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;For Example
: We have an input of 5 words now you have to predict the output of&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;5 words. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;b&gt;2.) Sequence
to Vector (Many to One):&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtwRfFMESM3LqDCAFHJCIQ1fZ2uFUpz_ng2-BOh7cNC_dw8nRNk5sP6yUmpk7fjveKOZnmMEW7oFCGN5vRytwCPyXUthRZRb5rG9oJwOGcXR6I3DtKRVzT4hfFZDgCV-6157w7rp32o0Y/s1600/s_to_v.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SEQUENCE TO VECTOR&quot; border=&quot;0&quot; data-original-height=&quot;594&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtwRfFMESM3LqDCAFHJCIQ1fZ2uFUpz_ng2-BOh7cNC_dw8nRNk5sP6yUmpk7fjveKOZnmMEW7oFCGN5vRytwCPyXUthRZRb5rG9oJwOGcXR6I3DtKRVzT4hfFZDgCV-6157w7rp32o0Y/s1600/s_to_v.png&quot; title=&quot;SEQUENCE TO VECTOR&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SEQUENCE TO VECTOR&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;In this, you
pass in a sequence and you expect a vector as an out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;For Example
: We have an input of 5 words now you have to predict the output of the next&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;1 words. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;b&gt;3.) Vector to
Sequence (One to Many):&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAtGJIkZUIw6fAy76v0wQFw9dhn6oeyKVlvjJGqy7-X2lT1brXXlbk7H732eawre8GkMdwiPwPHmo3S4_ULXjilHsxlv9xfqfTfhD-kKE34Gb1ZObXPMBYSuMl55F_fE3uIV_6GYFJV3w/s1600/v_to_s.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;VECTOR TO SEQUENCE&quot; border=&quot;0&quot; data-original-height=&quot;615&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAtGJIkZUIw6fAy76v0wQFw9dhn6oeyKVlvjJGqy7-X2lT1brXXlbk7H732eawre8GkMdwiPwPHmo3S4_ULXjilHsxlv9xfqfTfhD-kKE34Gb1ZObXPMBYSuMl55F_fE3uIV_6GYFJV3w/s1600/v_to_s.png&quot; title=&quot;VECTOR TO SEQUENCE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;VECTOR TO SEQUENCE&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;In this you
pass in a vector i.e a single value and you expect a sequence as an out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;For Example
: We have the input of 1 word now you have to predict the output of the next&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;5 words. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;A basic RNN
has a major disadvantage, we only really “remember” the previous output. If we
think back that unrolled diagram we were only feeding in the of 1 timestamp
into the past and what happens is if we have really long histories we begin to
start to forget the older historical samples since we are only really looking
at the out of the last previous t-1 and it will be really great if we could
keep the track of long history and not just that short term memory. Another issue that arises during training is the “&lt;b&gt;vanishing gradient&lt;/b&gt;”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Before
directly diving into the LSTM (Long Short Term Memory Units). We will have an
overview of Vanishing Gradient.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Let’s
discuss the 2 main issues i.e &lt;b&gt;Exploding &amp;amp; Vanishing&lt;/b&gt; Gradients.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;As our
networks grow deeper and more complex, we have 2 issues arises:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;-&lt;b&gt;Exploding
Gradients&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;-&lt;b&gt;Vanishing
Gradients&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Recall that
the gradient is used in our calculation to adjust weights and biases in our
network, if you don’t have any idea about Gradient you may check our &lt;i&gt;&lt;a href=&quot;https://www.infinitycodex.in/data-science-ss-106gradient-descent-and&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; color: #990000;&quot;&gt;GradientDescent&lt;/span&gt;&lt;/a&gt;&lt;/i&gt; article.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;This errors
might arise during backpropagation :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGlSk02l7IsGufsKcfe4DVa2EzeCM133t0Wm85fP5VqSbERt7DarGMHI_0M1UAlPCSn5ftU6GdKVsBEbup7rxdybz6PgSurrpG87FMLYEG74H-9zJA2fwibwF2RXh2GIQZC-iFBXoyBrc/s1600/neural_network.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;NEURAL NETWORK&quot; border=&quot;0&quot; data-original-height=&quot;274&quot; data-original-width=&quot;960&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGlSk02l7IsGufsKcfe4DVa2EzeCM133t0Wm85fP5VqSbERt7DarGMHI_0M1UAlPCSn5ftU6GdKVsBEbup7rxdybz6PgSurrpG87FMLYEG74H-9zJA2fwibwF2RXh2GIQZC-iFBXoyBrc/s1600/neural_network.png&quot; title=&quot;NEURAL NETWORK&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;NEURAL NETWORK&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now for
complex data we such as complex image data or complex sequence data we end up
needing deeper networks i.e we need more hidden layers in order to actually
learn the patterns that are in our data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now what
happens is there’s this vanishing or exploding gradient issue that arises
during the backpropagation step. So recall we are going to calculate some sort
of loss metrics on the output layer and then backpropagation error all the way
back to the input layer and if we have a lot’s of hidden layers then we’re
having the update to the weights and biases be a function of many other
derivatives that we’re calculating along the way back.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;- So
backpropagation goes backward from the output to the input layer, propagating
the error gradient.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;- For deeper
networks issues can arrive from backpropagation, vanishing and exploding
gradients.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtq0BuBV2kwmsLfO_C0wURZRPcC8Wkscco7bR2ZO6MyD-ZbfQf4pYMZoFB1AcKvAQzE9huprlV3fLdtVYwPapihOWYa9D1IxddmzH16Y5ZnBlZJldNjo8caULm5F523mj1WIIu7fGKvMo/s1600/backpropagarion.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;BACK PROPAGATION&quot; border=&quot;0&quot; data-original-height=&quot;290&quot; data-original-width=&quot;923&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtq0BuBV2kwmsLfO_C0wURZRPcC8Wkscco7bR2ZO6MyD-ZbfQf4pYMZoFB1AcKvAQzE9huprlV3fLdtVYwPapihOWYa9D1IxddmzH16Y5ZnBlZJldNjo8caULm5F523mj1WIIu7fGKvMo/s1600/backpropagarion.png&quot; title=&quot;BACK PROPAGATION&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;BACK PROPAGATION&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;- As you go
back to the “lower” layers closer to the input layer, gradients often get
smaller, to a vanishing gradient is usually the more common problem although
they can technically explode on the way back. But as you are going back and back
closer to those input layers there are gradients are getting smaller and
eventually what happens is they’re so small by the time it gets to the input
layer that the weights never really change that much at those lower input
levels. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;- That’s
actually, a big problem because we want to be able to detect larger basic
patterns in our data right out close to the input layer and have the deeper
layers focus on the smaller details or in smaller details and patterns.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;- And yes the opposite can also occur that the gradients explode on the way back, causing
issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now let’s
discuss why this is actually occurring and how we can fix it and let’s also
discuss how these issues specifically affect the RNN and how we can use the
LSTM units and get a recurrent unit to also fix this to understand what
actually happening let’s take a look at a really common activation function
such as sigmoid. Now as we know that the sigmoid activation function squeezes
the input to fit between 0 &amp;amp; 1.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipdZN99hfeBgcEd4NJXrv8Zuc3DFAWbCO51AZqfXC85WdYJ_MCldKX70UUqHMl0oPrqyQ0pThCoMk_ujDZjcKf9wsmRAXSNO5WuvseZJ6U70Bi7kkjg656P2EQysRw59osyUGhV-3uUVQ/s1600/sigmoid.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SIGMOID&quot; border=&quot;0&quot; data-original-height=&quot;623&quot; data-original-width=&quot;986&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipdZN99hfeBgcEd4NJXrv8Zuc3DFAWbCO51AZqfXC85WdYJ_MCldKX70UUqHMl0oPrqyQ0pThCoMk_ujDZjcKf9wsmRAXSNO5WuvseZJ6U70Bi7kkjg656P2EQysRw59osyUGhV-3uUVQ/s1600/sigmoid.png&quot; title=&quot;SIGMOID&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;SIGMOID&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;However
let’s take a closer look at what happens when your inputs start to get further
away from zero.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi57fCcs9qOlYQQ6fe-zqmIfOL4Lkf1LLr7wVK_lNXrwB3fDQG_W9wtkBhx7RVB3qIXuW09XdguHpSzYy01WJaVSwqBvuA3m4g9Y86yO3g_uyGJLUzIGIQOVTgcRJtUQDaxfY_CFHlaaT0/s1600/sigmoid_img.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SIGMOID&quot; border=&quot;0&quot; data-original-height=&quot;792&quot; data-original-width=&quot;1305&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi57fCcs9qOlYQQ6fe-zqmIfOL4Lkf1LLr7wVK_lNXrwB3fDQG_W9wtkBhx7RVB3qIXuW09XdguHpSzYy01WJaVSwqBvuA3m4g9Y86yO3g_uyGJLUzIGIQOVTgcRJtUQDaxfY_CFHlaaT0/s1600/sigmoid_img.png&quot; title=&quot;SIGMOID&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SIGMOID&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;The further
away your input is from zero. The rate of change in the sigmoid function is
actually decreasing rapidly and that rate of change that is the derivatives of
the sigmoid functions and we already know that the backpropagation and the
gradient calculation is essentially just calculating that derivative in
multiple dimensions as you go back through into the hidden layers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;i&gt;* When N
hidden layers use an activation like the sigmoid function, N small derivatives
are multiplied together.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;i&gt;* The gradient
could decrease exponentially as we propagate down to the initial layers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;i&gt;* We can use
other activation function such as ReLU which doesn&#39;t actually saturate those
larger positive values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;i&gt;* The main benefit of using ReLU here is that doesn&#39;t matter how large your input value is
going to be beyond 0. You are not going to exponentially decrease the rate of
change.&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;The other a possible solution is the &lt;b&gt;Batch Normalization&lt;/b&gt; where your model will
normalize each batch using that particular batches mean and standard deviation,
and that has also been founded to alleviate the issue of vanishing gradient
descent.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;So apart
from things such as &lt;b&gt;Batch Normalization, &lt;/b&gt;researchers have also used
“Gradient Clipping”, where gradients are cut off before reaching a
predetermined limit (eg: Cutt off gradients to be between -1 and 1).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;RNN for Time
Series presents their own Gradient Challenges, let’s explore special &lt;b&gt;LSTM &lt;/b&gt;(&lt;b&gt;Long
Short Term Memory&lt;/b&gt;) neuron units that help fix these issues!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;*&lt;u&gt;LSTM (
Long Short Term Memory )&lt;/u&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Many of the
solutions previously presented for the vanishing gradients can also apply to&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;RNN:
different activation functions (ReLU), batch normalizations, etc…&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;However
because of the length of time series input, these could slow down the training.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;A possible solution would be to just shorten the time steps used to prediction, but this
makes the model worse at predicting longer trends. So maybe looking back 20
time steps for the 21&lt;sup&gt;st&lt;/sup&gt; prediction you just look back 5-time steps
to get the next prediction. However, this makes the model worse at predicting longer
trends. So we still want to able to use a long time sequence in order to
predict the next item in the sequence.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Another
issue RNN faces are that after awhile the network will begin to “forget” the
first inputs, as information is lost at each step going through the RNN.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;We need some
sort of “long-term memory” for our networks. So this is where LSTM (Long Short
Term Memory) cell was created to help address these RNN issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;Let’s see
the working of an LSTM cell&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsRS7sBsx2xTbtzYXHuyNJqhd9mqp9goFAKhsWN6cfRfkPVTl5YI_BJuPi2LwsKqnAtSBjgy9gF6L55RUZE6BIXfnIB2uJbTKDofRQ0lKN5BvMYo534gD6j6goHpaR62H54uUuqogEw5Y/s1600/rnn_cell.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;RNN CELL&quot; border=&quot;0&quot; data-original-height=&quot;453&quot; data-original-width=&quot;897&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsRS7sBsx2xTbtzYXHuyNJqhd9mqp9goFAKhsWN6cfRfkPVTl5YI_BJuPi2LwsKqnAtSBjgy9gF6L55RUZE6BIXfnIB2uJbTKDofRQ0lKN5BvMYo534gD6j6goHpaR62H54uUuqogEw5Y/s1600/rnn_cell.png&quot; title=&quot;RNN CELL&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RNN CELL&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Take a look at what a single Recurrent neuron would actually be doing is essentially it’s taking in both the previous output and then the current input and then producing the next output.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSlElXf25RzKbocd38b4omaWqbyDF5r0GBBYxmGsppLMG7TKZNtv1sbAMfFXphjaEnRXbwfv-KYmJh_Luy93wmW9XsN8g7ssinBV9axkpLyVvNDHg-NqOEkjSW9Pmt4UM8hhxmqAQiUhw/s1600/labeled_rnn.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;RNN CELL LABELED&quot; border=&quot;0&quot; data-original-height=&quot;453&quot; data-original-width=&quot;803&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSlElXf25RzKbocd38b4omaWqbyDF5r0GBBYxmGsppLMG7TKZNtv1sbAMfFXphjaEnRXbwfv-KYmJh_Luy93wmW9XsN8g7ssinBV9axkpLyVvNDHg-NqOEkjSW9Pmt4UM8hhxmqAQiUhw/s1600/labeled_rnn.png&quot; title=&quot;RNN CELL LABELED&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RNN CELL LABELED&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;instead of saying it output or input, we will refer to these as hidden state and then our current feature X going in. So basically we have&amp;nbsp;&lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; line-height: 17.12px;&quot;&gt;t-1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;&amp;nbsp;going along with X of T and that produces&amp;nbsp;&lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; line-height: 17.12px;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;. So in a standard RNN essentially what we do is we just have a single hyperbolic tangent function and then what we are doing, we are combining&amp;nbsp;&lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; line-height: 17.12px;&quot;&gt;t-1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;&amp;nbsp;with&amp;nbsp;&lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; line-height: 19.9733px;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;&amp;nbsp;multiply that with some&amp;nbsp;&lt;b&gt;weight&lt;/b&gt;&amp;nbsp;matrix then adding a&amp;nbsp;&lt;b&gt;bias&lt;/b&gt;&amp;nbsp;to it and then passing it through the hyperbolic tangent function and that gives us back our&amp;nbsp;&lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; line-height: 17.12px;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18pt; line-height: 25.68px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT5_1EXjrEPzL20LBV1PXFXSYKfsUb0zynwRSoL-eSxc-SS3b2csYU79PIYtKBLV0rTqDE2Yfxi2MRnwS30x2CBxnQetqD6XhvDIDN8pYDugLK_GKmjjkbDVXtxb9u6cNSDrutOcwpfeg/s1600/cell_formula.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;RNN CELL LABELED FORMULA&quot; border=&quot;0&quot; data-original-height=&quot;441&quot; data-original-width=&quot;768&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT5_1EXjrEPzL20LBV1PXFXSYKfsUb0zynwRSoL-eSxc-SS3b2csYU79PIYtKBLV0rTqDE2Yfxi2MRnwS30x2CBxnQetqD6XhvDIDN8pYDugLK_GKmjjkbDVXtxb9u6cNSDrutOcwpfeg/s1600/cell_formula.png&quot; title=&quot;RNN CELL LABELED FORMULA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RNN CELL LABELED FORMULA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;And we just repeat that through the next recurrent neuron or an extra current layer.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;So LSTM also
have this chain-like structure. But a repeating module have slite difference to
it and instead of just having a single NN layer. There would be actually going to
be 4 layers working and interacting in a special way and the way we end up
getting 4 is the fact that not only will we keep track of just a single
historical memory with &lt;b&gt;H&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t-1 &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;we’re keeping track of both long term memory input and the short term
memory input and that creating a new long term memory output and then use short
term memory output along with the current input at time &lt;b&gt;t&lt;/b&gt; and then we
produce the output with time &lt;b&gt;t&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;STEPS OF
LSTM&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt; :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Before
diving into the steps let’s see some of the notation we’re going to be using so
essentially.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;So
essentially we are going to have 4 main components inside the LSTM.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgax_xrGCbEPEfB8uLqglxCjWKT378Gffnc_3mRaGY3mjS8pLCgw4KvpCWJi-1ZqKTeGQsOn1aiHqFF8U0bQc85l3ifvny66WUDaCV86OV7LyFMy5T16mlC89S7rKtj_vc3zm6yA8wre4/s1600/four_chambers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;LSTM 4 MAIN COMPONENTS&quot; border=&quot;0&quot; data-original-height=&quot;556&quot; data-original-width=&quot;1170&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgax_xrGCbEPEfB8uLqglxCjWKT378Gffnc_3mRaGY3mjS8pLCgw4KvpCWJi-1ZqKTeGQsOn1aiHqFF8U0bQc85l3ifvny66WUDaCV86OV7LyFMy5T16mlC89S7rKtj_vc3zm6yA8wre4/s1600/four_chambers.png&quot; title=&quot;LSTM 4 MAIN COMPONENTS&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;LSTM 4 MAIN COMPONENTS&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;u&gt;We have&lt;/u&gt;:&amp;nbsp;&lt;b&gt;Forget
Gate&lt;/b&gt;, &lt;b&gt;Output Gate&lt;/b&gt;, &lt;b&gt;Update Gate,&lt;/b&gt; and an &lt;b&gt;Input Gate&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;*&lt;u&gt;Forget
Gate&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;: As the name suggests, Forget Gate will decide what to forget from the previous memory
units.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;*&lt;u&gt;Input
Gate&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;: As the name suggests, Input Gate will decide what actually accept into the neuron.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;*&lt;u&gt;Update
Gate&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;: As the name suggests, Update Gate will update the memories.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;*&lt;u&gt;Output
Gate&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;: As the the the name suggests, Output Gate will actually output the new long term memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguUBjxoHC501u5BE8VvPvzNbd5npYOwKjrGMMyxozPmjJfBR_7KCty1B7vIikjmfNCJXU8_JSlZJ5XFMWfMxw0eXy3DPN3ZBbfd-rTE6S_Jfvwi0uUyNRqlQbCgtw9B-TeidCL4JCItvo/s1600/sigmoid_cell.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SIGMOID CELL&quot; border=&quot;0&quot; data-original-height=&quot;467&quot; data-original-width=&quot;634&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguUBjxoHC501u5BE8VvPvzNbd5npYOwKjrGMMyxozPmjJfBR_7KCty1B7vIikjmfNCJXU8_JSlZJ5XFMWfMxw0eXy3DPN3ZBbfd-rTE6S_Jfvwi0uUyNRqlQbCgtw9B-TeidCL4JCItvo/s1600/sigmoid_cell.png&quot; title=&quot;SIGMOID CELL&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SIGMOID CELL&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;A Gate
optionally lets some information through and essentially we can just think of
this as mathematically it’s a sigmoid function. It’s either going to end up a sequence between a 0 or 1 and if it’s 0 we don’t let that information go and if
it’s a 1 we let it go.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUqPHEn2t2xHX7snMHH2EsXyfNZ9EO85xcfXuQ4etFIsRdWcrViugkxBa4C5TLwldBK0l16ho60OEQX2wsQ4DrS2qOcqH6aNovUXUcHMHAOqv09py54Y861wSjzIui6z0G9y6V4GtulAo/s1600/general_structure_of_LSTM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;GENERAL STRUCTURE OF LSTM&quot; border=&quot;0&quot; data-original-height=&quot;551&quot; data-original-width=&quot;1129&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUqPHEn2t2xHX7snMHH2EsXyfNZ9EO85xcfXuQ4etFIsRdWcrViugkxBa4C5TLwldBK0l16ho60OEQX2wsQ4DrS2qOcqH6aNovUXUcHMHAOqv09py54Y861wSjzIui6z0G9y6V4GtulAo/s1600/general_structure_of_LSTM.png&quot; title=&quot;GENERAL STRUCTURE OF LSTM&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;GENERAL STRUCTURE OF LSTM&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;So here is the general structure of LSTM and we are accepting both &lt;b&gt;Long Term &lt;/b&gt;and &lt;b&gt;Short
Term &lt;/b&gt;memory, we can think of this as going to be passed in through conveyor
belts inside of this neuron and what we end up happening are it just ends up kind
of running down straight the enitre chain and has some kind of linear
interactions with a few functions inside of the cell.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now for the
purpose of a mathematical notation we’re gonna relabel some of these and we’re
going to label them as such.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip9Ig4QuudjwMiwW5rMMCeOlrNSqZF5Zt5KEWw1_6ewuIAwb_2zuAhoYW5cWzDeAJfafTGr1rubckPU8e7T5miub4dEMsc7NVJiULcIJ57B9fEMLeUQVAkocTHkQatj78YzQ7UO1NTX5A/s1600/general_structure_with_notation.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;GENERAL STRUCTURE WITH NOTATION&quot; border=&quot;0&quot; data-original-height=&quot;533&quot; data-original-width=&quot;745&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip9Ig4QuudjwMiwW5rMMCeOlrNSqZF5Zt5KEWw1_6ewuIAwb_2zuAhoYW5cWzDeAJfafTGr1rubckPU8e7T5miub4dEMsc7NVJiULcIJ57B9fEMLeUQVAkocTHkQatj78YzQ7UO1NTX5A/s1600/general_structure_with_notation.png&quot; title=&quot;GENERAL STRUCTURE WITH NOTATION&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;GENERAL STRUCTURE WITH NOTATION&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;So what are
the actual linear interactions and
functions going on inside of LSTM? Well, here we can see the entire LSTM cell.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;Now let’s go
through the process step by step :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;1.]&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;The 1&lt;sup&gt;st&lt;/sup&gt; step of LSTM is to
decide what information is going to throw away from the cell state essentially
what we are going to forget? So we end up creating is a forget gate layer or &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;f&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj65Mfi1yH9g2ltmw6ymrMId1q_CH4U6benVBfcuczwkpfjQ01sGWX6JcPRSFQ-qe6BeP8g6hyChAVBpsV_9K1Lxy0rJkcONOPqBbJjw78dv5aVgsWdvVyVD-sB78h-9ixCM9sLCcYHrZM/s1600/f_of_t.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INSIDE OF LSTM&quot; border=&quot;0&quot; data-original-height=&quot;665&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj65Mfi1yH9g2ltmw6ymrMId1q_CH4U6benVBfcuczwkpfjQ01sGWX6JcPRSFQ-qe6BeP8g6hyChAVBpsV_9K1Lxy0rJkcONOPqBbJjw78dv5aVgsWdvVyVD-sB78h-9ixCM9sLCcYHrZM/s1600/f_of_t.png&quot; title=&quot;INSIDE OF LSTM&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;INSIDE OF LSTM&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;So we end up
creating is a forget gate layer of &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;f&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;. Remember those gates are essentially
just passing things through a sigmoid function where the closer it is to 0 that
means fewer weights we are giving it. The closer it is to 1 the more weights we
are giving it. So in the context of the forget gate layer the closer it is to 0 means
forget about it and get rid of it and if it closer to 1 than remember this
it&#39;s important. So this is what &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;f&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;is doing. Notice that it&#39;s essentially
a linear combination of &lt;b&gt;h&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t-1 &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;that previously hidden state combines with the input &lt;b&gt;X&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt;. Then we have our own sets of weights for this
forget gate layer plus bias and then we pass it through an activation function
and then we get &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;f&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18pt; line-height: 107%;&quot;&gt; then the next step after this is to
decide &lt;b&gt;what new information are we going to store into the cell state?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 18.0pt; line-height: 107%;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;2.]&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;In the 2&lt;sup&gt;nd&lt;/sup&gt; step we have to
decide what new information we are going to store into the cell state. This has
2 parts to it :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVdlsG8vHrv9ZdIMYmmVM60epXhl_hX3Sf4-QVy0LYoG5Wab6Byl2UXI26pPxDM0lArLzGTC4T7giW9lfTawVCv4uNoGcxoTjT0dLJFQdCf6LW_0KGFjEnzmJsnF6jkknkCXXbbgjkDaY/s1600/step2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INSIDE OF LSTM STEP 2&quot; border=&quot;0&quot; data-original-height=&quot;685&quot; data-original-width=&quot;1587&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVdlsG8vHrv9ZdIMYmmVM60epXhl_hX3Sf4-QVy0LYoG5Wab6Byl2UXI26pPxDM0lArLzGTC4T7giW9lfTawVCv4uNoGcxoTjT0dLJFQdCf6LW_0KGFjEnzmJsnF6jkknkCXXbbgjkDaY/s1600/step2.png&quot; title=&quot;INSIDE OF LSTM STEP 2&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;INSIDE OF LSTM STEP 2&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;(i)&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;We have a sigmoid layer that we’re
going to label the input gate layer which is essentially going to decide what
values are we going to update.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;(ii)&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;We have a hyperbolic tangent layer that
creates a vector of new candidate values which will say &lt;b&gt;C&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;but we will label this with a tilde on top of it.&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; These are the new candidate values that will
eventually helpful in some sort of weighing be updating the cell state. So we
have that input gate layer deciding which value we’re going to update in the
hyperbolic tangent layer which is creating a vector of those new candidate
values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;3.]&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Now it’s time to update the old cell state
which is &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;C&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t-1. &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;In order to calculate the new cell state &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;C&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 107%;&quot;&gt;t &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;that
we’re going to end up outputting. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwSjGCsoMrZ7mHI8NOiWf0XzmWVHAvbARSpQk4hL2RGIEEwGVmZQlf6p9VXChdmxZbbm7XBCl0VQnK7P5kFLBNpskTMzf2uH5iJabkxxxRIl7ggeEhMoEtw2ArBjsaYc4DpYafUJzaoo8/s1600/step3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INSIDE OF LSTM STEP 3&quot; border=&quot;0&quot; data-original-height=&quot;656&quot; data-original-width=&quot;1554&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwSjGCsoMrZ7mHI8NOiWf0XzmWVHAvbARSpQk4hL2RGIEEwGVmZQlf6p9VXChdmxZbbm7XBCl0VQnK7P5kFLBNpskTMzf2uH5iJabkxxxRIl7ggeEhMoEtw2ArBjsaYc4DpYafUJzaoo8/s1600/step3.png&quot; title=&quot;INSIDE OF LSTM STEP 3&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;INSIDE OF LSTM STEP 3&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;So what we are doing is that we multiply the old state by &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 18.0pt; line-height: 107%;&quot;&gt;f&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; forgetting the
things that we decided weren’t that important due to the forget gate layer. Then
we add &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 18.0pt; line-height: 107%;&quot;&gt;i&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; times the new candidate values. So
essentially these are the new candidate values for the cell state scaled by how
much we decided to update each state value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;4.]&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt;Finally we have to decide what we are
going to output? So this output will be based on our cell state. That actually
a filtered version. First, we will end up doing is we run a sigmoid so that top
equation which decides what parts of the cell state we are going to output. Then
we put that cell state through the hyperbolic tangent function and what the
hyperbolic tangent does is it pushes all the values to be between -1 and 1 and
then we’re gonna multiply it by the output of that initial sigmoid gate of &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;O&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: red; font-size: 12.0pt; line-height: 107%;&quot;&gt;t&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 107%;&quot;&gt; so that we only output the parts of that we decided to.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKXfLjKZmZXis6pRI_EtaJp4sgP62o4PVH1_fYzqyR74ymYgi1LEzKDsdhBFvfhvPOuroFf1BYkr6oWWXkFy5e2sitTC82E5cN_iw0-EmU8bKYIPs622to2J1qbJEGXB2u-6rlcHolb4/s1600/step4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INSIDE OF LSTM STEP 4&quot; border=&quot;0&quot; data-original-height=&quot;677&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKXfLjKZmZXis6pRI_EtaJp4sgP62o4PVH1_fYzqyR74ymYgi1LEzKDsdhBFvfhvPOuroFf1BYkr6oWWXkFy5e2sitTC82E5cN_iw0-EmU8bKYIPs622to2J1qbJEGXB2u-6rlcHolb4/s1600/step4.jpg&quot; title=&quot;INSIDE OF LSTM STEP 4&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;INSIDE OF LSTM STEP 4&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Before directly diving into the coding first, get the data :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;a href=&quot;https://github.com/Vegadhardik7/ALL_CSV/commit/cdc605df7cb8c51bd1bee0a4b290dc55928c8a9f&quot; target=&quot;_blank&quot;&gt;Google_Data&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;This data set contains:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;1.) &lt;b&gt;Data&lt;/b&gt;: Stock information date.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;2.) &lt;b&gt;Open:&lt;/b&gt; Opening on a particular date.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;3.) &lt;b&gt;High&lt;/b&gt;: Highest price on that data.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;4.) &lt;b&gt;Low&lt;/b&gt;: Lowest price on that date.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;5.) &lt;b&gt;Close&lt;/b&gt;: Stock pricing closed that date.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;6.) &lt;b&gt;Adj Close&lt;/b&gt;: Adjusted close price.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;7.) &lt;b&gt;Volume&lt;/b&gt;: Volume of share.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;We will be reading this data in chunks of 30 days. So we will be training our neural network on 30 days data we will be predicting the 31st day and then similarity we will again skipping the last data and then again we will be taking from 1 to 31 days and then we will be predicting at 32nd day.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Steps To Build Stock Prediction Model:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;i.)&amp;nbsp; &amp;nbsp; Importing &amp;amp; Preprocessing Data&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;ii.)&amp;nbsp; &amp;nbsp;Building The RNN model&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;iii.)&amp;nbsp; Predicting Values&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;iv.)&amp;nbsp; &amp;nbsp;Checking The Accuracy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;i.) &lt;u&gt;Importing &amp;amp; Preprocessing Data&lt;/u&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
import numpy as np &lt;br /&gt;
import pandas as pd&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
import seaborn as sns
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
data = pd.read_csv(r&quot;E:\New folder\GOOG.csv&quot;, date_parser=True)&lt;br /&gt;
data.head()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyJLehbBcYS_0MWnrmeihtg2Hcj46U0wK68H1KPyrELRW4fPS8oHUlZ_N896o1yveqtUkfP6FRybzRXZASwiuCzisqgV9NK9XYdteoKkcTR4rif73nvUiJG7Zc3y2RznmMQ0unua7-Ff8/s1600/img1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;DATA&quot; border=&quot;0&quot; data-original-height=&quot;193&quot; data-original-width=&quot;701&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyJLehbBcYS_0MWnrmeihtg2Hcj46U0wK68H1KPyrELRW4fPS8oHUlZ_N896o1yveqtUkfP6FRybzRXZASwiuCzisqgV9NK9XYdteoKkcTR4rif73nvUiJG7Zc3y2RznmMQ0unua7-Ff8/s1600/img1.png&quot; title=&quot;DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Divide Data into Training and Test set&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;# Training Data&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
data_training = data[data[&#39;Date&#39;]&amp;lt;&#39;2020-05-01&#39;].copy()&lt;br /&gt;
data_training
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6LxgXz7injtX_Q2UQQ15YQoqju_KDTxit4B4oszo5lLboHcU5VrQXYI6n2voGrt16_qCEZ960FV5dtHaNADsy8z5EMQaZC2dWiYdz13yRnbVQs-qOuQDP6hjGoFXO4yHD9-cByY0gk00/s1600/img2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TRAINING DATA&quot; border=&quot;0&quot; data-original-height=&quot;420&quot; data-original-width=&quot;726&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6LxgXz7injtX_Q2UQQ15YQoqju_KDTxit4B4oszo5lLboHcU5VrQXYI6n2voGrt16_qCEZ960FV5dtHaNADsy8z5EMQaZC2dWiYdz13yRnbVQs-qOuQDP6hjGoFXO4yHD9-cByY0gk00/s1600/img2.png&quot; title=&quot;TRAINING DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TRAINING DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Divide Data into Training and Test set&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;# Test Data&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
data_test = data[data[&#39;Date&#39;]&amp;gt;=&#39;2020-05-01&#39;].copy()&lt;br /&gt;
data_test
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX2sEO50KDiwogdb4g-DtYbM-2UkLLWwC97NgELvfeMTvjTCr62Hw43ppHP4BEyIqGCUY9SmQE6QRDMfAWIpUQ82T3DZVLhEQbPZIlEtLt6K0avbuu-UM5nZOP38ygJheYm-4dakCTPi4/s1600/img3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TEST DATA&quot; border=&quot;0&quot; data-original-height=&quot;1556&quot; data-original-width=&quot;723&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX2sEO50KDiwogdb4g-DtYbM-2UkLLWwC97NgELvfeMTvjTCr62Hw43ppHP4BEyIqGCUY9SmQE6QRDMfAWIpUQ82T3DZVLhEQbPZIlEtLt6K0avbuu-UM5nZOP38ygJheYm-4dakCTPi4/s1600/img3.png&quot; title=&quot;TEST DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TEST DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
training_data = data_training.drop([&#39;Date&#39;,&#39;Adj Close&#39;],axis=1)&lt;br /&gt;
training_data.head()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPZXjpvheqCE3xd-xHL7qUKJKQgMDJNkT8ymp8uQO4k4k5lZ_P6qecXSMnBdCQZgxFOCr8BNXMGCwBhwJyFFFXDJsprn5ke-bFXkVUtxOMKJXyM8TnCZfdc4WGT5F2JHwf-EhA9JHlN7s/s1600/img4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TRAINING DATA HEAD&quot; border=&quot;0&quot; data-original-height=&quot;192&quot; data-original-width=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPZXjpvheqCE3xd-xHL7qUKJKQgMDJNkT8ymp8uQO4k4k5lZ_P6qecXSMnBdCQZgxFOCr8BNXMGCwBhwJyFFFXDJsprn5ke-bFXkVUtxOMKJXyM8TnCZfdc4WGT5F2JHwf-EhA9JHlN7s/s1600/img4.png&quot; title=&quot;TRAINING DATA HEAD&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TRAINING DATA HEAD&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
&lt;br /&gt;
Here we have to predict the &lt;b&gt;Open&lt;/b&gt; i.e opening price of that particular stock.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Data Preprocessing&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from sklearn.preprocessing import MinMaxScaler&lt;br /&gt;&lt;br /&gt;

scaler = MinMaxScaler()&lt;br /&gt;&lt;br /&gt;

training_data = scaler.fit_transform(training_data)&lt;br /&gt;
training_data

&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxD3zxbAI2tVPIgyq67e0f099QrVTA_bYaTlIu3o-u2YKcpJ_NxjKEGv5gLDgHM51EhZ2jhjVT28nQbFMD2xbi7zzYGfL4T4NGCRBqY2DY6qGlftzcdgLCRYojlmSZUBjd_r5DxJSzhI/s1600/img5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;MIN-MAX SCALER DATA&quot; border=&quot;0&quot; data-original-height=&quot;164&quot; data-original-width=&quot;683&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxD3zxbAI2tVPIgyq67e0f099QrVTA_bYaTlIu3o-u2YKcpJ_NxjKEGv5gLDgHM51EhZ2jhjVT28nQbFMD2xbi7zzYGfL4T4NGCRBqY2DY6qGlftzcdgLCRYojlmSZUBjd_r5DxJSzhI/s1600/img5.png&quot; title=&quot;MIN-MAX SCALER DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;MIN-MAX SCALER DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
X_train = []&lt;br /&gt;
y_train = []&lt;br /&gt;&lt;br /&gt;

for i in range(30, training_data.shape[0]):&lt;br /&gt;&amp;nbsp; &amp;nbsp; X_train.append(training_data[i-30:i])&lt;br /&gt;&amp;nbsp; &amp;nbsp; y_train.append(training_data[i,0])&lt;br /&gt;
&lt;br /&gt;
X_train, y_train = np.array(X_train), np.array(y_train)&lt;br /&gt;
&lt;br /&gt;
X_train.shape
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;(173, 30, 5)&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;ii.) &lt;u&gt;Build The RNN Model&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Building LSTM&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;

from tensorflow.keras import Sequential&lt;br /&gt;
from tensorflow.keras.layers import Dense, LSTM, Dropout&lt;br /&gt;&lt;br /&gt;

regression = Sequential()&lt;br /&gt;

regression.add(LSTM(units=50, activation=&quot;relu&quot;, return_sequences=True, input_shape=(X_train.shape[1], 5)))&lt;br /&gt;
regression.add(Dropout(0.2))&lt;br /&gt;&lt;br /&gt;

regression.add(LSTM(units=50, activation=&quot;relu&quot;, return_sequences=True, input_shape=(X_train.shape[1], 5)))&lt;br /&gt;
regression.add(Dropout(0.3))&lt;br /&gt;&lt;br /&gt;

regression.add(LSTM(units=50, activation=&quot;relu&quot;, return_sequences=True, input_shape=(X_train.shape[1], 5)))&lt;br /&gt;
regression.add(Dropout(0.4))&lt;br /&gt;&lt;br /&gt;

regression.add(LSTM(units=50, activation=&quot;relu&quot;))&lt;br /&gt;
regression.add(Dropout(0.5))&lt;br /&gt;&lt;br /&gt;


regression.add(Dense(units=1))
&lt;br /&gt;&lt;br /&gt;
regression.summary()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilx4spQamym87lKNTdWkiDgOMRgIB9PRPT8tZe1O3-0b-KMi0djwBP2BIf79w_Us2kjwER0DOyCXfS4vyqt02PjXX8R4jt4qiIwnSMQcFHGmpfdDNt_cTYak0T_kUo88NCHPHDgzutYs0/s1600/img6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;MODEL SUMMARY&quot; border=&quot;0&quot; data-original-height=&quot;559&quot; data-original-width=&quot;655&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilx4spQamym87lKNTdWkiDgOMRgIB9PRPT8tZe1O3-0b-KMi0djwBP2BIf79w_Us2kjwER0DOyCXfS4vyqt02PjXX8R4jt4qiIwnSMQcFHGmpfdDNt_cTYak0T_kUo88NCHPHDgzutYs0/s1600/img6.png&quot; title=&quot;MODEL SUMMARY&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;font-size: 12.8px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;MODEL SUMMARY&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Compile and Fit the model&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;

regression.compile(optimizer=&#39;adam&#39;, loss=&quot;mean_squared_error&quot;)&lt;br /&gt;
regression.fit(X_train,y_train,epochs=550,batch_size=32)

&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDo_W4naesQkqVwVXRpyIWRRGBx8t4Kh0rlDuxkoTfJm4RuJx9UPDyvA7TsVnLlD1jIkW2AwZ0Sh7X-nVEEuqYuuOaS0wHfQ04JMp5IItDucGK-x-H3YNk65qkAhAvMwyzSq72aHtGsYo/s1600/IMG12.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;COMPILE AND FIT DATA&quot; border=&quot;0&quot; data-original-height=&quot;419&quot; data-original-width=&quot;1372&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDo_W4naesQkqVwVXRpyIWRRGBx8t4Kh0rlDuxkoTfJm4RuJx9UPDyvA7TsVnLlD1jIkW2AwZ0Sh7X-nVEEuqYuuOaS0wHfQ04JMp5IItDucGK-x-H3YNk65qkAhAvMwyzSq72aHtGsYo/s1600/IMG12.png&quot; title=&quot;COMPILE AND FIT DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;COMPILE AND FIT DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;iii.) &lt;u&gt;Predict Values&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Prepare test data&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;
data_test.head()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcm9bTJ23iulQf5Y9f_4ykHlryOyp2Lf5UMqwLlch_xWTknfetmom7cXfZykg-b6hSMnG4Eup5WW8cRAaEVL4Q8Za3iteMQBghmTy-1d3eEVIoo7v-8VsQukIefjPi7q5h92iXYVMdDjA/s1600/img7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TEST HEAD&quot; border=&quot;0&quot; data-original-height=&quot;202&quot; data-original-width=&quot;725&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcm9bTJ23iulQf5Y9f_4ykHlryOyp2Lf5UMqwLlch_xWTknfetmom7cXfZykg-b6hSMnG4Eup5WW8cRAaEVL4Q8Za3iteMQBghmTy-1d3eEVIoo7v-8VsQukIefjPi7q5h92iXYVMdDjA/s1600/img7.png&quot; title=&quot;TEST HEAD&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TEST HEAD&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
past_30_days = data_training.tail(30)&lt;br /&gt;&lt;br /&gt;

df = past_30_days.append(data_test, ignore_index=True)&lt;br /&gt;
df = df.drop([&#39;Date&#39;, &#39;Adj Close&#39;],axis=1)&lt;br /&gt;
df.head()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCaG1G54AW8bKgL8trALrKu0iZnFwavccjnoA6GS5wbjIMLzEAqEY69quKC2VMmEfbV29C0OfJUiO_QarGA_xLoEa7n5_OsjmJJZijnKUq2If52QhNR-eqBblmX0yzrIzWbgWBN7W7ZIg/s1600/img8.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FILTERED DATA&quot; border=&quot;0&quot; data-original-height=&quot;198&quot; data-original-width=&quot;510&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCaG1G54AW8bKgL8trALrKu0iZnFwavccjnoA6GS5wbjIMLzEAqEY69quKC2VMmEfbV29C0OfJUiO_QarGA_xLoEa7n5_OsjmJJZijnKUq2If52QhNR-eqBblmX0yzrIzWbgWBN7W7ZIg/s1600/img8.png&quot; title=&quot;FILTERED DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;FILTERED DATA&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
inputs = scaler.transform(df)&lt;br /&gt;
inputs
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWJBT0WjIUgVgLJSFeeXjZPOVjAkLWELVB7MTD-03nhPe5rC-tddt-wAHJWzcHOM8CUccx89w1yYX21hsHoYON56B2lg5du5K7iUy295qlzuzejyWm-M0NlOkrpAUIjS0DqfpprJKMKqI/s1600/img9.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INPUT TRANSFORM DATA&quot; border=&quot;0&quot; data-original-height=&quot;764&quot; data-original-width=&quot;662&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWJBT0WjIUgVgLJSFeeXjZPOVjAkLWELVB7MTD-03nhPe5rC-tddt-wAHJWzcHOM8CUccx89w1yYX21hsHoYON56B2lg5du5K7iUy295qlzuzejyWm-M0NlOkrpAUIjS0DqfpprJKMKqI/s1600/img9.png&quot; title=&quot;INPUT TRANSFORM DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;INPUT TRANSFORM DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
X_test = []&lt;br /&gt;
y_test = []&lt;br /&gt;
&lt;br /&gt;

for i in range(30, inputs.shape[0]):&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;&amp;nbsp; &amp;nbsp; X_test.append(inputs[i-30:i])&lt;br /&gt;&amp;nbsp; &amp;nbsp; y_test.append(inputs[i,0])&lt;br /&gt;&lt;br /&gt;

X_test, y_test = np.array(X_test),np.array(y_test)&lt;br /&gt;
X_test.shape, y_test.shape

&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;((49, 30, 5), (49,))&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
y_pred = regression.predict(X_test)&lt;br /&gt;
y_pred
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0AZaTUNemH-tQiHW_yxCJnBf3wgjneWr1mD4le0BvwjvRkS4eycrzOGC7y5pLvq2K8u-ggorbijelVv8iCIF19iQ7-9qFoTq8dmDVI1qkXi96cTTa-9yyBgKZ288YTo1Rz6zUxajgZw/s1600/img10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;PREDICTED DATA&quot; border=&quot;0&quot; data-original-height=&quot;520&quot; data-original-width=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0AZaTUNemH-tQiHW_yxCJnBf3wgjneWr1mD4le0BvwjvRkS4eycrzOGC7y5pLvq2K8u-ggorbijelVv8iCIF19iQ7-9qFoTq8dmDVI1qkXi96cTTa-9yyBgKZ288YTo1Rz6zUxajgZw/s1600/img10.png&quot; title=&quot;PREDICTED DATA&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;PREDICTED DATA&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
scaler.scale_
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
array([2.13419869e-03, 2.17020477e-03, 1.96903103e-03, 2.12734298e-03,2.24300742e-07])
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
scale = 1/2.13419869e-03&lt;br /&gt;
scale
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;
468.55993525138933
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
y_pred = y_pred * scale&lt;br /&gt;
y_test = y_test * scale&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;vi.) &lt;u&gt;Visualize The Data and Check Accuracy&lt;/u&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 18px;&quot;&gt;
&lt;i&gt;# Visualize the data&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;


plt.figure(figsize=(14,5))&lt;br /&gt;
plt.plot(y_test, color=&quot;red&quot;, label=&quot;Real Google Stock Price&quot;)&lt;br /&gt;
plt.plot(y_pred, color=&quot;blue&quot;, label=&quot;Predict Google Stock Price&quot;)&lt;br /&gt;
plt.title(&quot;Google Stock Price Prediction&quot;)&lt;br /&gt;
plt.xlabel(&#39;Time&#39;)&lt;br /&gt;
plt.ylabel(&#39;Google Stock Price&#39;)&lt;br /&gt;
plt.legend()&lt;br /&gt;
plt.show()

&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvRKPifnNWbWdDW6vmGpPssNLmWXGJZVxjohf9N6r8lXBcFAoBvxnSCmQmyE-qXfONSyQtOJxtRRqy0pvCm7kIV4fNf4noXqSgb9xjtK_RwuI-POkxtavlrp7kOXV8MFOlkweGYFxfyGA/s1600/img11.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;DATA VISUALIZATION&quot; border=&quot;0&quot; data-original-height=&quot;410&quot; data-original-width=&quot;1071&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvRKPifnNWbWdDW6vmGpPssNLmWXGJZVxjohf9N6r8lXBcFAoBvxnSCmQmyE-qXfONSyQtOJxtRRqy0pvCm7kIV4fNf4noXqSgb9xjtK_RwuI-POkxtavlrp7kOXV8MFOlkweGYFxfyGA/s1600/img11.png&quot; title=&quot;DATA VISUALIZATION&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DATA VISUALIZATION&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&amp;nbsp;So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/2557559036237009570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/07/google-stock-price-prediction-using-rnn.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/2557559036237009570'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/2557559036237009570'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/07/google-stock-price-prediction-using-rnn.html' title='Google Stock Price Prediction Using RNN - LSTM Python'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbllRCISM9MAFMEK2_O0bASCoBixFLKABPX5bdcuJ2njVxgGDGTXt9Yi2MKMVK1CthQ7-VP7L0nmQDsz1xis85goe4Upq7kQmxo2SYDDkt0zIGwFXvZYVhzyCrQF3t7p3-UFvh83H341s/s72-c/stocks.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-950408964750798869</id><published>2020-06-27T16:07:00.009+05:30</published><updated>2021-01-17T10:44:47.593+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Classify Malaria Using CNN Python</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;h2&gt;&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 28pt; line-height: 107%;&quot;&gt;Classify Infected Malaria Cell Using CNN Python&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx6bO4iN0Pm6hqNpovhqsRlFs2jcLj6kA1MfRJdJsre7JRL4qnUxIRo80RLhyKmV-RoIlfgordS0o3jyaci0lZgpsD_xSOTDOF8-agujcUUokPdG0TNq2Xo1M7VA-DA1rnTUP4btId3Wo/s1600/cell.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Image by &amp;lt;a href=&amp;quot;https://pixabay.com/users/PublicDomainPictures-14/?utm_source=link-attribution&amp;amp;amp;utm_medium=referral&amp;amp;amp;utm_campaign=image&amp;amp;amp;utm_content=163711&amp;quot;&amp;gt;PublicDomainPictures&amp;lt;/a&amp;gt; from &amp;lt;a href=&amp;quot;https://pixabay.com/?utm_source=link-attribution&amp;amp;amp;utm_medium=referral&amp;amp;amp;utm_campaign=image&amp;amp;amp;utm_content=163711&amp;quot;&amp;gt;Pixabay&amp;lt;/a&amp;gt;&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx6bO4iN0Pm6hqNpovhqsRlFs2jcLj6kA1MfRJdJsre7JRL4qnUxIRo80RLhyKmV-RoIlfgordS0o3jyaci0lZgpsD_xSOTDOF8-agujcUUokPdG0TNq2Xo1M7VA-DA1rnTUP4btId3Wo/s640/cell.jpg&quot; title=&quot;Cell Image&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CELL&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;In this article, we will look at end-to-end real-life Convolutional
Neural Network (CNN) project where we will detect the cell is infected by
malaria or not. We will be using Python, Keras, and TensorFlow for this project.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;The data set which is used in this project is taken
from the National Library Of Medicine.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEganO5NaY3tHW5YgaHsaWSUZO3Y1c-WSmSjeNyd6m82YKdgormn3ProEU3rTmsBN8tTuzuhP3J5WoNYGRHka95ZSbvGCSTkq3Yp54IDbp9jYUsnncEFufAeXmRgBdZuicH2N-u6C3NONgY/s1600/National_Library_of_medicine.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;National Library Of Medicine&quot; border=&quot;0&quot; data-original-height=&quot;933&quot; data-original-width=&quot;1027&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEganO5NaY3tHW5YgaHsaWSUZO3Y1c-WSmSjeNyd6m82YKdgormn3ProEU3rTmsBN8tTuzuhP3J5WoNYGRHka95ZSbvGCSTkq3Yp54IDbp9jYUsnncEFufAeXmRgBdZuicH2N-u6C3NONgY/s1600/National_Library_of_medicine.png&quot; title=&quot;National Library Of Medicine&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;National Library Of Medicine&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://lhncbc.nlm.nih.gov/publication/pub9932&quot; id=&quot;Government Data&quot; name=&quot;Government Data&quot; style=&quot;text-align: center;&quot; target=&quot;_blank&quot;&gt;https://lhncbc.nlm.nih.gov/publication/pub9932&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;This dataset contains multiple image’s of infected
cells called as (‘parasitized’) :&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbFNo5P7gLFwOt6PQ4WEcI2km9j-Gp6dTOj1q4pjWTHLHjXxS7o6GKBiyTJe6ylylxhz3Tfrykiz2t6LcVvwUs32igOtDJwJ0ZD0l9pdIi1H_sJKiZaq1zX3MCLsyrryFuGJjYqsk0OCE/s1600/infected_and_non-infected_cells.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;INFECTED CELL&quot; border=&quot;0&quot; data-original-height=&quot;562&quot; data-original-width=&quot;973&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbFNo5P7gLFwOt6PQ4WEcI2km9j-Gp6dTOj1q4pjWTHLHjXxS7o6GKBiyTJe6ylylxhz3Tfrykiz2t6LcVvwUs32igOtDJwJ0ZD0l9pdIi1H_sJKiZaq1zX3MCLsyrryFuGJjYqsk0OCE/s1600/infected_and_non-infected_cells.png&quot; title=&quot;INFECTED CELL&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;INFECTED CELL&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;And multiple images of non-infected cells called as (‘uninfected’)
:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdoEHMYaqetKfEYyeopZh4goePOW7AXsnkFVAPjugRM0qAXdPn_Zs7BtHIlz7qD0PrqMrE8n7Qs2jCGZ1ka121tAT4wEl6bw61x4qiBHVPF28lOwlwihiPtWcGo9B8nM8u1lKRUXLufI0/s1600/non_infected_cells.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;562&quot; data-original-width=&quot;1117&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdoEHMYaqetKfEYyeopZh4goePOW7AXsnkFVAPjugRM0qAXdPn_Zs7BtHIlz7qD0PrqMrE8n7Qs2jCGZ1ka121tAT4wEl6bw61x4qiBHVPF28lOwlwihiPtWcGo9B8nM8u1lKRUXLufI0/s1600/non_infected_cells.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Non-Infected Cells&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;So what we end up doing is attempting to build a model that just based on the image of a cell can predict whether or not it’s
infected or not infected with malaria.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;In real life, this may save doctors a lot of time by
just running images into our model instead of having to manually look at these
image’s themselves and determinant. &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;So now you can download this data from the official
site or just click this link :&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 107%;&quot;&gt;Cell Data:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 107%;&quot;&gt; &lt;span style=&quot;font-size: large;&quot;&gt;&lt;a href=&quot;ftp://lhcftp.nlm.nih.gov/Open-Access-Datasets/Malaria/cell_images.zip&quot; id=&quot;Cell Data&quot; name=&quot;Cell Data&quot; target=&quot;_blank&quot;&gt;ftp://lhcftp.nlm.nih.gov/Open-Access-Datasets/Malaria/cell_images.zip&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now as you all have downloaded and extracted the data. Now it&#39;s time to execute some code.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Open your Jupyter-Notebook and let&#39;s begin.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;The very first thing we will do is to take a look at the content which is present inside the folder.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
import os&lt;br /&gt;
data = &quot;D:\corona\CNN_data\cell_images&quot;&lt;br /&gt;
os.listdir(data)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;[&#39;test&#39;, &#39;train&#39;]&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now we will be importing some of the important Python libraries which will help us to visualize and manage the images.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
import pandas as pd&lt;br /&gt;
import numpy as np&lt;br /&gt;
import seaborn as sns&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
%matplotlib inline&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now to read the images which are present in our file we will import imread function which is present in the matplotlib library.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
from matplotlib.image import imread&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;As we saw earlier that we have a test set and training set inside of this. Let&#39;s go and set 2 variables the first variable will be called test_path and what we are going to do here is that we are going to concatenate our data path with test and for the second one will be called as train_path and we will do the same thing with that too.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
test_path = data + &quot;\\test\\&quot;&lt;br /&gt;
train_path = data + &quot;\\train\\&quot;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now to read the images which are present in our file we will import imread function which is present in the matplotlib library.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;The purpose of doing this is to see what images are present inside that path. To check the path again just type test_path and it will show you the path&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
test_path&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&#39;D:\\corona\\CNN_data\\cell_images\\test\\&#39;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So now let&#39;s go ahead and list the files what kind of files are inside.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
os.listdir(test_path)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;[&#39;parasitized&#39;, &#39;uninfected&#39;]&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;If you noticed that this data set contains 2 folders which are parasitized and uninfected which we saw above. These folders contains about 27000 images and the state asset is taken from a government repository on malaria data sets.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;So as I mentioned earlier we are going to end up doing is attempting to build a model that just based off the image of a cell can predict whether or not that cell is infected or not infected with malaria.&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So now we are going to look at the single image.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
os.listdir(train_path+&#39;parasitized&#39;)[0]&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&#39;C100P61ThinF_IMG_20150918_144104_cell_162.png&#39;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now let&#39;s visualize the single-cell image.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
inf_cell = train_path+&#39;parasitized\\&#39;+&#39;C100P61ThinF_IMG_20150918_144104_cell_162.png&#39;&lt;br /&gt;&lt;br /&gt;
plt.imshow(imread(inf_cell))&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwIx2t60ODCiPXvLq5xc5uASE5fyXOfswT2WWlu6QjOa7jrEH8QEm3XC64HEMGCklNeLCC_Ow01tl4zHqRc7orNOmtxdpv3A8_POCegDgxYZmKraYLTUEkKz-m4GZpcAdBvhqxX0UPeSY/s1600/single_infected_cell_image.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Infected Cell Image&quot; border=&quot;0&quot; data-original-height=&quot;596&quot; data-original-width=&quot;657&quot; height=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwIx2t60ODCiPXvLq5xc5uASE5fyXOfswT2WWlu6QjOa7jrEH8QEm3XC64HEMGCklNeLCC_Ow01tl4zHqRc7orNOmtxdpv3A8_POCegDgxYZmKraYLTUEkKz-m4GZpcAdBvhqxX0UPeSY/s400/single_infected_cell_image.png&quot; title=&quot;Infected Cell Image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Infected Cell Image&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;As we saw the infected cell above, now let&#39;s have a look at the non-infected cell.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
os.listdir(train_path+&#39;uninfected&#39;)[0]&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&#39;C100P61ThinF_IMG_20150918_144104_cell_128.png&#39;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
uninf_cell = train_path+&#39;uninfected\\&#39;+&#39;C100P61ThinF_IMG_20150918_144104_cell_128.png&#39;&lt;br /&gt;&lt;br /&gt;
plt.imshow(imread(uninf_cell))&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPGZVJ72R-DGv52ow0vX3cRBKDuHvRmZUwem6kfGpqwT_c7VR6ZGUBqW5QUyiUarOvW7q2Kkm79UNV3y7EQuuCLfnYglmCDUY42cKvFtKSzvs9KxTQAfj7Lq-EvsygOpJI3jNZvOn56FQ/s1600/single_cell_image.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Non-Infected Cell Image&quot; border=&quot;0&quot; data-original-height=&quot;571&quot; data-original-width=&quot;696&quot; height=&quot;327&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPGZVJ72R-DGv52ow0vX3cRBKDuHvRmZUwem6kfGpqwT_c7VR6ZGUBqW5QUyiUarOvW7q2Kkm79UNV3y7EQuuCLfnYglmCDUY42cKvFtKSzvs9KxTQAfj7Lq-EvsygOpJI3jNZvOn56FQ/s400/single_cell_image.png&quot; title=&quot;Non-Infected Cell Image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Non-Infected Cell Image&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now let&#39;s go ahead and finally figure out the average shape of, one of these images. The important thing about this dataset is that the images which are present are real images and it&#39;s unlikely that they all are going to be the exact same shape. If we compare this dataset with other datasets such as MNIST or CIFAR dataset you have noticed that every image in this dataset has the same dimensions. But in the real dataset, it&#39;s another way around they going to have different dimensions.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;
There are lots of different ways we can do this but one way is to set up 2 list dim1 and dim2 than we will be applying a for loop where we will be iterating through every file and by chance the test path uninfected. Then we are going to check the shape of each of them and then append their first dimension (dim1) and second dimension (dim2). Now let&#39;s code this theory.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
dim1 = []&lt;br /&gt;
dim2 = []&lt;br /&gt;
&lt;br /&gt;
for img_filename in os.listdir(test_path+&#39;uninfected&#39;):&lt;br /&gt;
    &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;img = imread(test_path+&#39;uninfected\\&#39;+img_filename)&lt;br /&gt;
    &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;d1,d2,color = img.shape&lt;br /&gt;
    &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;dim1.append(d1)&lt;br /&gt;
    &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;dim2.append(d2)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now let&#39;s visualize the dimensions of dim1 and dim2.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
sns.jointplot(dim1,dim2)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0osGpaC6y-Fz5fxWYMRFIs7nBTmArIciXthTYVoj8RWLz8t9Z_QpU5dHcf_38x9VvL7ERprMVhROysEmQ87Qu3_jU-2brjSakIE5W_QWGsD1xkRFwWfW-Q9zEnTBW-fS4fYT6MM2kUCQ/s1600/histogram.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Graphical Representation&quot; border=&quot;0&quot; data-original-height=&quot;821&quot; data-original-width=&quot;882&quot; height=&quot;593&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0osGpaC6y-Fz5fxWYMRFIs7nBTmArIciXthTYVoj8RWLz8t9Z_QpU5dHcf_38x9VvL7ERprMVhROysEmQ87Qu3_jU-2brjSakIE5W_QWGsD1xkRFwWfW-Q9zEnTBW-fS4fYT6MM2kUCQ/s640/histogram.png&quot; title=&quot;Graphical Representation&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Graphical Representation&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So why is this important?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
&lt;br /&gt;
Well, the Convolutional Neural Network isn&#39;t going to be able to train on images of various sizes. So what we need to do is to make sure that, we are going to resize all the images to be the same size. So we have to choose what is the actual dimensions should we resize everything to. The answer is pretty simple we should choose is essentially the average of both dimensions and this shows you the actual distribution of the images and they all kind of center around basically 130 by 130 and you can confirm this by checking out the mean values in your dimensions.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
np.mean(dim1)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;130.925&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
np.mean(dim2)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;130.750&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So now we can say that our final image shape which we will be feeding in our Convolutional Neural Network is 130 by 130 by 3&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
img_shape=(130,130,3)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Go ahead and run that. And then later on we are actually preparing the data for the model we will be resize everything to these dimensions. 
 So if it&#39;s a smaller photo we&#39;ll basically add padding so that it reaches these dimensions and if it&#39;s a larger photo we can either crop, shrink, or compress that image.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now we are going to focus on this special object from TensorFlow Keras which is called the image data generator. What we are going to do of this class is that we are going to feed it in the directory over our actual image files are and you&#39;ll be able to perform a bunch of manipulations on our images and then feed those new images to your model.
&lt;br /&gt;
&lt;br /&gt;
Before diving into the concept keep in mind that there is really too much data for us to read in all this data at once. This file is much larger than the files such as MNIST and CIFAR. If you know the dimension of MNIST is 28 by 28 and CIFAR has the dimension of 32 by 32, and even that the smaller expansion from 28 by 28 to color images of 32 by 32 was a huge expansion in the amount of data if we look at the math i.e 28*28 = 784 data points and when we see CIFAR that was 32*32*3 = 3072 and our files are going to be even larger that is 130*130*3 = 50700. Now we are dealing with 50700 data points because we are not going to able to just feed in everything at once. Instead, we have to select batches of our images. The other idea that we want to be able to overcome is the fact that it should be robust enough to deal with images that are pretty different from images that it&#39;s seen before and one way we can do that is by manipulating and performing transformations on our images thing like rotation, resizing and scaling.&lt;br /&gt;&lt;br /&gt;
Okay enough with the talk now let&#39;s go ahead and explore this idea of manipulating images as well as flowing from a directory these new batches of files.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from tensorflow.keras.preprocessing.image import ImageDataGenerator&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
Go ahead and run that command. If you had ever worked with MNIST dataset we had 60000 images and that&#39;s a lot of images for a very simple file type essentially a very simple image that had a dimension of 28 by 28. Right now we have half of that size over our entire dataset. Our entire dataset is less than 30000 images. So want to do is to expand the number of images without having gathered more data. We can&#39;t just keep grabbing blood cells from people. So we can do things like take our current images and randomly rotate them, reshape them, rescale them, etc.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from tensorflow.keras.preprocessing.image import ImageDataGenerator
&lt;br /&gt;&lt;br /&gt;
img_gen = ImageDataGenerator(rotation_range=20,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;width_shift_range=0.1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height_shift_range=0.1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;shear_range=0.1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#cutting part of image &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;zoom_range=0.1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;horizontal_flip=True,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fill_mode=&#39;nearest&#39;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#fill data in image voids&lt;br /&gt;

&lt;br /&gt;
plt.imshow(imread(uninf_cell))         
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4GfBKGT1SxxViwKeJTj8KtFdAKZMFM-jEuBqtn3Xb0aZslnRNyhgg1wh4_bRBkrxpLZncOqyVhV1TrDUFt6xZyJ3M88TvyZckVXjc_cB-v4TP3UD5xN7ovEr5fozPAGa5WZP25GfuTjQ/s1600/single_cell_image.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Non-Infected Cell&quot; border=&quot;0&quot; data-original-height=&quot;571&quot; data-original-width=&quot;696&quot; height=&quot;327&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4GfBKGT1SxxViwKeJTj8KtFdAKZMFM-jEuBqtn3Xb0aZslnRNyhgg1wh4_bRBkrxpLZncOqyVhV1TrDUFt6xZyJ3M88TvyZckVXjc_cB-v4TP3UD5xN7ovEr5fozPAGa5WZP25GfuTjQ/s400/single_cell_image.png&quot; title=&quot;Non-Infected Cell&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Non-Infected Cell&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
para_img = imread(inf_cell)&lt;br /&gt;
plt.imshow((para_img))
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2bmVeCCRx9vXY-FmCT9l_qPdMoRxqxJazbCWL-q2Pupe6XECW-pmtH_UMomAaKcz_hMBTSVSCOu1ytXG_o3CkFjrlTQG7M46orCcYPadV68oltR8wD_m8we-9Yy0dC6AOmzi8ri4s65Y/s1600/single_infected_cell_image.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Infected Cell&quot; border=&quot;0&quot; data-original-height=&quot;596&quot; data-original-width=&quot;657&quot; height=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2bmVeCCRx9vXY-FmCT9l_qPdMoRxqxJazbCWL-q2Pupe6XECW-pmtH_UMomAaKcz_hMBTSVSCOu1ytXG_o3CkFjrlTQG7M46orCcYPadV68oltR8wD_m8we-9Yy0dC6AOmzi8ri4s65Y/s400/single_infected_cell_image.png&quot; title=&quot;Infected Cell&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Infected Cell&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Now let&#39;s have a look at our manipulated image.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
plt.imshow(img_gen.random_transform(para_img))
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtNWTXezqaq-bg8NBlb28rVtYcUh3DsqzfbcgqL8-tA43FCKPobv0QOSugQyVj2mfo4nUYEorp09Iq6UdaCzHpi4GeunB_cyTGEBTKmtv6aOp7sy4SC8eNP2EMnk5IOjKdcz4BVibK6Q/s1600/manipulated_image.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Para-Infected Cell&quot; border=&quot;0&quot; data-original-height=&quot;685&quot; data-original-width=&quot;707&quot; height=&quot;387&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtNWTXezqaq-bg8NBlb28rVtYcUh3DsqzfbcgqL8-tA43FCKPobv0QOSugQyVj2mfo4nUYEorp09Iq6UdaCzHpi4GeunB_cyTGEBTKmtv6aOp7sy4SC8eNP2EMnk5IOjKdcz4BVibK6Q/s400/manipulated_image.png&quot; title=&quot;Para-Infected Cell&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Para-Infected Cell&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So here is our randomized version of the image. Notice that we got to stretch, kind of like columns sticking out of the cell and that&#39;s because through this random transformation it looks like it got stretched out and fill in those values with the nearest pixel values and then notes it was also rotated makes a lot of sense to randomly rotate image here because their cell&#39;s that can be in any sort of rotational axis that they want. They can be floating around in their sample so depending again on the actual type of images you&#39;re looking at you&#39;re going to be playing around at these actual range values.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
&lt;br /&gt;
Okay so now with the fact that we can randomly transform these images we can essentially augment our dataset. We no longer restricted to just a single image from the cell we can randomly transform this many times over. So if we keep running this we&#39;ll see more and more random transformations. And this is the way artificially expanding our image dataset. Recall we have less than 30000 images but now we could do the random transformation on all those images and immediately double the size of our image dataset. Maybe we can do 5 random transformations and we went from something like 20000 images to 100000 images.
&lt;br /&gt;
&lt;br /&gt;
So this is the really powerful tool you have to keep in mind when you are dealing with kinda smaller datasets and when it comes to the Convolution Neural Networks it takes thousands and thousands of images to get something that performs really well.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
plt.imshow(img_gen.random_transform(para_img))
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA2jF4cfViwAsGRJUlHaP_TzaB7fMTh3V9Ja_zgm1T5S9-UTMoRrDc2w1PLHdX4eQ5ymzKrg1A_uD1eX5yzj7_VCTN9BIGgozChyKXEaAmvuVICJ6FHks_FNyKKM_jcmvIl4LihXrEWD4/s1600/manipulated_image2.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Para-Infected Resized Cell&quot; border=&quot;0&quot; data-original-height=&quot;572&quot; data-original-width=&quot;618&quot; height=&quot;370&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA2jF4cfViwAsGRJUlHaP_TzaB7fMTh3V9Ja_zgm1T5S9-UTMoRrDc2w1PLHdX4eQ5ymzKrg1A_uD1eX5yzj7_VCTN9BIGgozChyKXEaAmvuVICJ6FHks_FNyKKM_jcmvIl4LihXrEWD4/s400/manipulated_image2.png&quot; title=&quot;Para-Infected Resized Cell&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Para-Infected Resized Cell&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Okay now, how do we actually set up our directories to flow batches from the directory. The way we do that by using the flow from the directory function.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
img_gen.flow_from_directory(train_path)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
Found 24958 images belonging to 2 classes.&lt;br /&gt;&lt;br /&gt;&amp;lt;keras_preprocessing.image.directory_iterator.DirectoryIterator at 0x1f9aabb8808&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;When you run that, you saw some text. Now, what that text means? It means that our machine had found around 24958 number of images belonging to 2 classes. There are 2 folders in the directory which indicates each class, that&#39;s how our machine is able to distinguish between classes. This would be the same for the test_path but at test number of images would be 2600.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;IMP&lt;/u&gt;:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;i&gt;In order to use &quot;&lt;/i&gt;.flow_from_directory&lt;i&gt;&quot;, you must organize the image is sub-directories. This is an absolute requirement, otherwise, the method won&#39;t work. The directories should only contain images of one class, so one folder per class of images.
&lt;/i&gt;&lt;/span&gt;&lt;i&gt;
&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Okay now as we have learned about our dataset. Now it&#39;s time to create our model.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;

from tensorflow.keras.models import Sequential &lt;br /&gt;
from tensorflow.keras.layers import Dense, Conv2D, MaxPool2D, Dropout, Flatten&lt;br /&gt;&lt;br /&gt;

model = Sequential()&lt;br /&gt;&lt;br /&gt;

model.add(Conv2D(filters=32,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 kernel_size=(3,3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 input_shape=img_shape,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 activation=&#39;relu&#39;))&lt;br /&gt;&lt;br /&gt;

model.add(MaxPool2D(pool_size=(2,2)))&lt;br /&gt;&lt;br /&gt;

model.add(Conv2D(filters=64,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 kernel_size=(3,3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 input_shape=img_shape,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 activation=&#39;relu&#39;))&lt;br /&gt;
&lt;br /&gt;
model.add(MaxPool2D(pool_size=(2,2)))&lt;br /&gt;&lt;br /&gt;

model.add(Conv2D(filters=64,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 kernel_size=(3,3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 input_shape=img_shape,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 activation=&#39;relu&#39;))&lt;br /&gt;&lt;br /&gt;

model.add(MaxPool2D(pool_size=(2,2)))&lt;br /&gt;&lt;br /&gt;

model.add(Flatten())&lt;br /&gt;&lt;br /&gt;

model.add(Dense(128, activation=&#39;relu&#39;))&lt;br /&gt;
model.add(Dropout(0.5))&lt;br /&gt;&lt;br /&gt;

model.add(Dense(1,activation=&#39;sigmoid&#39;))&lt;br /&gt;&lt;br /&gt;

model.compile(loss=&#39;binary_crossentropy&#39;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;              optimizer=&#39;adam&#39;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;              metrics=[&#39;accuracy&#39;])&lt;br /&gt;&lt;br /&gt;

model.summary()


&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuG-z7RDM-BAds5vk_lE9RMu5gvYkEGVCntWmvzh0PoOy5qzfSnJpbQglRhp1u4OUu-NtoICVaKGcfkc-k4SKxnQ_7CkOLr4qfOIy4WiZrNMoMXIbmQg7TBNokwzCHxmmoolo_E8Q4FCk/s1600/model_summary.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Model Summary&quot; border=&quot;0&quot; data-original-height=&quot;858&quot; data-original-width=&quot;908&quot; height=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuG-z7RDM-BAds5vk_lE9RMu5gvYkEGVCntWmvzh0PoOy5qzfSnJpbQglRhp1u4OUu-NtoICVaKGcfkc-k4SKxnQ_7CkOLr4qfOIy4WiZrNMoMXIbmQg7TBNokwzCHxmmoolo_E8Q4FCk/s640/model_summary.png&quot; title=&quot;Model Summary&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Model Summary&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 22px;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;IMPORTANT POINTS:&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;&lt;i&gt;
* &lt;b&gt;MaxPool2D&lt;/b&gt; and &lt;b&gt;MaxPooling2D&lt;/b&gt; are aliases that mean there are multiple names for the same function.
&lt;br /&gt;&lt;br /&gt;
* Because this is going to be a larger network we added &lt;b&gt;Dropout&lt;/b&gt; to it. Which will help us to prevent overfitting.
&lt;br /&gt;&lt;br /&gt;
* &lt;b&gt;input_shape&lt;/b&gt; should be equal to the &lt;b&gt;img_shape&lt;/b&gt;.
&lt;br /&gt;&lt;br /&gt;
* Keep in mind if you choose an image shape that&#39;s too large especially if you are dealing with extremely large files your machine will run out of memory. That completely depends on your hardware.
&lt;br /&gt;&lt;br /&gt;
* We added multiple Convolutional layers because the larger the image size the more complex of a task you are dealing with more Convolutional layer you should have.
&lt;br /&gt;&lt;br /&gt;
* As we go deeper the network we increase the number of filters.
&lt;br /&gt;&lt;br /&gt;
* &lt;b&gt;Dropout&lt;/b&gt; value is 0.5 because we want to turn off half of the neurons to prevent overfitting.
&lt;/i&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Notice that we have 1605760 number of parameters by the time we get to the dense layer. So this model will take a long time to train.
&lt;br /&gt;&lt;br /&gt;
To make sure we can pick the right amount of epochs to train for we can use callbacks early stopping.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from tensorflow.keras.callbacks import EarlyStopping
&lt;br /&gt;&lt;br /&gt;
early_stop = EarlyStopping(monitor=&#39;val_loss&#39;,patience=2)
&lt;br /&gt;&lt;br /&gt;
batch_size = 16
&lt;br /&gt;&lt;br /&gt;
train_img_gen = img_gen.flow_from_directory(train_path,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            target_size=img_shape[:2],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            color_mode=&#39;rgb&#39;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            batch_size=batch_size,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            class_mode=&#39;binary&#39;)&lt;br /&gt;&lt;br /&gt;

test_img_gen = img_gen.flow_from_directory(test_path,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            target_size=img_shape[:2],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            color_mode=&#39;rgb&#39;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            batch_size=batch_size,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                                            class_mode=&#39;binary&#39;,shuffle=False)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
Found 24958 images belonging to 2 classes.&lt;br /&gt;&lt;br /&gt;
Found 2600 images belonging to 2 classes.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
train_img_gen.class_indices
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
{&#39;parasitized&#39;: 0, &#39;uninfected&#39;: 1}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
Now we are going to train our model. Remember that it&#39;s going to take a lot of time to train.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
results = model.fit_generator(train_img_gen,epochs=20,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                              validation_data=test_img_gen,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                              callbacks=[early_stop])
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;
Or else we have an alternative for this which is very easy to implement.
&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;
Pre-Trained File:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/Vegadhardik7/ML_ALL_PROJECTS/blob/master/malaria_detector.h5&quot; target=&quot;_blank&quot;&gt; https://github.com/Vegadhardik7/ML_ALL_PROJECTS/blob/master/malaria_detector.h5&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;
Just download this file and let&#39;s continue. 
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from tensorflow.keras.models import load_model
&lt;br /&gt;&lt;br /&gt;
model = load_model(&#39;D:\corona\malaria_detector.h5&#39;)
&lt;br /&gt;&lt;br /&gt;
model.summary()
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe2JENt24DWgOHoGiHl4YFjmPesVWWa0onRfWe0yX2tKE2GCxQL4ks9GV0DbDCMIakSLbJXIlaBVepu4PRWAvRX5Asagv6cdLrfBBHDKzcmCFmtBGvLFYCaF2uuCDq6u1OR84bLkOoMZ8/s1600/pre_trained_model_summary.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Pre-Trained Model Summary&quot; border=&quot;0&quot; data-original-height=&quot;918&quot; data-original-width=&quot;866&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe2JENt24DWgOHoGiHl4YFjmPesVWWa0onRfWe0yX2tKE2GCxQL4ks9GV0DbDCMIakSLbJXIlaBVepu4PRWAvRX5Asagv6cdLrfBBHDKzcmCFmtBGvLFYCaF2uuCDq6u1OR84bLkOoMZ8/s640/pre_trained_model_summary.png&quot; title=&quot;Pre-Trained Model Summary&quot; width=&quot;601&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Pre-Trained Model Summary&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;The minor drawback with this is, you won&#39;t get the model history. But if you want you can evaluate the model.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
model.evaluate_generator(test_img_gen)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;[1.9182854999828034, 0.8738462]&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;That&#39;s amazing we got an accuracy of 87% which is pretty good considering that base accuracy is 50%.
&lt;br /&gt;&lt;br /&gt;
Now let&#39;s see how accurate our model is using some prediction values.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
pred = model.predict_generator(test_img_gen)
&lt;br /&gt;&lt;br /&gt;
pred
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
array([[0.],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [0.],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [0.],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       ...,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [0.],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [1.],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [0.]], dtype=float32)&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So if we take a look at the results here of &lt;b&gt;pred&lt;/b&gt; we get the values between 0 and 1. So it actually doesn&#39;t return back the straight class calls, instead, it returns back the probabilities so you know that if the value of a point is 0.97 or 0.98 that means that our model is 97% or 98% sure that it belongs to class 1. So now what we will do is that if any value is greater than 0.5 i.e 50% it belongs to class 1 and if it&#39;s less than 0.5 it will belong to class 2.&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
predictions = pred &amp;gt; 0.5     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # you can take any threshold value you want&lt;br /&gt;&lt;br /&gt;
predictions
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
array([[False],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [False],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [False],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       ...,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [False],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [ True],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       [False]])
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So True and False are treated as 0 and 1 in NumPy. So we can directly pass it through this to our confusion matrix and classification report. 
&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;If the value is 1 the cell is not infected and if the value is 0 it is infected.&lt;/b&gt; Look the class values {&#39;parasitized&#39;: 0, &#39;uninfected&#39;: 1}.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from sklearn.metrics import classification_report,confusion_matrix
&lt;br /&gt;&lt;br /&gt;
print(confusion_matrix(test_img_gen.classes, predictions))
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
[[1274&amp;nbsp;&amp;nbsp;   26]&lt;br /&gt;
&amp;nbsp;&amp;nbsp; [ 299&amp;nbsp;&amp;nbsp; 1001]]
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
from tensorflow.keras.preprocessing import image
&lt;br /&gt;&lt;br /&gt;
image.load_img(inf_cell)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAu6vV5eWXWLHaKpjx4DFN1I_eswQgw0-MOXvqx84g8uULKrQN6CJsxOzhlh6gcNE6riUKwxI5L50noct6KPez8mpRUhZQ6gL9B_NVKDO65EdOy3jvHTxvTlq5Zn4Y8srqd1ATWJUEw7Y/s1600/Malaria_cell_img1.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Malaria Infected Cell&quot; border=&quot;0&quot; data-original-height=&quot;508&quot; data-original-width=&quot;487&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAu6vV5eWXWLHaKpjx4DFN1I_eswQgw0-MOXvqx84g8uULKrQN6CJsxOzhlh6gcNE6riUKwxI5L50noct6KPez8mpRUhZQ6gL9B_NVKDO65EdOy3jvHTxvTlq5Zn4Y8srqd1ATWJUEw7Y/s400/Malaria_cell_img1.png&quot; title=&quot;Malaria Infected Cell&quot; width=&quot;382&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Malaria Infected Cell&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
my_img = image.load_img(inf_cell,target_size=img_shape)&lt;br /&gt;&lt;br /&gt;
my_img        
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI9-euji_s15D6u5rRQGhmoPtppkrYXXRd6lWoEkoYAeOtlWDpX73MaKM3rGj1PPWMmcw-UX7-k0rWgbkJQsTT1ywNEA9J0DjM_fvtsQBwSFy8dTonTqdNU31bhgggX6zroG-uAxzuZMM/s1600/reshaped_malaria_cell_img.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Reshaped Malaria Infected Cell&quot; border=&quot;0&quot; data-original-height=&quot;447&quot; data-original-width=&quot;447&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI9-euji_s15D6u5rRQGhmoPtppkrYXXRd6lWoEkoYAeOtlWDpX73MaKM3rGj1PPWMmcw-UX7-k0rWgbkJQsTT1ywNEA9J0DjM_fvtsQBwSFy8dTonTqdNU31bhgggX6zroG-uAxzuZMM/s400/reshaped_malaria_cell_img.png&quot; title=&quot;Reshaped Malaria Infected Cell&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Reshaped Malaria Infected Cell&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;So when we think about this as a real-world situation, what actually happens is that the doctor will give us the image and we going to load the image and pass it to the model.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20px;&quot;&gt;
my_img_array = image.img_to_array(my_img)&lt;br /&gt;
my_img_array.shape
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
(130, 130, 3)
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
So what we are going to do here is simply resize this along the 0 dimensions and we can do that in several ways, but one of the ways is we can use &lt;b&gt;np.expand_size&lt;/b&gt; function.
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18px;&quot;&gt;
my_img_array = np.expand_dims(my_img_array,axis=0)&lt;br /&gt;&lt;br /&gt;
my_img_array.shape  &amp;nbsp;&amp;nbsp;# We reshaped the image to 1 image of dimension 130,130,3
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
(1, 130, 130, 3)
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21px;&quot;&gt;
model.predict(my_img_array)
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
array([[0.]], dtype=float32)
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21px;&quot;&gt;
train_img_gen.class_indices
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
{&#39;parasitized&#39;: 0, &#39;uninfected&#39;: 1}
&lt;/span&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;
This means that our model prediction is correct it is an infected cell.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&amp;nbsp;So we hope that you enjoyed this project. If you did then please share it with your friends and spread this knowledge.
&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Follow us at :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Instagram :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/infinitycode_x/&quot; id=&quot;InfinityCodeX_Instagram&quot; name=&quot;InfinityCodeX_Instagram&quot; target=&quot;_blank&quot;&gt;https://www.instagram.com/infinitycode_x/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Facebook :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://www.facebook.com/InfinitycodeX/&quot; id=&quot;InfinityCodeX_Facebook&quot; name=&quot;InfinityCodeX_Facebook&quot; target=&quot;_blank&quot;&gt;https://www.facebook.com/InfinitycodeX/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;Twitter :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;a href=&quot;https://twitter.com/InfinityCodeX1&quot; id=&quot;InfinityCodeX_Twitter&quot; name=&quot;InfinityCodeX_Twitter&quot; target=&quot;_blank&quot;&gt;https://twitter.com/InfinityCodeX1&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/950408964750798869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/06/detect-malaria-using-cnn-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/950408964750798869'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/950408964750798869'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/06/detect-malaria-using-cnn-python.html' title='Classify Malaria Using CNN Python'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx6bO4iN0Pm6hqNpovhqsRlFs2jcLj6kA1MfRJdJsre7JRL4qnUxIRo80RLhyKmV-RoIlfgordS0o3jyaci0lZgpsD_xSOTDOF8-agujcUUokPdG0TNq2Xo1M7VA-DA1rnTUP4btId3Wo/s72-c/cell.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-7573498764061192370</id><published>2020-06-04T10:51:00.006+05:30</published><updated>2022-03-13T13:47:28.835+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>Top 10 Strategies Which Will Make You King Of  RANDOM FOREST [2022]</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h1&gt;&lt;/h1&gt;&lt;h1 style=&quot;line-height: normal;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;font face=&quot;times&quot; size=&quot;6&quot;&gt;Top 10
Strategies&amp;nbsp;Which Will Make You King Of&amp;nbsp;RANDOM FOREST [2022]&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioToXpn-pm_lWB7au0jSOUAJUjwQ3nAgO51VABdHI9bmYm-6bK3baPUzfkr-rpmJipnwcjcPL-oAYCZHBp8kEmglfGnLhOuW1vGgBAULmsjyTESKBnuB30so6ZkfU-w6PHhaV2HEZ7gA8/s1600/Forest_gif.gif&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Forest&quot; border=&quot;0&quot; data-original-height=&quot;476&quot; data-original-width=&quot;500&quot; height=&quot;609&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioToXpn-pm_lWB7au0jSOUAJUjwQ3nAgO51VABdHI9bmYm-6bK3baPUzfkr-rpmJipnwcjcPL-oAYCZHBp8kEmglfGnLhOuW1vGgBAULmsjyTESKBnuB30so6ZkfU-w6PHhaV2HEZ7gA8/s640/Forest_gif.gif&quot; title=&quot;Forest&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;Random
Forest is one of the&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 28.5333px;&quot;&gt;Supervised Learning Techniques&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 107%;&quot;&gt;&amp;nbsp;which is used to solve the Classification and Regression problem.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Evolution only comes when
we found the limitations of something.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;In this era of complete
evolution, humans had found the limitations themselves. To overcome those
limitations we try to create multiple solutions and go plus ultra.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;To understand Random Forest
completely, Let’s first understand what is Regression and Classification.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 150%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: 24px;&quot;&gt;&lt;b&gt;Regression&lt;/b&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: 18pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;background: white; color: #222222;&quot;&gt;Regression&amp;nbsp;is a method
or an algorithm in&amp;nbsp;Machine Learning&amp;nbsp;that models a target value based on independent
predictors. It is essentially a statistical tool used in finding out the
relationship between a dependent variable an independent variable.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;- Here we
predict the output value as a specific number.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;- In
Regression, a Regression Tree is used when the target variable is numerical or
continuous in nature.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;- We fit
a regression model to target variables using each of the independent variables.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;- Each
split is made based on the sum of the square error.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCklaOvFuZPiguRScC365co2AU9Xf4MyKOot3ItpreQKvfNq7SV435v9Va3ZGIqRradAYwchlRv5yR10_klMt5ST0NrVAcwLJ9imf6plEFvNDH9qJhV15jCC2VAoE_n1SdzIN7hrL7Dt8/s1600/REGRESSION_TREE.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Regression&quot; border=&quot;0&quot; data-original-height=&quot;701&quot; data-original-width=&quot;1218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCklaOvFuZPiguRScC365co2AU9Xf4MyKOot3ItpreQKvfNq7SV435v9Va3ZGIqRradAYwchlRv5yR10_klMt5ST0NrVAcwLJ9imf6plEFvNDH9qJhV15jCC2VAoE_n1SdzIN7hrL7Dt8/s1600/REGRESSION_TREE.png&quot; title=&quot;Regression&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;REGRESSION&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 18pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 115%; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Classification&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;:
Classification is a process of categorizing a structured or a nonstructured
set of data in different classes based on certain features/categories.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_e90kFLfqEfrhvwV1lbtkJl_fHEtKhTW9o1C_i32VZMnxAGyEUDH4FTGqVZtqRgBJuYz5r829yjy3NepCC2lYMY9_vmaujs2N5U3BZ96rukPrH6nxso1FeAt74cjaNdNj28H2UZfkeBc/s1600/cats_and_dogs_classification.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Classification&quot; border=&quot;0&quot; data-original-height=&quot;500&quot; data-original-width=&quot;800&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_e90kFLfqEfrhvwV1lbtkJl_fHEtKhTW9o1C_i32VZMnxAGyEUDH4FTGqVZtqRgBJuYz5r829yjy3NepCC2lYMY9_vmaujs2N5U3BZ96rukPrH6nxso1FeAt74cjaNdNj28H2UZfkeBc/s1600/cats_and_dogs_classification.jpg&quot; title=&quot;Classification&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CLASSIFICATION&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The limitations of
Decision Tree leads us to create a Random Forest. Let us see a quick overview
of limitations of Decision Tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;*&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The Primary disadvantages of the decision tree are overfitting.
Overfitting occurs when the algorithm capture noise in the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* In the Decision Tree there is also a
problem of high variance. The model can get unstable due to small variance in
the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* In a decision tree is there is Low
Biased tree. A highly complicated decision tree tends to have a low bias which makes
it difficult for the model to work with new data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* Calculation can get very complex
particularly if many values are uncertain and if many outcomes are linked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;To overcome all the
limitations which we had in the Decision Tree. We will be using Random Forest.
After all,&amp;nbsp;&lt;b&gt;this algorithm creates the forest with &lt;i&gt;n&lt;/i&gt; number of Decision Trees&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ1-AgGqIcNqB5A6XAsYMDX3tXazfoivnaRHXbq_CkIHA3KCkWor3Au4Gz17nFJWjZmNm-rmLOxGatD6WDm96Ub1sIxQkfMry1Ax3g0OKogaCFteeNA4HeHIk7rPogflJTZybyKtTMsso/s1600/decisiontree_and_randomforest.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Decision Tree vs Random Forest&quot; border=&quot;0&quot; data-original-height=&quot;328&quot; data-original-width=&quot;947&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ1-AgGqIcNqB5A6XAsYMDX3tXazfoivnaRHXbq_CkIHA3KCkWor3Au4Gz17nFJWjZmNm-rmLOxGatD6WDm96Ub1sIxQkfMry1Ax3g0OKogaCFteeNA4HeHIk7rPogflJTZybyKtTMsso/s1600/decisiontree_and_randomforest.png&quot; title=&quot;Decision Tree vs Random Forest&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DECISION TREE AND RANDOM FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt;&quot;&gt;In general more trees in
the forest more robust the prediction and thus higher accuracy.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;To understand this the concept clearly, here are some of the links which will help you to become not
only King but KingKong of&lt;span&gt;&amp;nbsp; &lt;/span&gt;Random Forest.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9lEfsVEL8I6DgEsClMoA-WYpPhWagjkyCLXrxl-LptTpH3e2HXY2deTvFtnKwDFnK1FCHLNpBn60OjXzkqZ-MbkNKq7cx8begoHEOwaxKG0_2dTY-Sm7SOPiNVimTEslM5a1eKpcs914/s1600/konglook.gif&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;King Kong&quot; border=&quot;0&quot; data-original-height=&quot;200&quot; data-original-width=&quot;480&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9lEfsVEL8I6DgEsClMoA-WYpPhWagjkyCLXrxl-LptTpH3e2HXY2deTvFtnKwDFnK1FCHLNpBn60OjXzkqZ-MbkNKq7cx8begoHEOwaxKG0_2dTY-Sm7SOPiNVimTEslM5a1eKpcs914/s640/konglook.gif&quot; title=&quot;King Kong&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;KING KONG&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;b style=&quot;font-size: 18pt;&quot;&gt;→&amp;nbsp;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/14-most-essential-concepts-about&quot; target=&quot;_blank&quot;&gt;Decision Tree&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;b style=&quot;font-size: 18pt;&quot;&gt;→&amp;nbsp;&lt;/b&gt;&lt;i&gt;&lt;a href=&quot;https://www.infinitycodex.in/top-9-essential-concept-of-supervised&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Supervised Learning&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;b style=&quot;font-size: 18pt;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;b style=&quot;font-size: 18pt;&quot;&gt;→&amp;nbsp;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;a href=&quot;https://www.infinitycodex.in/top-7-essential-points-about&quot; target=&quot;_blank&quot;&gt;Unsupervised Learning&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;So before diving into Random
Forest directly, here is the map that will help you become King. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQlRZH9uq5al6WChvzdMQ5DUB5uph5bs0W4hqfW0zsPcgFfE4eRoirlCK4gkoYHZEIfTZJpj58BVPh_0KDS90n3pJWwfb7a-mnyhstYSrawc7nvlXfq132FWMq947QMkxCaVhjg0LxRME/s1600/Map_of_Random_Forest.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Random Forest Map&quot; border=&quot;0&quot; data-original-height=&quot;1240&quot; data-original-width=&quot;917&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQlRZH9uq5al6WChvzdMQ5DUB5uph5bs0W4hqfW0zsPcgFfE4eRoirlCK4gkoYHZEIfTZJpj58BVPh_0KDS90n3pJWwfb7a-mnyhstYSrawc7nvlXfq132FWMq947QMkxCaVhjg0LxRME/s1600/Map_of_Random_Forest.png&quot; title=&quot;Random Forest Map&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RANDOM FOREST MAP&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(1) &lt;u&gt;Ensemble Learning
Overview&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Ensemble Learning is used
in multiple learning algorithms at the same time to obtain predictions with an
aim to have better predictions than the individual model.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm6BuaPAOgYoGWqUaeqKCbzBVFvYPAy-HCmmkyjoseca4HI7neDMNoynksQz8N3sT9VRRhT3qG33ibOMdI0BxLE3igByTE7OegKXt6cGiNRyD0XkOuMzEQ4W19AYb2wPsVeaVBWDuoX3U/s1600/ensemble_classifier.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Ensemble Learning&quot; border=&quot;0&quot; data-original-height=&quot;657&quot; data-original-width=&quot;1037&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm6BuaPAOgYoGWqUaeqKCbzBVFvYPAy-HCmmkyjoseca4HI7neDMNoynksQz8N3sT9VRRhT3qG33ibOMdI0BxLE3igByTE7OegKXt6cGiNRyD0XkOuMzEQ4W19AYb2wPsVeaVBWDuoX3U/s1600/ensemble_classifier.png&quot; title=&quot;Ensemble Learning&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ENSEMBLE LEARNING&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 150%;&quot;&gt;&lt;i&gt;Q.) Why use Ensemble
Learning?&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* Gives us better accuracy
which means the error will be minimum.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* It avoids overfitting
so the consistency is very high.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* The bias and variance errors
are also reduced to a minimum.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 150%;&quot;&gt;&lt;i&gt;Q.) When and Where to use
Ensemble Models?&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 20pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;*When a single model like
Decision Tree over fits we can use Random Forest or we can use Ensemble of
multiple similar models.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;*It can be used for both Classification
and Regression problems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(2) &lt;u&gt;Why Random Forest?&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;It’s always important to
understand, why we use any of the algorithms, for this article we will be
talking about why we use Random Forest over the other algorithms.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Random Forest is an
algorithm that helps us to get optimal output. It avoids overfitting, if you
use multiple trees it automatically avoid the risk of overfitting.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;For those who don’t know
overfitting :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: center;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;When
a model performs well at training data but performs badly at test data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;In Random Forest the training
time of the data is less.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The accuracy of the Random
Forest is very high.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Random Forest also runs well especially in the larger database, for large data it produces highly accurate
prediction in today&#39;s world of Big Data it is really very important. This is why
Random Forest really comes in to help us.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;It estimates the missing
data, Data on today&#39;s world is very messy so when you have Random Forest for us
which can maintain the accuracy when a large proportion of the data is missing.
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(3) &lt;u&gt;What Is Random Forest?&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Random Forest is a type
of ensemble learning method. It is a versatile algorithm capable of performing
both Regression and Classification.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Random Forest or Random
Decision Tree Forest is the method that operates by constructing multiple Decision
Trees during the training phase. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ArPrRHqlgvRnyac7-vH_KksuB2YOM8PRN5_Kwr9nNRAiprMNb6zjEERWfU1GM83icl4zu7qnycpog1x9QLr1dOy5Nv3lqgIeh7yoAkCxwSDwfk9HwWK-ZdW03pZrQmozhcQPdVcpInQ/s1600/Random_Forest_Fruits.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Random Forest Of Fruits&quot; border=&quot;0&quot; data-original-height=&quot;1061&quot; data-original-width=&quot;817&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ArPrRHqlgvRnyac7-vH_KksuB2YOM8PRN5_Kwr9nNRAiprMNb6zjEERWfU1GM83icl4zu7qnycpog1x9QLr1dOy5Nv3lqgIeh7yoAkCxwSDwfk9HwWK-ZdW03pZrQmozhcQPdVcpInQ/s1600/Random_Forest_Fruits.png&quot; title=&quot;Random Forest Of Fruits&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RANDOM FOREST OF FRUITS&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The decision of the
majority of the trees is chosen by the Random Forest at the Final decision. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Random Forest is
basically used for predictive modeling and machine learning technique.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(4) &lt;u&gt;Decision Tree VS Random Forest&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;img alt=&quot;Decision Tree vs Random Forest&quot; border=&quot;0&quot; data-original-height=&quot;971&quot; data-original-width=&quot;917&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw6wGcaAuW6SPa_DnZ5Aebh_MY2I1jNKOueNknurcTSeGthiJd56GtVKck2BY7yHKhKduUzeTjAtjC_4BKxZdP6e2dAjRrAU-x-HBr3OpnvvSmRkIcz_oi-quxYTp406MdkLiUgenDW0k/s1600/Decision_Tree_VS_Random_Forest.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot; title=&quot;Decision Tree vs Random Forest&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DECISION TREE VS RANDOM FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(5) &lt;u&gt;Application Of Random
Forest&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;There are multiple
application of Random Fores but some of them are :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: large; line-height: 150%;&quot;&gt;(i) Banking&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: large; line-height: 150%;&quot;&gt;(ii) Remote Sensing&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: large; line-height: 150%;&quot;&gt;(iii) Object Detection&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(iv) Medicine&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9FDHpZ6BEvBpToVBrPyIB63g2L8v7nOFFHI5HSXy9mcKSuz9hObGy1GXGVHJs7yOo-MiU065ojhAdNXqMbGr28YwhPJHFUCMgl-jxB2nHpNAgf95dfqIl7lhoxsTi-goo6wZvrsYDA4U/s1600/application_of_random_forest.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Application Of Random Forest&quot; border=&quot;0&quot; data-original-height=&quot;996&quot; data-original-width=&quot;1002&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9FDHpZ6BEvBpToVBrPyIB63g2L8v7nOFFHI5HSXy9mcKSuz9hObGy1GXGVHJs7yOo-MiU065ojhAdNXqMbGr28YwhPJHFUCMgl-jxB2nHpNAgf95dfqIl7lhoxsTi-goo6wZvrsYDA4U/s1600/application_of_random_forest.jpg&quot; title=&quot;Application Of Random Forest&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;APPLICATIONS OF RANDOM FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(6) &lt;u&gt;Features Of Random
Forest&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Here are the features of Random
Forest&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdp1SplRzl0_cGoKWhaqKsyYjITX1dHQk958LG-4UOezL-ZPLHfM85WLsosv2uCQIXa0Z2lEZZ0tyIhwaY0QE10KG5qFvb9VG2uqzXwunEpmU369K9y3OqipKQXPVC5PaIUiq3TPTKMVI/s1600/features_of_random_forest.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Features of Random Forest&quot; border=&quot;0&quot; data-original-height=&quot;722&quot; data-original-width=&quot;1390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdp1SplRzl0_cGoKWhaqKsyYjITX1dHQk958LG-4UOezL-ZPLHfM85WLsosv2uCQIXa0Z2lEZZ0tyIhwaY0QE10KG5qFvb9VG2uqzXwunEpmU369K9y3OqipKQXPVC5PaIUiq3TPTKMVI/s1600/features_of_random_forest.png&quot; title=&quot;Features of Random Forest&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FEATURES OF RANDOM FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(7) &lt;u&gt;Disadvantages Of
Random Forest&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;It’s not like that Random
Forest is the perfect algorithm, everything has its disadvantages one way or
other.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* More accurate ensemble
require more trees, which means building and testing the model is a slower
process.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* Random Forest is very good
at Classification in comparison to Regression.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* In Regression Random
Fores does not predict beyond the range of training data. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* Random Forest has been
observed to overfit for some of the datasets with very noisy classification /
regression tasks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;* For data including
categorical variables with different number of levels, Random Forests are
biased in favor of those attributes with more levels.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(8) &lt;u&gt;How Does Random Forest
Algorithm Works?&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;In Random Forest we grow
multiple trees as opposed to a single tree in the &lt;a href=&quot;https://www.infinitycodex.in/14-most-essential-concepts-about&quot; target=&quot;_blank&quot;&gt;CART&lt;/a&gt; model. To classify new objects
based on attribute each tree gives a classification and we say the tree votes
for that class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The forest choose the
classification having the most votes over all the other trees in the forests and
in the case of regression, it takes the average of the outputs by different
trees.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Steps related to working
of the Random Forest Algorithm :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisLnhIxyFS6TuRdlIkXWS8OGKqJaoqCJLPJosd0dbmFJvfeF2jYurR_VF4yOUXeLIOK5ejEMdqMhTiVB_Yr-l7Cpy9JXD6gtH1i8RgBP8yerKi3GYd_X6WZu_pLrn3LhUJwFcEFBPDNPs/s1600/Random_Forest_Steps.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Random Forest Algorithm&quot; border=&quot;0&quot; data-original-height=&quot;1002&quot; data-original-width=&quot;1086&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisLnhIxyFS6TuRdlIkXWS8OGKqJaoqCJLPJosd0dbmFJvfeF2jYurR_VF4yOUXeLIOK5ejEMdqMhTiVB_Yr-l7Cpy9JXD6gtH1i8RgBP8yerKi3GYd_X6WZu_pLrn3LhUJwFcEFBPDNPs/s1600/Random_Forest_Steps.png&quot; title=&quot;Random Forest Algorithm&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RANDOM FOREST ALGORITHM&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;i&gt;T&lt;/i&gt;: Number of Trees to be
constructed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;i&gt;N&lt;/i&gt;: Number of Features.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;i&gt;O&lt;/i&gt;: The class with the
highest vote.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;(i)&amp;nbsp;&lt;u&gt;Select Random
Features&lt;/u&gt; :&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;The first step is to
actually, fill certain “&lt;i&gt;m&lt;/i&gt;” features from &lt;i&gt;N&lt;/i&gt;, where &lt;i&gt;m&lt;/i&gt; less than &lt;i&gt;N&lt;/i&gt;. As we know &lt;i&gt;N&lt;/i&gt; is
the total number of features, out of those features we will be selecting some random
features out of those. The reason we are selecting certain features only is
because if we select all the predictive variable that each of the Decision Tree
will be the same and because of that our model is not learning something new. &lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;(ii)&amp;nbsp;&lt;u&gt;Calculate Best Splitting
Point&lt;/u&gt; :&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;For node &lt;i&gt;d&lt;/i&gt;, calculate the best
split point among them features. Here we pick up the most significant variable
and then we split that particular node into further child nodes.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;(iii)&amp;nbsp;&lt;u&gt;Split into &lt;i&gt;n&lt;/i&gt; daughter
nodes&lt;/u&gt; :&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Split the node into &lt;i&gt;n&lt;/i&gt;&amp;nbsp;number of daughter nodes using the best splits.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;(iv)&amp;nbsp;&lt;u&gt;Repeat the initial
steps&lt;/u&gt; :&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Repeat the first 3 steps until
&lt;i&gt;n&lt;/i&gt; number of nodes has been reached. Which means we have to repeat it
until we rich the leaf nodes of the tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;(v)&amp;nbsp;&lt;u&gt;Built your Forest&lt;/u&gt;
:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;Built your forest by
repeating steps (i) till (iv) for &lt;i&gt;T&lt;/i&gt; number of times.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;After this (iv) steps we
will have our 1 Decision Tree but Random Forest is about multiple Decision
Trees.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;This is not over yet, your final task will be to compile the results of all the Decision Trees and you
will make a majority voting for the final result. &lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;i&gt;(9) &lt;u&gt;Random Forest
Algorithm Example In Python&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: &amp;quot;times new roman&amp;quot;; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 24px; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: &amp;quot;times new roman&amp;quot;; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 24px; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 36px;&quot;&gt;Using Random Forest we will predict the person will get a loan or not is not, in this first, we will use a Decision Tree and then a Random Forest, in the end, we will compare both of them in term of accuracy.&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 36px;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 36px;&quot;&gt;&lt;span&gt;DATA SET: &lt;a href=&quot;https://github.com/Vegadhardik7/ALL_CSV/blob/master/lending_club_data01.csv&quot; target=&quot;_blank&quot;&gt;Loan_dataset&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Importing Important Libraries&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
import pandas as pd&lt;br /&gt;
import numpy as np&lt;br /&gt;
import seaborn as sns&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
%matplotlib inline
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Importing Dataset&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
data = pd.read_csv(r&quot;D:\Dig\lending_club_data01.csv&quot;)&lt;br /&gt;
data.head()
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieTtDDVoV8yKD-b1K0DGUIqdcHCz3hOLpD6j82tqD6SfVpeJoirr8QngKZN3gg00TDO-cn1Ncc0G7fF7XRkCy-6XK5kBFxVB8o1lXXg9ZauG0QkzWgHFMhi5OELg101ZFky1QXI9FGgYU/s1600/head1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Initial 5 elements of data&quot; border=&quot;0&quot; data-original-height=&quot;218&quot; data-original-width=&quot;785&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieTtDDVoV8yKD-b1K0DGUIqdcHCz3hOLpD6j82tqD6SfVpeJoirr8QngKZN3gg00TDO-cn1Ncc0G7fF7XRkCy-6XK5kBFxVB8o1lXXg9ZauG0QkzWgHFMhi5OELg101ZFky1QXI9FGgYU/s1600/head1.png&quot; title=&quot;Initial 5 elements of data&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Getting Information of the Dataset&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
data.info()
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCANonR6p8mQMJLuSaO4g6dXL5v_v4eybsprXmoP3zAHKh7lopEdaDxlxVSnafU5sVQ1UB1XZbmkriKOHr-egco-IkpSVSbyfBQSQvEO85mqPQ6gnShLa2MEhm-A16UUr-GU9aghU1wcY/s1600/info.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Information of Data&quot; border=&quot;0&quot; data-original-height=&quot;300&quot; data-original-width=&quot;397&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCANonR6p8mQMJLuSaO4g6dXL5v_v4eybsprXmoP3zAHKh7lopEdaDxlxVSnafU5sVQ1UB1XZbmkriKOHr-egco-IkpSVSbyfBQSQvEO85mqPQ6gnShLa2MEhm-A16UUr-GU9aghU1wcY/s1600/info.png&quot; title=&quot;Information of Data&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Overall Description of the Dataset&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
data.describe()
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX3nctLZPqJoPjwtFF3B0toLlF5E6RnemsNiG3rkK9GQcuxbRrzzLoJ6UClKg3JEFfPgFeqHYFYQt4mX80TZHyjkDWxVc0Hi2tT_TsKQoXGcxEj4095h0PTukIWtnK2vrzK6xGZ4PQhwc/s1600/describe.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Description of Data&quot; border=&quot;0&quot; data-original-height=&quot;323&quot; data-original-width=&quot;987&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX3nctLZPqJoPjwtFF3B0toLlF5E6RnemsNiG3rkK9GQcuxbRrzzLoJ6UClKg3JEFfPgFeqHYFYQt4mX80TZHyjkDWxVc0Hi2tT_TsKQoXGcxEj4095h0PTukIWtnK2vrzK6xGZ4PQhwc/s1600/describe.png&quot; title=&quot;Description of Data&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Referring bad_loans column we create good_loans column where we say yes if 0 and no if 1&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
data[&#39;good_loans&#39;]=data[&#39;bad_loans&#39;].apply(lambda y: &#39;yes&#39; if y==0 else &#39;no&#39;)&lt;br /&gt;
data.head()
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfar7a0zRwVk8cefIr17dfMcIDY3DzcEgqpp2F1XnJtxLkREJU8-WwXCO-CA1OX1Lasix9zE6d-DRWOPD0SsOdXvrz7jcKHlCM0_Hyxe4Plo3TrSe4nlxo0L8OQsaUoWO9oG0IGGywV2s/s1600/head2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Head of updated data&quot; border=&quot;0&quot; data-original-height=&quot;211&quot; data-original-width=&quot;887&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfar7a0zRwVk8cefIr17dfMcIDY3DzcEgqpp2F1XnJtxLkREJU8-WwXCO-CA1OX1Lasix9zE6d-DRWOPD0SsOdXvrz7jcKHlCM0_Hyxe4Plo3TrSe4nlxo0L8OQsaUoWO9oG0IGGywV2s/s1600/head2.png&quot; title=&quot;Head of updated data&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#For training: all columns except bad_loans and good_loans &lt;br /&gt;
#For testing: good loans&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
X=data.drop([&#39;bad_loans&#39;,&#39;good_loans&#39;],1)&lt;br /&gt;
y=data[&#39;good_loans&#39;]&lt;br /&gt;
print(X.shape,y.shape)&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-radius: 0px; border: 0px; box-sizing: border-box; line-height: inherit; overflow-wrap: break-word; overflow: auto; padding: 1px 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;(1468, 7) (1468,)&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
# Split data into training and testing&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
from sklearn.model_selection import train_test_split
&lt;br /&gt;
X_train , X_test , y_train , y_test = train_test_split(X,y,test_size=0.2)
&lt;br /&gt;
print(X_train.shape,X_test.shape,y_train.shape,y_test.shape)
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
(1174, 7) (294, 7) (1174,) (294,)
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;b&gt;
# Decision Tree : &lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
from sklearn.tree import DecisionTreeClassifier
&lt;br /&gt;
model=DecisionTreeClassifier()
&lt;br /&gt;
model.fit(X_train,y_train)
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUXqDpL-Am7HiAY38zrT0nsqDm1FwE2ZNxMGlp6rBEvtmQW1e3XtWXEE9cCOCQhduh507nNFkOo_BW2W163bnklWezbngQg6WGLj9Kgh-b9lqDknvcJXaKEjxuVJYhbmsWvA6w-NlYxA/s1600/model_d.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Decision tree fit&quot; border=&quot;0&quot; data-original-height=&quot;152&quot; data-original-width=&quot;822&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUXqDpL-Am7HiAY38zrT0nsqDm1FwE2ZNxMGlp6rBEvtmQW1e3XtWXEE9cCOCQhduh507nNFkOo_BW2W163bnklWezbngQg6WGLj9Kgh-b9lqDknvcJXaKEjxuVJYhbmsWvA6w-NlYxA/s1600/model_d.png&quot; title=&quot;Decision tree fit&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Evaluate our model&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
predict = model.predict(X_test)&lt;br /&gt;
from sklearn.metrics import classification_report, confusion_matrix &lt;br /&gt;
print(confusion_matrix(y_test,predict))
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large; white-space: pre-wrap;&quot;&gt;[[ 16  46]&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-radius: 0px; border: 0px; box-sizing: border-box; line-height: inherit; overflow-wrap: break-word; overflow: auto; padding: 1px 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt; [ 38 194]]&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Result&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
print(classification_report(y_test,predict))
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhADvLyVGU_3ydDEvJCVArTGfXILKv_DSJFYahF8eGAIQW1EbszWnI48TjWZf0elPLorese8nAXHluV780Pv_B4_0_oHy8B6KPXahHR_m4_2kMhp6Ymd0pDymIw0phLSbXGbxNerr0yfLc/s1600/decision_output.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Decision Tree outcome&quot; border=&quot;0&quot; data-original-height=&quot;197&quot; data-original-width=&quot;581&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhADvLyVGU_3ydDEvJCVArTGfXILKv_DSJFYahF8eGAIQW1EbszWnI48TjWZf0elPLorese8nAXHluV780Pv_B4_0_oHy8B6KPXahHR_m4_2kMhp6Ymd0pDymIw0phLSbXGbxNerr0yfLc/s1600/decision_output.png&quot; title=&quot;Decision Tree outcome&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;b&gt;
Decision Tree Accuracy is 71% &lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 21pt; line-height: 150%;&quot;&gt;&lt;b&gt;
# Random Forest : &lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
from sklearn.ensemble import RandomForestClassifier
&lt;br /&gt;
rf_model=RandomForestClassifier(n_estimators=250)
&lt;br /&gt;
rf_model.fit(X_train,y_train)
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbvQ7hd5cauV8ISCKh7sTDS8JQ07yGYVh9jlRtBqVvOxHRd_i5CuJIhMkU8hnDicKMGeljFyO33ba6oxQh4xBQyoxkGYBn-5aM5m77tNhZuW39XtKjI5Fe74Pp2G9cpQp2HGj097J13Ts/s1600/model_r.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Random Forest fit&quot; border=&quot;0&quot; data-original-height=&quot;167&quot; data-original-width=&quot;847&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbvQ7hd5cauV8ISCKh7sTDS8JQ07yGYVh9jlRtBqVvOxHRd_i5CuJIhMkU8hnDicKMGeljFyO33ba6oxQh4xBQyoxkGYBn-5aM5m77tNhZuW39XtKjI5Fe74Pp2G9cpQp2HGj097J13Ts/s1600/model_r.png&quot; title=&quot;Random Forest fit&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
print(X_train.shape,X_test.shape,y_train.shape,y_test.shape)
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-radius: 0px; border: 0px; box-sizing: border-box; line-height: inherit; overflow-wrap: break-word; overflow: auto; padding: 1px 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;(1174, 7) (294, 7) (1174,) (294,)&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Evaluate our model&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
rf_predict = rf_model.predict(X_test)&lt;br /&gt;
print(confusion_matrix(y_test,rf_predict))
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-radius: 0px; border: 0px; box-sizing: border-box; line-height: inherit; overflow-wrap: break-word; overflow: auto; padding: 1px 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-all;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;[[ 10  52]
 [  8 224]]&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
#Result&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
print(classification_report(y_test,rf_predict))&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;
Output :&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGVNww16_iSfhjAXclGVREbTfg495FRI9E1WKlTj5wRga3P291prAPSyyLNklg5zLYUl4AKdTdPLPQMwGF1hVcs4xS62FXgaTxN6ur80GlpXOWY-bZTJtIsUu7Bk8okY_z0pRvFXj_toA/s1600/random_forest_output.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Random Forest Outcome&quot; border=&quot;0&quot; data-original-height=&quot;193&quot; data-original-width=&quot;572&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGVNww16_iSfhjAXclGVREbTfg495FRI9E1WKlTj5wRga3P291prAPSyyLNklg5zLYUl4AKdTdPLPQMwGF1hVcs4xS62FXgaTxN6ur80GlpXOWY-bZTJtIsUu7Bk8okY_z0pRvFXj_toA/s1600/random_forest_output.png&quot; title=&quot;Random Forest Outcome&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;b&gt;
Random Forest Accuracy is 80%&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;
Hence it is proved that Random Forest is more accurate than the Decision Tree.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;, serif; font-size: 18pt; line-height: 150%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;line-height: 28.08px; margin: 0cm 0cm 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;*&amp;nbsp;&lt;u&gt;Random Forest Conclusion&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMdDOf8yKQUGM9I0JqICAI62fjKTiTRrRl1pqsRtRSdSudJf1Pmduw0btaE0H-u97YH5RtQNHhHVzUlLAJqevJPnHFzb10giPKZQwIdu65ELBVSfAJfOS7GB6s8bayMJolRdomyyeDH8U/s1600/Random_Forest_Conclusion.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Random Forest Conclusion&quot; border=&quot;0&quot; data-original-height=&quot;1600&quot; data-original-width=&quot;867&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMdDOf8yKQUGM9I0JqICAI62fjKTiTRrRl1pqsRtRSdSudJf1Pmduw0btaE0H-u97YH5RtQNHhHVzUlLAJqevJPnHFzb10giPKZQwIdu65ELBVSfAJfOS7GB6s8bayMJolRdomyyeDH8U/s1600/Random_Forest_Conclusion.png&quot; title=&quot;Random Forest Conclusion&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CONCLUSION OF RANDOM FOREST&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; font-size: x-large;&quot;&gt;&lt;i&gt;&lt;u&gt;Did I Miss Anything?&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Now I&#39;d like to hear from you:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Do you think Random Forest is awesome?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- What else would you like us to cover on this topic?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- What are the 5 most informative concepts you found in this blog?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Do comment your answers, and don&#39;t forget to share it with your friend so you can discuss more about this topic.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/7573498764061192370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/06/top-10-strategies-which-will-make-you.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/7573498764061192370'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/7573498764061192370'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/06/top-10-strategies-which-will-make-you.html' title='Top 10 Strategies Which Will Make You King Of  RANDOM FOREST [2022]'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioToXpn-pm_lWB7au0jSOUAJUjwQ3nAgO51VABdHI9bmYm-6bK3baPUzfkr-rpmJipnwcjcPL-oAYCZHBp8kEmglfGnLhOuW1vGgBAULmsjyTESKBnuB30so6ZkfU-w6PHhaV2HEZ7gA8/s72-c/Forest_gif.gif" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1277160046114827306.post-4478027428347409641</id><published>2020-05-23T09:47:00.001+05:30</published><updated>2020-05-24T20:24:39.192+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataScience"/><category scheme="http://www.blogger.com/atom/ns#" term="MachineLearning"/><title type='text'>14 MOST ESSENTIAL Concepts About Decision Tree You Need To Know Right Now [BE A PRO]</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;h2 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 34.6667px; line-height: 150%;&quot;&gt;&lt;b&gt;&lt;u&gt;14 MOST ESSENTIAL Concepts About Decision Tree You Need To Know Right Now [BE A PRO]&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 26.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgpDVMyCLdBCIItVQkI4G55NDDuhSvAwK7ql3fUIveei6IILy-XVCTGekxcQYqKLDJjIVOlXlZju93x5V8zMtbWgZLcDRD9ffSAz2FhFC0MjS4eTjnSMnAdHQTURxa6lCCkAmgYpaGF5w/s1600/blue-tree-painting-2397989.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TREE&quot; border=&quot;0&quot; data-original-height=&quot;1447&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgpDVMyCLdBCIItVQkI4G55NDDuhSvAwK7ql3fUIveei6IILy-XVCTGekxcQYqKLDJjIVOlXlZju93x5V8zMtbWgZLcDRD9ffSAz2FhFC0MjS4eTjnSMnAdHQTURxa6lCCkAmgYpaGF5w/s1600/blue-tree-painting-2397989.jpg&quot; title=&quot;TREE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TREE&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 18.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;Decision Tree is a classification algorithm which
comes under the Supervised Learning Technique.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;In this
revolutionizing world of Machine Learning we had covered various topics such as:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l1 level1 lfo1; text-indent: -18.0pt; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: medium;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: large; line-height: 150%;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://www.infinitycodex.in/top-9-essential-concept-of-supervised&quot; target=&quot;_blank&quot;&gt;Supervised Learning&lt;/a&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: medium;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: large; line-height: 150%;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://www.infinitycodex.in/top-7-essential-points-about&quot; target=&quot;_blank&quot;&gt;Unsupervised Learning&lt;/a&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;i&gt;&lt;a href=&quot;https://www.infinitycodex.in/data-science-ss-103-linear-regression_24&quot; target=&quot;_blank&quot;&gt;Linear Regression&lt;/a&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: medium;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: large; line-height: 150%;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://www.infinitycodex.in/logistic-regression-in-machine-learning&quot; target=&quot;_blank&quot;&gt;Logistic Regression&lt;/a&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: medium;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: large; line-height: 150%;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://www.infinitycodex.in/support-vector-machine-in-machine&quot; target=&quot;_blank&quot;&gt;SVM&lt;/a&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.infinitycodex.in/be-pro-at-k-means-clustering-in-just-10&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;K-Means&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--[if !supportLists]--&gt;&lt;br /&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt;&quot;&gt;and many more
interesting topics in a very simple way with minimum use of complex
mathematics. We had also included multiple examples of codes for a better understanding
of there implementation.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;So our
today’s topics is Decision Tree. A topic that every Machine Learning
enthusiastic is awarded about.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Before directly
diving into Decision Tree. Let us see, what all things that we are going to
accomplish in this blog.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(1) &amp;nbsp;What is a Tree?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(2) &amp;nbsp;CART(Classification And Regression Tree)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(3) &amp;nbsp;What is Classification?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(4) &amp;nbsp;Why we need to
Classify?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(5) &amp;nbsp;What is Decision
Tree?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;(6)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;Important&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;Terminologies of a Decision
Tree&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(7) &amp;nbsp;What is Entropy?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(8)
&amp;nbsp;How does Decision Tree work?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(9) &amp;nbsp;What is the Gini Index?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(10) What is
Information Gain?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(11) Application
of Decision Tree&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(12) Advantages
of Decision Tree&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(13) Disadvantages
of Decision Tree&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(14) Decision
Tree Example&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;I hope The agenda of today&#39;s session is absolutely clear to you all. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now Let’s
dive in.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;(1) What is a
Tree?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- In linear the data structure, data is organized in sequential order, and in the non-linear data
structure, data is organized in random order.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- The tree is a very popular data structure used in a wide range of applications. A Tree data
structure can be defined as follows.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- A tree is a non-linear data structure that organizes data in a hierarchical structure.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- The tree represents&amp;nbsp;the
nodes connected by edges.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXKgz5olUwgF2La3Sp3_UD0mwd8A7yd0XoV7botR4qEwSuCTKrj7A3wTH0lvpKjU5pCE1nMWTy1BmdYg_e1Q_yEUIsrjPlozByg9OOrOPS-GurZRV5G4JoaXBJOcMNpqK5uBYzoiU-U2c/s1600/Glossary_of_Tree.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;GLOSSARY TREE&quot; border=&quot;0&quot; data-original-height=&quot;682&quot; data-original-width=&quot;967&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXKgz5olUwgF2La3Sp3_UD0mwd8A7yd0XoV7botR4qEwSuCTKrj7A3wTH0lvpKjU5pCE1nMWTy1BmdYg_e1Q_yEUIsrjPlozByg9OOrOPS-GurZRV5G4JoaXBJOcMNpqK5uBYzoiU-U2c/s1600/Glossary_of_Tree.png&quot; title=&quot;GLOSSARY TREE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;GLOSSARY TREE&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 144.0pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36.0pt; vertical-align: baseline;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;Root&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;-&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;In a Tree data structure, the first node is called the&amp;nbsp;&lt;b&gt;Root Node&lt;/b&gt;. Every Tree must have a root node.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;-Root node is
the origin of tree data structure. In any tree, there must be only one root
node. We never have multiple root nodes in a Tree.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;Parent&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- In a Tree type data structure, the node which is a predecessor of any node is called as&amp;nbsp;&lt;b&gt;Parent
Node&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- Parent Node
can also be defined as “&lt;b&gt;The Node Which Has Child/Children&#39;s&lt;/b&gt;”.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;-The Root
Node is the only node that does not have a Parent Node.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;Child&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- The immediate&amp;nbsp;successor of a node is called as&amp;nbsp;&lt;b&gt;Child Node&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- In a Tree,
any parent node can have any number of Child Nods.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;u&gt;Siblings&lt;/u&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- Children of
the same Parent is called as&amp;nbsp;&lt;b&gt;Siblings&lt;/b&gt;. In simple words, the nodes
with the same parent are called sibling nodes.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Subtree&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- A Subtree is
a set of nodes and edges comprised of a parent and all the descendants&amp;nbsp;of
that&amp;nbsp;parent.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Leaf Node&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- The nodes
which do not have any child is called&amp;nbsp;&lt;b&gt;Leaf&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;Node&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- Leaf Nodes
are called terminal nodes.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(2) CART(
Classification And Regression Tree)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;So let
us see the 2 different categories where Decision Trees can be used.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifw-pi_T51o40saiyUmws_uC3p9xZt15C0kVJQSS5H2XhXrDWub8vk09_vM9VEpxH8YMmtKlOe3Pd58H5BBpvneVeuUy5Wm6tT6_QN8E0H9287PO25OJn3m-paUOUUnDJ6_ritaKpREQo/s1600/CART.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;CART&quot; border=&quot;0&quot; data-original-height=&quot;483&quot; data-original-width=&quot;1600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifw-pi_T51o40saiyUmws_uC3p9xZt15C0kVJQSS5H2XhXrDWub8vk09_vM9VEpxH8YMmtKlOe3Pd58H5BBpvneVeuUy5Wm6tT6_QN8E0H9287PO25OJn3m-paUOUUnDJ6_ritaKpREQo/s1600/CART.png&quot; title=&quot;CART&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CART&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(i) Classification&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(ii) Regression&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(i) Classification:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- Classification
where all the output is categorical i.e either they are True or False, Male or
Female etc or the output belongs to certain category i.e did you scored A, B, C
or D grade in your final examination etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- In
Classification, a Classification Tree will determine a set of logical if-then
conditions to classify problems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example&lt;/b&gt;
: Identifying the fruit is an Apple or Orange.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivNZpnGeQnfWXAjEymkc6WQyoE4focHZISxE_ExJ0OTXiH_KPRb6hglO-hXzWJD0JPGZ0bDKynZTqiyokMHcSo94XLe-iu0moLXhHR_ntkfamKDdfXXR3EGAt4L7dNwK8f0oOvQF7sfz0/s1600/groups_of_apple_and_mango.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;CLASSIFICATION TREE&quot; border=&quot;0&quot; data-original-height=&quot;797&quot; data-original-width=&quot;1008&quot; height=&quot;506&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivNZpnGeQnfWXAjEymkc6WQyoE4focHZISxE_ExJ0OTXiH_KPRb6hglO-hXzWJD0JPGZ0bDKynZTqiyokMHcSo94XLe-iu0moLXhHR_ntkfamKDdfXXR3EGAt4L7dNwK8f0oOvQF7sfz0/s640/groups_of_apple_and_mango.png&quot; title=&quot;CLASSIFICATION TREE&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;CLASSIFICATION TREE&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(ii) Regression:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- Here
we predict the output value as a specific number.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- In
Regression, a Regression Tree is used when the target variable is numerical or
continuous in nature.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- We
fit a regression model to target variables using each of the independent
variables.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- Each
split is made based on the sum of the square error.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCklaOvFuZPiguRScC365co2AU9Xf4MyKOot3ItpreQKvfNq7SV435v9Va3ZGIqRradAYwchlRv5yR10_klMt5ST0NrVAcwLJ9imf6plEFvNDH9qJhV15jCC2VAoE_n1SdzIN7hrL7Dt8/s1600/REGRESSION_TREE.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;REGRESSION TREE&quot; border=&quot;0&quot; data-original-height=&quot;701&quot; data-original-width=&quot;1218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCklaOvFuZPiguRScC365co2AU9Xf4MyKOot3ItpreQKvfNq7SV435v9Va3ZGIqRradAYwchlRv5yR10_klMt5ST0NrVAcwLJ9imf6plEFvNDH9qJhV15jCC2VAoE_n1SdzIN7hrL7Dt8/s1600/REGRESSION_TREE.png&quot; title=&quot;REGRESSION TREE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;REGRESSION TREE&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;For
today’s topic we are going to only focus on the &lt;b&gt;Classification Trees&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;(3) What is
Classification?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;-&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;Classification is a process of categorizing a given
set of data into classes, It can be the performance on both structured or
unstructured data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- The process
started with predicting the class of given data points. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;- The classes
are often referred to as target, label, or categories.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-CemgQ04J4iNfL4Ykzk7T_IxbcAE9zR55FiexjrNJR6RwGV6cG1fUK0aczp7dFQBbi74LR3Y-LZZp4qsneSOXysoQW-R6Ftv8L8xoy5a79QX5lnOjLrkPbWs_l7XGIT-zQkSvInFj4FY/s1600/SPAMClassificationExample.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;E-MAIL IS A SPAM OR HAM&quot; border=&quot;0&quot; data-original-height=&quot;638&quot; data-original-width=&quot;1277&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-CemgQ04J4iNfL4Ykzk7T_IxbcAE9zR55FiexjrNJR6RwGV6cG1fUK0aczp7dFQBbi74LR3Y-LZZp4qsneSOXysoQW-R6Ftv8L8xoy5a79QX5lnOjLrkPbWs_l7XGIT-zQkSvInFj4FY/s1600/SPAMClassificationExample.png&quot; title=&quot;E-MAIL IS A SPAM OR HAM&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;E-MAIL IS SPAM OR HAM&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;normaltextrun&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;Classification&amp;nbsp;is
a technique of&amp;nbsp;categorizing&amp;nbsp;the&amp;nbsp;observation into different
category.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot; style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;Basically&amp;nbsp;we
are doing is, we are taking&amp;nbsp;data analyzing it, and on the basis of some of the conditions we are dividing it into various categories.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;(4) Why do we
classify?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;- We classify
it to perform predictive analysis on it.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;For Example&lt;/b&gt; : &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;When we receive an E-mail, the machine predicts it either it
could be a spam or not spam. On the bases of that prediction we add that
particular mail to the respected folder.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;In general
our Classification algorithm handles questions like:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a.) Is this data belong to A, B, or C.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 16.0pt; line-height: 150%; mso-ansi-language: EN-US;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b.) It&amp;nbsp;is
a Spam or a Ham.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;c.) Is that
person is a Male or a Female?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span class=&quot;normaltextrun&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;(5) What is
Decision Tree?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;eop&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;A Decision Tree is a graphical representation of all the
possible solutions to a decision based on certain conditions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We can also say that the decision tree is a flowchart or a
tree shape diagram which always starts with a Root Node. Each branch of the
tree represents a possible decision, occurrence, or reaction.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Decisions made can be easily explained.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let’s see an example where you want to purchase a house.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnT_R9ErW0gkDZy4oluS7A-wxCGFdbVfZio9UdjKr6qrpf0fh6sJqOcRJijF0GFXj_uXMjDXj94UXEc9nRywm2idHtgnvqlKd0SBCAmX7PCXstyRjjEHAogVt_b3RJJWaYC0QBjHtngms/s1600/HOUSE+PURCHASE+DECISION+TREE.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;DECISION TREE FOR PURCHASING HOUSE&quot; border=&quot;0&quot; data-original-height=&quot;750&quot; data-original-width=&quot;845&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnT_R9ErW0gkDZy4oluS7A-wxCGFdbVfZio9UdjKr6qrpf0fh6sJqOcRJijF0GFXj_uXMjDXj94UXEc9nRywm2idHtgnvqlKd0SBCAmX7PCXstyRjjEHAogVt_b3RJJWaYC0QBjHtngms/s1600/HOUSE+PURCHASE+DECISION+TREE.png&quot; title=&quot;DECISION TREE FOR PURCHASING HOUSE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DECISION TREE FOR PURCHASING HOUSE&lt;/span&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px; text-align: justify;&quot;&gt;In this example of the Decision Tree, we want to buy a but at certain conditions. Such as the price of the house should be&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif;&quot;&gt;₹.&lt;/b&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px; text-align: justify;&quot;&gt;5000000 if it&#39;s in Mumbai than buy it or else don&#39;t buy it and if it&#39;s in Pune check if it has 2 BHK or not if it&#39;s 2 BHK then purchase the house or else don&#39;t purchase the house.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span class=&quot;eop&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(6)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;Important Terminologies of a Decision Tree&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Basically
there are 6 main terminologies regarding Decision Tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(a) Entropy&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(b) Pruning&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(c) Gini Index&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(d)&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px;&quot;&gt;Information Gain&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 24px; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16pt; line-height: 32px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(e)&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px;&quot;&gt;Reduction in Variance&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;line-height: 24px; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16pt; line-height: 32px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(f)&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 21.3333px;&quot;&gt;Chi-Square&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(a) Entropy:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Entropy
is the measure of &lt;b&gt;Randomness&lt;/b&gt; or &lt;b&gt;Unpredictability&lt;/b&gt; in the Dataset.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGeDWSQpxB4oFK7aZSb_n8MJfPFuMy84T1q82VE0X5kp5Nau7V0_C4g_azZ0-tR5L95mAh1IvyJ1KhGBwzkVK0MFuQAz7zBpTIwdcFt620QZ8qlVVI4IkZwj-UmndHcKLgWx5nCzMk1jI/s1600/eat-3654444_1920.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FRUIT BASKET&quot; border=&quot;0&quot; data-original-height=&quot;1235&quot; data-original-width=&quot;1600&quot; height=&quot;492&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGeDWSQpxB4oFK7aZSb_n8MJfPFuMy84T1q82VE0X5kp5Nau7V0_C4g_azZ0-tR5L95mAh1IvyJ1KhGBwzkVK0MFuQAz7zBpTIwdcFt620QZ8qlVVI4IkZwj-UmndHcKLgWx5nCzMk1jI/s640/eat-3654444_1920.png&quot; title=&quot;FRUIT BASKET&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FRUIT BASKET&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 21.3333px;&quot;&gt;If I tell you to pick you the fruit from the basket with your eyes close then the entropy will be max. But in real life entropy should be minimum.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(b) Pruning:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Basically
we can say that this is the opposite of Splitting, in this we remove unwanted
branches from the tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;For
Example&lt;/b&gt; :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPlKjMrka1gpX6NB5JIMkclujoLzILkNrNtOvelBVCiWQ4hrqt6PoF8O9bRcM3FgB4KmN5nBBep5qieioD57PDkt2iiU1j7wCulLOf434x2sBytmdDdei7vPz6f79LGfyQz4XXM_TTkRo/s1600/Pruning.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;PRUNING&quot; border=&quot;0&quot; data-original-height=&quot;370&quot; data-original-width=&quot;1127&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPlKjMrka1gpX6NB5JIMkclujoLzILkNrNtOvelBVCiWQ4hrqt6PoF8O9bRcM3FgB4KmN5nBBep5qieioD57PDkt2iiU1j7wCulLOf434x2sBytmdDdei7vPz6f79LGfyQz4XXM_TTkRo/s1600/Pruning.png&quot; title=&quot;PRUNING&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;PRUNING&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We removed
the unwanted branch from the tree because we don’t want it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(c) Gini
Index :&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The measure of impurity (or purity) used in building Decision Tree in CART is Gini
Index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(d) Information
Gain :&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The
information Gain is the decrease in entropy after a dataset is split on the
basis of an attribute. Constructing a decision tree is all about a fighting
attribute that returns the highest information gain.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; text-align: center; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Information Gain = Entropy(s) – [
(Weighted Average) * Entropy(each feature)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(e) Reduction
in Variance :&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Reduction
invariance is an algorithm used for continuous target variable (regression
problems). This split with lower variance is selected as the criteria to split
the population.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(f) Chi-square
:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;It is an
algorithm to find out the statistical significance between the difference
between sub-nodes and parent node.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now
the main question is how will you decide the best attribute? For now just
understand that you need to calculate something called&amp;nbsp;&lt;b&gt;Information Gain&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The
attribute with the highest information gain is considered as best. Before
understanding information gain let’s first understand entropy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(7) What
is Entropy?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Entropy
is the metric, which measures the impurity of something or in other words you
can say that it is a first step to do before you solve the problem for Decision
Tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let’s
understand a term known as &lt;b&gt;Impurity &lt;/b&gt;before understanding Entropy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5OTzlafNGUDk2zj-ulBo_25hn5NWiIXcBUIdHcluv42_yO-2I1h081Er3qRehF3cUsjcOjgSMcP__8trdX6mWh6dKJ8wFQvG4oUizclKCFvzpjt8ls3HwlEejDPkzOZCxY_C43rgudGk/s1600/entropy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;LOW AND HIGH ENTROPY&quot; border=&quot;0&quot; data-original-height=&quot;458&quot; data-original-width=&quot;970&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5OTzlafNGUDk2zj-ulBo_25hn5NWiIXcBUIdHcluv42_yO-2I1h081Er3qRehF3cUsjcOjgSMcP__8trdX6mWh6dKJ8wFQvG4oUizclKCFvzpjt8ls3HwlEejDPkzOZCxY_C43rgudGk/s1600/entropy.png&quot; title=&quot;LOW AND HIGH ENTROPY&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;LOW / HIGH ENTROPY&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;For
Example&lt;/b&gt; :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let’s
say you have a dataset and you are trying to distinguish between various fruits
and instead of taking multiple factors under consideration, you only took color
as the only feature for differencing the fruits.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;So
what will happen is, for example there are green apple and red apple and strawberry
in the dataset. You will keep the red apples and the strawberry in one basket.
So here we can say that in this impurity is not zero which means that the
impurity in this exists.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7UKQmbzumueOW9TRh17Y8_Cq0g6BnW6yf1V_hYKideFWb-XiDZJb8UxB8kUwS36HvoW31AcLIPdNkWXpKrmYS3q_sTWMuOVCcW-w94bItDd_7o7lDK1xKnNyxZaqkEraupTMHYCwpRDE/s1600/entropy_fruits.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ENTROPY&quot; border=&quot;0&quot; data-original-height=&quot;656&quot; data-original-width=&quot;1135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7UKQmbzumueOW9TRh17Y8_Cq0g6BnW6yf1V_hYKideFWb-XiDZJb8UxB8kUwS36HvoW31AcLIPdNkWXpKrmYS3q_sTWMuOVCcW-w94bItDd_7o7lDK1xKnNyxZaqkEraupTMHYCwpRDE/s1600/entropy_fruits.png&quot; title=&quot;ENTROPY&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ENTROPY&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now
come back to the word &lt;b&gt;Entropy&lt;/b&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* Defines
randomness in the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* Entropy
is just a metric that measures the impurity.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* It is
the first step to solve the problem of a decision tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjahtHuxaZfhc8MiC5MC7jsXdtXK0Q00IK_XhedcqgPgOInmIIXw-sRdbc-K4yhYAzPnYnJt3qoCrYlpA60OT3zxOqQZpaaI_mqBBFYElinaId5u8yeYo6x4_Wk8zmcwGv59A0NX_aZNlk/s1600/entropy_graphs.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;613&quot; data-original-width=&quot;757&quot; height=&quot;518&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjahtHuxaZfhc8MiC5MC7jsXdtXK0Q00IK_XhedcqgPgOInmIIXw-sRdbc-K4yhYAzPnYnJt3qoCrYlpA60OT3zxOqQZpaaI_mqBBFYElinaId5u8yeYo6x4_Wk8zmcwGv59A0NX_aZNlk/s640/entropy_graphs.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ENTROPY GRAPH&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;From
the above graph you can see that if the probability is 0 or 1 then it means
that they are highly impure and if the value is 0.5 then it means that the
value is very pure.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now
you will be thinking why the value of the entropy is pure at 0.5? Let me derive
it mathematically.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;As you
can see that the formula of entropy is :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;Entropy(s)
= -P(yes) log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 9.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; P(yes) – P(no) log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 9.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; P(no)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Where;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* s is
the total sample space.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* P(yes)
is the probability of Yes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* P(no)
is the probability of No.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;If
number of yes = number of no i.e P(s) = 0.5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo2; text-indent: -18.0pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-size: 21.3333px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;→&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Entropy(s) = 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;If it
contains all yes or all no i.e P(s) = 1 or 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo2; text-indent: -18.0pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 24px;&quot;&gt;&lt;span style=&quot;font-size: 21.3333px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;→&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt; line-height: 32px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;Entropy(s) = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let’s
start with conditions :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;1.) Condition
1 Probability = 0.5&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= -P(yes) log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; P(yes)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;When
P(yes) = P(no) = 0.5 i.e YES + NO = Total Sample(s)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;E(s)
= 0.5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now
substitute that value 0.5 into the formula.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= 0.5 log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 0.5 – 0.5 log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 0.5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= 0.5(log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 0.5 – log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 0.5)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;E(s)
= 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;2.) Condition
2 Either we have total YES or total NO&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(i) Total
YES :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= -P(yes) log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; P(yes)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;When
P(yes) = 1 i.e YES = Total Sample(s)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= 1 log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 1&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;… log 1 = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;E(s)
= 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;(ii)Total
NO :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= -P(no) log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; P(no)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;When
P(no) = 1 i.e YES = Total Sample(s)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;E(s)
= 1 log&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 11.0pt; line-height: 150%;&quot;&gt;2&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt; 1&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;… log 1 = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;E(s)
= 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(8) How
does Decision Tree work?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;I am
sure most of you have a general idea about how a decision tree works, but for
better understanding and for clear knowledge let’s take an example dataset and
understand it diagrammatically.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNZbZmrwO52irAQlA65P6ylTvExyGzhSqXYfyR0fGz-4nc78Bk7VSHDjULUsMlF-1vvR0CKndGeyLwM4Nf6l_QibjzT4IQy3MYKAHnVFGsRHgOP8x3JWkNi7D0ekghfOzrk7YDZ88bwCA/s1600/tabel.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;DATASET&quot; border=&quot;0&quot; data-original-height=&quot;511&quot; data-original-width=&quot;598&quot; height=&quot;546&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNZbZmrwO52irAQlA65P6ylTvExyGzhSqXYfyR0fGz-4nc78Bk7VSHDjULUsMlF-1vvR0CKndGeyLwM4Nf6l_QibjzT4IQy3MYKAHnVFGsRHgOP8x3JWkNi7D0ekghfOzrk7YDZ88bwCA/s640/tabel.png&quot; title=&quot;DATASET&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DATASET&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 16pt;&quot;&gt;In
this dataset each row is an example and the initial 2 columns provide features
or attributes that describe the data and the last column gives the label or
the class we want to predict.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;Now if
you look at this dataset this is very straight forward except from 1 thing. If
you look at our 4&lt;/span&gt;&lt;sup&gt;th&lt;/sup&gt; &lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;label column and compare that with 1&lt;sup&gt;st&lt;/sup&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;and 2&lt;sup&gt;nd&lt;/sup&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;labels you will notice that the features are the same but the label is different.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let’s
see diagrammatically how the decision tree handles this case.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;In
order to build this decision tree we will be using CART which we have discussed
above.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;Step1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We
will start with the root node as a tree and all the nodes receive a list of
rows as input and root will receive the entire training dataset.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;Step2&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Now
each node will ask True or False questions about one feature and in response to
that question we will split or partition the dataset into 2 different subsets
these subsets then become an input to 2 child nodes. The goal of the question is
to finally unmix the label as we proceed down or in other words to produce the purest possible distribution of the labels at each node.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoJb3ypefEGHx8AMaxmBzclwOn9Tak_9Q6GRfD8RLvlHecAqbTHsuoasWSYzJms13CTTG9nT60wwyxwelXl9rguNqoeweyN-QQHINh_T3RaC1pkst_JhsjRYAogln1veh7GJYfawy9VdQ/s1600/DECISION_TREE_PART1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;SPLITTING&quot; border=&quot;0&quot; data-original-height=&quot;526&quot; data-original-width=&quot;812&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoJb3ypefEGHx8AMaxmBzclwOn9Tak_9Q6GRfD8RLvlHecAqbTHsuoasWSYzJms13CTTG9nT60wwyxwelXl9rguNqoeweyN-QQHINh_T3RaC1pkst_JhsjRYAogln1veh7GJYfawy9VdQ/s1600/DECISION_TREE_PART1.png&quot; title=&quot;SPLITTING&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SPLITTING&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Step3:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The input of this node contains only one single type of label so we could say that
it’s perfectly unmixed there is no uncertainty about the type of label as it
consists of the only strawberry. On the other hand labels in this node are still
mixed up. So we will ask another question to further drill it down. But before
that, we need to understand which question to ask and when to do that we need
to quantify how much question helps to unmix the label and then we can quantify
the amount of uncertainty at a single node using a metric called &lt;b&gt;Gini&lt;/b&gt; &lt;b&gt;impurity
&lt;/b&gt;and we can quantify how much a question reduces that uncertainty using a concept called &lt;b&gt;Information Gain&lt;/b&gt;. We will use this to ask the best questions
at each point and then we will iterate the steps and we will recursively build
a tree on each of the new nodes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFHzm8UYzwcC5L86A6F2kuA_Bds2JYyL-JVBSbf18r8GeXifUhwutCZXNfh3j-PrrfaNpv6b5SBdAGe6Ufoxekfnl1UmhVnswEFzkEaHW0DDjL5tjEjZJhx3J9sS_-_Ntuq9X2oHQSZZ0/s1600/DECISION_TREE_HALF.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FURTHER SPLITTING&quot; border=&quot;0&quot; data-original-height=&quot;660&quot; data-original-width=&quot;947&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFHzm8UYzwcC5L86A6F2kuA_Bds2JYyL-JVBSbf18r8GeXifUhwutCZXNfh3j-PrrfaNpv6b5SBdAGe6Ufoxekfnl1UmhVnswEFzkEaHW0DDjL5tjEjZJhx3J9sS_-_Ntuq9X2oHQSZZ0/s1600/DECISION_TREE_HALF.png&quot; title=&quot;FURTHER SPLITTING&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FURTHER SPLITTING&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Step4:
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We
will continue to divide the data until there are no further questions to ask
and then we will finally reach our leaf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKTEEpIapaP9dYB9qRaVQZcZjsfnlyp9r6cntSP80Yt9lOZUDipXIQFkyoTdyfXYZpRabe91rPUf3pYifm4dNnR4LxnvE6g_iAvRg3vUAPUK5_NZaw7Q3vQNn_Mj6QEKCdim6AOCV6mmw/s1600/DECISION_TREE_FINAL.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;FINAL DECISION TREE&quot; border=&quot;0&quot; data-original-height=&quot;692&quot; data-original-width=&quot;975&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKTEEpIapaP9dYB9qRaVQZcZjsfnlyp9r6cntSP80Yt9lOZUDipXIQFkyoTdyfXYZpRabe91rPUf3pYifm4dNnR4LxnvE6g_iAvRg3vUAPUK5_NZaw7Q3vQNn_Mj6QEKCdim6AOCV6mmw/s1600/DECISION_TREE_FINAL.png&quot; title=&quot;FINAL DECISION TREE&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;FOUND LEAF NODE&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(9) What
is the Gini Index?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 10.3pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Gini index means that, if we select 2 items from a given
dataset at random then they must be of same probability and class for this population
should be pure.&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 10.3pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;It works with the categorical target variable “True” or “False”.&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 12.6pt; mso-list: l2 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;It performs only
Binary (0/1) splits&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 24.0pt; mso-list: l2 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Higher the value of
Gini index is higher the homogeneity.&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 24.0pt; mso-list: l2 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;b&gt;CART&lt;/b&gt;
(Classification and Regression Tree) uses the Gini method to create binary splits.&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Steps to Calculate Gini for a split :&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 24.0pt; mso-list: l0 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Calculate Gini for
sub-nodes, using formula sum of the square of probability for True and False
(&lt;i&gt;p²+q²&lt;/i&gt;).&lt;/span&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 12.6pt; mso-list: l0 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Calculate the Gini
index for split using the weighted Gini score of each node of that split.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 22.5pt; margin-right: 0cm; margin-top: 12.6pt; mso-list: l0 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16.0pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background: white; line-height: 150%; margin: 20.65pt 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; letter-spacing: -0.25pt; line-height: 150%;&quot;&gt;(10) What is Information Gain?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 10.3pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;In Information Gain, Less
impure node requires less information to describe it and a more impure node
requires more information to describe it. Information theory is a measure to
define this degree of disorganization in a system known as &lt;b&gt;Entropy&lt;/b&gt;. If
the sample is completely &lt;b&gt;homogeneous&lt;/b&gt;, then the entropy is &lt;b&gt;0&lt;/b&gt; and
if the sample is equally divided into &lt;b&gt;half&lt;/b&gt; at each side i.e 50% - 50%
then it has an entropy of &lt;b&gt;1&lt;/b&gt;.&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Entropy can be calculated
using the formula:&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Entropy = -p log&lt;sub&gt;2&lt;/sub&gt;
p — q log&lt;sub&gt;2&lt;/sub&gt;q&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Here &lt;i&gt;p&lt;/i&gt; is the probability
of success and &lt;i&gt;q&lt;/i&gt; is the probability of failure in that node. Entropy is also
used with a categorical target variable. It chooses the split which has the lowest
entropy compared to the parent node and other splits. The lesser the entropy, the
better it is.&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Steps to calculate the entropy
for a split:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 18.0pt; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Step 1: Calculate entropy of
parent node.&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 18.0pt; margin-right: 0cm; margin-top: 12.6pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;Step 2: Calculate entropy of
each individual node of split and calculate the weighted average of all sub-nodes
available in the split.&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 24.0pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;We can derive information
gain from entropy as&amp;nbsp;&lt;b&gt;1- Entropy.&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16pt; letter-spacing: -0.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 12.6pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;gj&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 0cm; margin-right: 0cm; margin-top: 12.6pt;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; letter-spacing: -.05pt; line-height: 150%;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(11) Application of Decision Tree&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We use
Decision Tree more often then you think. Here are some of the real world
application of Decision Tree which will blow you mind.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(i) Telecommunication
Industry :&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrGbBJhUURe41KccIs_O1GQ5WteI2iEDJ3k5cm7AoJrAEDB_ySLI0Syqe8xdDiTiKTNE7YAMgzBP0iJOA3Urkuc0Ckv5_YtA6Tm0XYL5QQggM8oJG2nMAXQDK93FWTsmJu3S2-2Urpd6E/s1600/satellites-152495_1280.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;TELECOMMUNICATION&quot; border=&quot;0&quot; data-original-height=&quot;1280&quot; data-original-width=&quot;1239&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrGbBJhUURe41KccIs_O1GQ5WteI2iEDJ3k5cm7AoJrAEDB_ySLI0Syqe8xdDiTiKTNE7YAMgzBP0iJOA3Urkuc0Ckv5_YtA6Tm0XYL5QQggM8oJG2nMAXQDK93FWTsmJu3S2-2Urpd6E/s640/satellites-152495_1280.png&quot; title=&quot;TELECOMMUNICATION&quot; width=&quot;618&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;TELECOMMUNICATION&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Telecommunication
Industry uses this very often as if you want to chat with customer care, you
might have noticed that they guide you, by instructing you to provide you the
best services they can. For example Press 1 for Hindi, Press 2 for English so
on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;(ii) Online
Shopping:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5EQNwRRQ-XnWvckFoTRoB7-1q6hVfa0aKV8V4wg249wlTBFhOyHse4r86guEXsP8yn9bsL5XGJVuSI5UZR2KET4kHrFKmIWqmDZZxf083JU4W-fTqOol4PwZV8qcwhQAZ_d0wPzBbYeY/s1600/template-1599667_1280.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ONLINE SHOPPING&quot; border=&quot;0&quot; data-original-height=&quot;853&quot; data-original-width=&quot;1280&quot; height=&quot;426&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5EQNwRRQ-XnWvckFoTRoB7-1q6hVfa0aKV8V4wg249wlTBFhOyHse4r86guEXsP8yn9bsL5XGJVuSI5UZR2KET4kHrFKmIWqmDZZxf083JU4W-fTqOol4PwZV8qcwhQAZ_d0wPzBbYeY/s640/template-1599667_1280.png&quot; title=&quot;ONLINE SHOPPING&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ONLINE SHOPPING&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Online The marketing industry uses the Decision Tree for several purposes, such as based on
the last purchase or based on the last search of the product they show you more
similar products. Amazon uses this very often, we search for sports shoes it
will show us all kinds of sports shoes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(iii) Handle
our Craving :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-FUODK5QBypy9VsvpBqPo9qwA7NndJTc35I4xatbetMWOABOFcfBsnhDv7i7OR51825rS6v0NXXuFrTAr8L8YUfFbc3THkuSgKUoipGHWy6zmDAhwlW2XNgK515cV5HYXRcrpc3cBVA/s1600/cake-4885715_1920.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;PIZZA&quot; border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1600&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-FUODK5QBypy9VsvpBqPo9qwA7NndJTc35I4xatbetMWOABOFcfBsnhDv7i7OR51825rS6v0NXXuFrTAr8L8YUfFbc3THkuSgKUoipGHWy6zmDAhwlW2XNgK515cV5HYXRcrpc3cBVA/s640/cake-4885715_1920.jpg&quot; title=&quot;PIZZA&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;PIZZA&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;I know
this is funny, but give it a thought. Let’s say you have 20$ and we are very
hungry. So what will you do? eat 1 pizza or eat 2 burgers. I leave this
completely up to use guys😂.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(12) Advantages
of Decision Tree :&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let us
see the Advantages of Decision Trees :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* It is
simple to understand.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* It is
not difficult to interpret and visualize it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* Very
Less efforts are required for data preparation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* We
can handle both numerical and categorical data with the help of the Decision Tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* Performance
of the Decision Tree is not Effected by the non-linear parameters.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(13) Disadvantages
of Decision Tree :&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Let us
see the Disadvantages of Decision Trees :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;*&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;The Primary disadvantages of the decision
tree are overfitting. Overfitting occurs when the algorithm capture noise in the
data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* In
decision tree there is also a problem of high variance. The model can get
unstable due to small variance in the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* In a decision tree is there is Low Biased tree. A highly complicated decision tree
tends to have a low bias which makes it difficult for the model to work with
new data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;* Calculation can get very complex particularly if many
values are uncertain and if many outcomes are linked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;line-height: 150%; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;(14) Decision
Tree Example :&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Will
that movie will win Oscar or Not?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 16.0pt; line-height: 150%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;CSV File&lt;/b&gt; : &lt;a href=&quot;https://github.com/Vegadhardik7/ALL_CSV/blob/master/classification.csv&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;Classification_dataset&lt;/i&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;# Import all libraries&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;import pandas as pd&lt;br /&gt;import numpy as np&lt;br /&gt;import seaborn as sns&lt;br /&gt;import matplotlib.pyplot as plt&lt;br /&gt;%matplotlib inline&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;# Import Dataset&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot; style=&quot;orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; widows: 2;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;df = pd.read_csv(&quot;E:\college_pics\Rainbow6\classification.csv&quot;,header=0)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;df.head().T&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKQTfosrz3uZV40M-2j22M11JrrK6JYh83tiWXrwmsncdTV3DRpAuzpAbDpzaM0DUpI-Xvc76L5ut57atkLC3e7Rwbif7dPu3VgMEg6IIHCFPwL0JHlNfOknKE6ucAJv6lE6VXrGGpGdE/s1600/head.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;df.head().T&quot; border=&quot;0&quot; data-original-height=&quot;706&quot; data-original-width=&quot;562&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKQTfosrz3uZV40M-2j22M11JrrK6JYh83tiWXrwmsncdTV3DRpAuzpAbDpzaM0DUpI-Xvc76L5ut57atkLC3e7Rwbif7dPu3VgMEg6IIHCFPwL0JHlNfOknKE6ucAJv6lE6VXrGGpGdE/s640/head.png&quot; title=&quot;df.head().T&quot; width=&quot;508&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;# Display information of the dataset&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
df.info()
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyHM0FxfxCiYNvWD1jQPIaBDsOT7zU_kR-B4qhqV0O68mwgmR5ySLwNLYqxH5_wU4AxvRWwtQa4_O44CxZeN3oeZlCVBN2FGQkjTeQN-LqNZl8CpE8KMflr05jAbH6RsEPrU8a6yfnWIY/s1600/ino.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;df.info()&quot; border=&quot;0&quot; data-original-height=&quot;563&quot; data-original-width=&quot;472&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyHM0FxfxCiYNvWD1jQPIaBDsOT7zU_kR-B4qhqV0O68mwgmR5ySLwNLYqxH5_wU4AxvRWwtQa4_O44CxZeN3oeZlCVBN2FGQkjTeQN-LqNZl8CpE8KMflr05jAbH6RsEPrU8a6yfnWIY/s640/ino.png&quot; title=&quot;df.info()&quot; width=&quot;536&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;# Handel Missing Values&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
df[&#39;Time_taken&#39;].fillna(value = df[&#39;Time_taken&#39;].mean(),inplace=True)&lt;br /&gt;
df.head().T
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAestUGq0XpQTzrvG4e2ByaMt81mF66MLkrNhClXQbD7fYY7TN4XVqogImWDCy8k7lc92Gp3_7Ft_C4rbvc_oOEwPdb_c0hfKNm44S1avJ5DhLZSTlR6HtUcTpCZDizrh9RRgQbAzdXko/s1600/head2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;df.head()&quot; border=&quot;0&quot; data-original-height=&quot;705&quot; data-original-width=&quot;550&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAestUGq0XpQTzrvG4e2ByaMt81mF66MLkrNhClXQbD7fYY7TN4XVqogImWDCy8k7lc92Gp3_7Ft_C4rbvc_oOEwPdb_c0hfKNm44S1avJ5DhLZSTlR6HtUcTpCZDizrh9RRgQbAzdXko/s640/head2.png&quot; title=&quot;df.head()&quot; width=&quot;498&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
df.info()
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitrknOqZPIGU0KY6Bfeu3-wO3wkC6BijuxahKfKnvMq_nnykYxgGOlfVAN8XMg4TBdRBC1BB05AiBgJYIbGLyo6VbgJkvTMHEVgjGGX_n8j1b2lmvEreJ6_VCvMbO1yaH5swm5JBJ54YM/s1600/info2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;561&quot; data-original-width=&quot;465&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitrknOqZPIGU0KY6Bfeu3-wO3wkC6BijuxahKfKnvMq_nnykYxgGOlfVAN8XMg4TBdRBC1BB05AiBgJYIbGLyo6VbgJkvTMHEVgjGGX_n8j1b2lmvEreJ6_VCvMbO1yaH5swm5JBJ54YM/s640/info2.png&quot; width=&quot;530&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;# Creating Dummy Variables&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
df = pd.get_dummies(df,columns = [&#39;3D_available&#39;,&#39;Genre&#39;], drop_first=True)&lt;br /&gt;
df.head().T
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Eg6T8U2BfhTssj-az98qHMhnqbgiFJwM7C6iqh8bVVSSQQORfs65lOqykUeWkFPqVIhEApoLCrW3aTJXzxWpFD2gjQ4-paoAo-pKmtyCv51pT9_c-XLmrfgggSQqmXHL6KRoF53eROo/s1600/head3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;df.head().T&quot; border=&quot;0&quot; data-original-height=&quot;773&quot; data-original-width=&quot;727&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Eg6T8U2BfhTssj-az98qHMhnqbgiFJwM7C6iqh8bVVSSQQORfs65lOqykUeWkFPqVIhEApoLCrW3aTJXzxWpFD2gjQ4-paoAo-pKmtyCv51pT9_c-XLmrfgggSQqmXHL6KRoF53eROo/s640/head3.png&quot; title=&quot;df.head().T&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;# X and y split&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
X = df.drop(&#39;Start_Tech_Oscar&#39;,axis=1)&lt;br /&gt;
type(X)
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;pandas.core.frame.DataFrame&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
X.shape&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(506, 20)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
y = df[&#39;Start_Tech_Oscar&#39;]&lt;br /&gt;
type(y)
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;pandas.core.series.Series&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
y.shape&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(506,)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;# Train-Test Split&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
from sklearn.model_selection import train_test_split &lt;br /&gt;
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=0)
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
X_train.shape&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif; font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(404, 20)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
X_test.shape&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(102, 20)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;# Training Classification Tree&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
from sklearn import tree&lt;br /&gt;
from sklearn.tree import DecisionTreeClassifier&lt;br /&gt;

model = DecisionTreeClassifier(max_depth=3)&lt;br /&gt;
model.fit(X_train,y_train)
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
DecisionTreeClassifier&lt;br /&gt;
(class_weight=None, criterion=&#39;gini&#39;, max_depth=3,&lt;br /&gt;
                       max_features=None, max_leaf_nodes=None,&lt;br /&gt;
                       min_impurity_decrease=0.0, min_impurity_split=None,&lt;br /&gt;
                       min_samples_leaf=1, min_samples_split=2,&lt;br /&gt;
                       min_weight_fraction_leaf=0.0, presort=False,&lt;br /&gt;
                       random_state=None, splitter=&#39;best&#39;)&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;# Predicting Values using the trained model&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;y_train_pred = model.predict(X_train)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;y_test_pred = model.predict(X_test)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;y_train_pred.shape&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;(404,)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
y_test_pred&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
array([0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0,&lt;br /&gt;
       0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,&lt;br /&gt;
       0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0,&lt;br /&gt;
       0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,&lt;br /&gt;
       0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0], dtype=int64)

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;# Model Performance&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
from sklearn.metrics import accuracy_score, confusion_matrix &lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
confusion_matrix(y_train, y_train_pred)&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
array([[172,  14],&lt;br /&gt;
       [126,  92]], dtype=int64)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
confusion_matrix(y_test, y_test_pred)&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
array([[39,  5],&lt;br /&gt;
       [41, 17]], dtype=int64)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
accuracy_score(y_test, y_test_pred)&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
0.5490196078431373&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
dot_data = tree.export_graphviz(model, out_file=None, feature_names=X_train.columns, filled=True)&lt;br /&gt;&lt;br /&gt;

from IPython.display import Image&lt;br /&gt;
import pydotplus&lt;br /&gt;
graph = pydotplus.graph_from_dot_data(dot_data)&lt;br /&gt;
Image(graph.create_png())
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH5tKTvDFpVTNDBNq9Vf73rzSDZnC2LiokRHnEGCYleptIqvWLhSl6r0NaTM3ITWlJsdrmIhUbel8Nj-3pTx0Zx4i7-9XVoxKfT0cQEEGco3VJhINg-70ArQURMDEy413qcTiDYYjyNYo/s1600/dig1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;diagram1&quot; border=&quot;0&quot; data-original-height=&quot;572&quot; data-original-width=&quot;1385&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH5tKTvDFpVTNDBNq9Vf73rzSDZnC2LiokRHnEGCYleptIqvWLhSl6r0NaTM3ITWlJsdrmIhUbel8Nj-3pTx0Zx4i7-9XVoxKfT0cQEEGco3VJhINg-70ArQURMDEy413qcTiDYYjyNYo/s1600/dig1.png&quot; title=&quot;diagram1&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;
model2 = DecisionTreeClassifier(min_samples_leaf=20, max_depth=4)&lt;br /&gt;
model2.fit(X_train,y_train)&lt;br /&gt;&lt;br /&gt;


dot_data_2 = tree.export_graphviz(model2, out_file=None, feature_names=X_train.columns, filled=True)
&lt;br /&gt;
from IPython.display import Image&lt;br /&gt;
import pydotplus&lt;br /&gt;
graph2 = pydotplus.graph_from_dot_data(dot_data_2)&lt;br /&gt;
Image(graph2.create_png())
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuJnHECjKj84G6SF0bYN1UDrui91VjlAQKno8WgaAe1fT0CoIZDS1C9Ko1n-ZP6wOZ4fwYaXVxCd49ioQQ6I-1sp6XsOCGAxFytWJxFXW6api6ISC4QWCAc5bVR12BEVSiPMxBcKxDY5A/s1600/dig2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;diagram2&quot; border=&quot;0&quot; data-original-height=&quot;636&quot; data-original-width=&quot;764&quot; height=&quot;532&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuJnHECjKj84G6SF0bYN1UDrui91VjlAQKno8WgaAe1fT0CoIZDS1C9Ko1n-ZP6wOZ4fwYaXVxCd49ioQQ6I-1sp6XsOCGAxFytWJxFXW6api6ISC4QWCAc5bVR12BEVSiPMxBcKxDY5A/s640/dig2.png&quot; title=&quot;diagram2&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot; , serif; font-size: large; line-height: 25.68px;&quot;&gt;accuracy_score(y_test, model2.predict(X_test))
&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot; style=&quot;line-height: 150%; margin-bottom: .0001pt; margin: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
0.5588235294117647&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;line-height: 28.08px; margin: 0cm 0cm 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;h3 style=&quot;line-height: 28.08px; margin: 0cm 0cm 0.0001pt; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;line-height: 28.08px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;* &lt;u&gt;Decision Tree Summary&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Let us summarize everything:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- We saw what is Tree and some important terms related to it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- CART: Classification and Regression Tree.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Then we saw what classification is and a SPAM and HAM image.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- After that, we saw why do we classify?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- We understood the Decision Tree with a House Purchasing example.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Some Important Terminologies.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Then we saw what is Entropy. In which we saw a diagram and a graph with values 0, 0.5, and 1.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Then we saw how the Decision Tree works with an example.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- We also saw the Gini index and steps to calculate it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Which lead us to Information Gain and how to calculate it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Then we saw the various real-life application of&amp;nbsp; Decision Tree.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- After that, we had a glimpse of the Advantages of the Decision Tree.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Everything has its own disadvantages, So we also saw Disadvantages of the Decision Tree.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Then we saw a coding step by step example of the Decision Tree.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-large;&quot;&gt;&lt;i&gt;&lt;u&gt;Did I Miss Anything?&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Now I&#39;d like to hear from you:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- Which Concept did you like the most?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- What else would you like us to cover on this topic?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;- What are the 5 most informative concepts you found in this blog?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: yellow; font-family: &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Do comment, your answers and don&#39;t forget to share it with your friend so, you can discuss more this topic.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://www.infinitycodex.in/feeds/4478027428347409641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.infinitycodex.in/2020/05/14-most-essential-concepts-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/4478027428347409641'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1277160046114827306/posts/default/4478027428347409641'/><link rel='alternate' type='text/html' href='https://www.infinitycodex.in/2020/05/14-most-essential-concepts-about.html' title='14 MOST ESSENTIAL Concepts About Decision Tree You Need To Know Right Now [BE A PRO]'/><author><name>InfinityCodeX</name><uri>http://www.blogger.com/profile/03207047019429800699</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_E6n2c-gwdHP07X7LOd6vJr-pPfmWyJwfFdD-kTmPIIjPAE61fi5hPNULHEXN3JJLM83y_NlO9sLSXvGm8wHaFqJaLNiK9w5_a1UXK2XGlowg78q4ak2D3UoHb7eGkQ/s113/copy.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgpDVMyCLdBCIItVQkI4G55NDDuhSvAwK7ql3fUIveei6IILy-XVCTGekxcQYqKLDJjIVOlXlZju93x5V8zMtbWgZLcDRD9ffSAz2FhFC0MjS4eTjnSMnAdHQTURxa6lCCkAmgYpaGF5w/s72-c/blue-tree-painting-2397989.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>